@prosekit/lit 0.0.0-next-20230627094841 → 0.0.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/dist/{chunk-S65R2BUY.js → chunk-6FOWUXQ2.js} +12 -1
- package/dist/{chunk-YS57RXAX.js → chunk-WHIPWT4H.js} +2 -4
- package/dist/options-7235df55.d.ts +14 -0
- package/dist/prosekit-lit-elements-menu-item.d.ts +16 -0
- package/dist/prosekit-lit-elements-menu-item.js +1 -1
- package/dist/prosekit-lit-elements-menu.d.ts +50 -0
- package/dist/prosekit-lit-elements-menu.js +1 -1
- package/dist/prosekit-lit-elements-popover-suggestion.d.ts +59 -0
- package/dist/prosekit-lit-elements-popover-suggestion.js +3 -3
- package/dist/prosekit-lit-elements-popover.d.ts +65 -0
- package/dist/prosekit-lit-elements-popover.js +2 -2
- package/dist/prosekit-lit.d.ts +2 -0
- package/package.json +14 -14
- package/dist/chunk-5VENWR7M.js +0 -118
- package/dist/chunk-6EHMW3VI.js +0 -19
- package/dist/chunk-CFFBSSAU.js +0 -121
- package/dist/chunk-EZ4YICBQ.js +0 -108
- package/dist/chunk-JFOZX34E.js +0 -109
- package/dist/chunk-NMFTOM6J.js +0 -189
- package/dist/chunk-TFM6CTEO.js +0 -9
- package/dist/chunk-VYMBIH4T.js +0 -120
- package/dist/chunk-WUZ77NLF.js +0 -108
- package/dist/chunk-XEV4EE3R.js +0 -13
- package/dist/chunk-Y34HGIIF.js +0 -20
- package/dist/prosekit-lit-elements-picker.js +0 -11
- package/dist/prosekit-lit-elements-popover-slash.js +0 -211
- package/dist/prosekit-lit-elements-popover-suggestion-consumer.js +0 -36
- package/dist/prosekit-lit-elements-popover2.js +0 -119
- package/dist/prosekit-lit-elements-slash-popover.js +0 -213
@@ -10,6 +10,17 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
10
10
|
return result;
|
11
11
|
};
|
12
12
|
|
13
|
+
// src/styles/block-component.styles.ts
|
14
|
+
import { css as css2 } from "lit";
|
15
|
+
|
16
|
+
// src/styles/component.styles.ts
|
17
|
+
import { css } from "lit";
|
18
|
+
var componentStyles = css`:host{box-sizing:border-box}:host *,:host ::after,:host ::before{box-sizing:inherit}`;
|
19
|
+
|
20
|
+
// src/styles/block-component.styles.ts
|
21
|
+
var blockComponentStyles = css2`${componentStyles}:host{display:block}`;
|
22
|
+
|
13
23
|
export {
|
14
|
-
__decorateClass
|
24
|
+
__decorateClass,
|
25
|
+
blockComponentStyles
|
15
26
|
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { ComputePositionConfig } from '@floating-ui/dom';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* The `PopoverOptions` interface defines the options that can be passed to the
|
5
|
+
* `computePosition` function from Floating UI. These options are used to
|
6
|
+
* configure the positioning of the popover element relative to its reference
|
7
|
+
* element. For more information on the available options, please refer to the
|
8
|
+
* Floating UI documentation.
|
9
|
+
*
|
10
|
+
* https://floating-ui.com/docs/computeposition#options
|
11
|
+
*/
|
12
|
+
type PopoverOptions = ComputePositionConfig;
|
13
|
+
|
14
|
+
export { PopoverOptions as P };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import * as lit from 'lit';
|
2
|
+
import { LitElement, CSSResultGroup } from 'lit';
|
3
|
+
|
4
|
+
declare class MenuItem extends LitElement {
|
5
|
+
/** @hidden */
|
6
|
+
constructor();
|
7
|
+
/** @hidden */
|
8
|
+
static styles: CSSResultGroup;
|
9
|
+
focused: boolean;
|
10
|
+
hidden: boolean;
|
11
|
+
onSelect?: VoidFunction;
|
12
|
+
/** @hidden */
|
13
|
+
render(): lit.TemplateResult<1>;
|
14
|
+
}
|
15
|
+
|
16
|
+
export { MenuItem };
|
@@ -0,0 +1,50 @@
|
|
1
|
+
import * as lit from 'lit';
|
2
|
+
import { LitElement, CSSResultGroup, PropertyValueMap } from 'lit';
|
3
|
+
import { Editor } from '@prosekit/core';
|
4
|
+
import { MenuItem } from './prosekit-lit-elements-menu-item.js';
|
5
|
+
|
6
|
+
declare class Menu extends LitElement {
|
7
|
+
/** @hidden */
|
8
|
+
constructor();
|
9
|
+
/** @hidden */
|
10
|
+
static styles: CSSResultGroup;
|
11
|
+
editor?: Editor;
|
12
|
+
/** @hidden */
|
13
|
+
focusedItem?: MenuItem;
|
14
|
+
/** @hidden */
|
15
|
+
defaultSlot?: HTMLSlotElement;
|
16
|
+
/** @hidden */
|
17
|
+
private cleanup;
|
18
|
+
/** @hidden */
|
19
|
+
protected firstUpdated(): void;
|
20
|
+
protected updated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
21
|
+
/** @hidden */
|
22
|
+
disconnectedCallback(): void;
|
23
|
+
ensureFocusedItem(): void;
|
24
|
+
/** @hidden */
|
25
|
+
private handleArrowUp;
|
26
|
+
/** @hidden */
|
27
|
+
private handleArrowDown;
|
28
|
+
/** @hidden */
|
29
|
+
private handleEscape;
|
30
|
+
/** @hidden */
|
31
|
+
private handleMouseOver;
|
32
|
+
/** @hidden */
|
33
|
+
private handleEnter;
|
34
|
+
/** @hidden */
|
35
|
+
private handleClick;
|
36
|
+
/** @hidden */
|
37
|
+
private handleSelect;
|
38
|
+
/** @hidden */
|
39
|
+
private focusItem;
|
40
|
+
/** @hidden */
|
41
|
+
private blurItem;
|
42
|
+
/** @hidden */
|
43
|
+
private queryAllMenuItems;
|
44
|
+
/** @hidden */
|
45
|
+
private queryVisibleMenuItems;
|
46
|
+
/** @hidden */
|
47
|
+
render(): lit.TemplateResult<1>;
|
48
|
+
}
|
49
|
+
|
50
|
+
export { Menu };
|
@@ -0,0 +1,59 @@
|
|
1
|
+
import { P as PopoverOptions } from './options-7235df55.js';
|
2
|
+
import * as lit from 'lit';
|
3
|
+
import { ReactiveController, ReactiveControllerHost, LitElement, CSSResultGroup } from 'lit';
|
4
|
+
import { Editor } from '@prosekit/core';
|
5
|
+
import { PredictionRule } from '@prosekit/extensions/suggestion';
|
6
|
+
export { PredictionRule } from '@prosekit/extensions/suggestion';
|
7
|
+
import '@floating-ui/dom';
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Default popover options.
|
11
|
+
*/
|
12
|
+
declare const defaultPopoverOptions: PopoverOptions;
|
13
|
+
|
14
|
+
interface PopoverSuggestionContext {
|
15
|
+
active: boolean;
|
16
|
+
query?: string;
|
17
|
+
onDismiss?: () => void;
|
18
|
+
onSubmit?: () => void;
|
19
|
+
}
|
20
|
+
|
21
|
+
declare class PopoverSuggestionController implements ReactiveController {
|
22
|
+
private host;
|
23
|
+
private editor;
|
24
|
+
private rules;
|
25
|
+
private onContext?;
|
26
|
+
private connected;
|
27
|
+
reference: Element | null;
|
28
|
+
private removeExtension;
|
29
|
+
constructor(host: ReactiveControllerHost, editor: Editor, rules: PredictionRule[], onContext?: ((context: PopoverSuggestionContext) => void) | undefined);
|
30
|
+
hostUpdated(): void;
|
31
|
+
hostDisconnected(): void;
|
32
|
+
}
|
33
|
+
|
34
|
+
declare class PopoverSuggestion extends LitElement {
|
35
|
+
/** @hidden */
|
36
|
+
constructor();
|
37
|
+
editor: Editor;
|
38
|
+
popoverOptions: PopoverOptions;
|
39
|
+
rules: PredictionRule[];
|
40
|
+
/** @hidden */
|
41
|
+
context: PopoverSuggestionContext;
|
42
|
+
onContext?: (context: PopoverSuggestionContext) => void;
|
43
|
+
/** @hidden */
|
44
|
+
controller?: PopoverSuggestionController;
|
45
|
+
/** @hidden */
|
46
|
+
defaultSlot?: HTMLSlotElement;
|
47
|
+
/** @hidden */
|
48
|
+
static styles: CSSResultGroup;
|
49
|
+
/** @hidden */
|
50
|
+
protected firstUpdated(): void;
|
51
|
+
/** @hidden */
|
52
|
+
protected get active(): boolean;
|
53
|
+
/** @hidden */
|
54
|
+
private queryMenu;
|
55
|
+
/** @hidden */
|
56
|
+
render(): lit.TemplateResult<1>;
|
57
|
+
}
|
58
|
+
|
59
|
+
export { PopoverSuggestion, PopoverSuggestionContext, defaultPopoverOptions };
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import "./chunk-
|
1
|
+
import "./chunk-WHIPWT4H.js";
|
2
2
|
import {
|
3
3
|
__decorateClass,
|
4
4
|
blockComponentStyles
|
5
|
-
} from "./chunk-
|
5
|
+
} from "./chunk-6FOWUXQ2.js";
|
6
6
|
|
7
7
|
// src/elements/popover-suggestion/options.ts
|
8
8
|
import {
|
@@ -64,7 +64,7 @@ function isMenu(element) {
|
|
64
64
|
|
65
65
|
// src/elements/popover-suggestion/controller.ts
|
66
66
|
import { ProseKitError } from "@prosekit/core";
|
67
|
-
import { addSuggestion } from "@prosekit/
|
67
|
+
import { addSuggestion } from "@prosekit/extensions/suggestion";
|
68
68
|
var PopoverSuggestionController = class {
|
69
69
|
constructor(host, editor, rules, onContext) {
|
70
70
|
this.host = host;
|
@@ -0,0 +1,65 @@
|
|
1
|
+
import * as lit from 'lit';
|
2
|
+
import { LitElement, CSSResultGroup, PropertyValueMap } from 'lit';
|
3
|
+
import { VirtualElement, AutoUpdateOptions } from '@floating-ui/dom';
|
4
|
+
import { P as PopoverOptions } from './options-7235df55.js';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* A custom element that displays a popover anchored to a reference element.
|
8
|
+
*/
|
9
|
+
declare class Popover extends LitElement {
|
10
|
+
/** @hidden */
|
11
|
+
constructor();
|
12
|
+
/** @hidden */
|
13
|
+
static styles: CSSResultGroup;
|
14
|
+
/**
|
15
|
+
* Controls the visibility of the popover element. When set to `true`, the popover is displayed and positioned
|
16
|
+
* relative to its reference element. When set to `false`, the popover is hidden and its positioning logic is
|
17
|
+
* deactivated.
|
18
|
+
*/
|
19
|
+
active: boolean;
|
20
|
+
/** The floating element that displays the popover. */
|
21
|
+
floating: HTMLElement;
|
22
|
+
/**
|
23
|
+
* The element that the popover is anchored to. This can be either a DOM element or an object that implements the
|
24
|
+
* virtual element interface from Floating UI.
|
25
|
+
*/
|
26
|
+
reference?: Element | VirtualElement;
|
27
|
+
/**
|
28
|
+
* The options that are passed to the `computePosition` function from Floating UI. These options are used to
|
29
|
+
* configure the positioning of the popover element relative to its reference element. For more information on the
|
30
|
+
* available options, please refer to the Floating UI documentation.
|
31
|
+
*/
|
32
|
+
options?: PopoverOptions;
|
33
|
+
/**
|
34
|
+
* Controls whether the popover position is automatically updated when the reference element changes position. When
|
35
|
+
* set to `true`, the popover position is updated automatically. When set to `false`, the popover position is only
|
36
|
+
* updated when the given properties are changed.
|
37
|
+
*
|
38
|
+
* @default false
|
39
|
+
*/
|
40
|
+
autoUpdate: boolean;
|
41
|
+
/**
|
42
|
+
* The options that are passed to the `autoUpdate` function from Floating UI. These options are used to configure the
|
43
|
+
* automatic update behavior of the popover position. For more information on the available options, please refer to
|
44
|
+
* the Floating UI documentation. This property is only used when the `autoUpdate` property is set to `true`.
|
45
|
+
*/
|
46
|
+
autoUpdateOptions?: AutoUpdateOptions;
|
47
|
+
/** @hidden */
|
48
|
+
private computed?;
|
49
|
+
/** @hidden */
|
50
|
+
private cleanupAutoUpdate?;
|
51
|
+
/** @hidden */
|
52
|
+
disconnectedCallback(): void;
|
53
|
+
/** @hidden */
|
54
|
+
protected updated(changed: PropertyValueMap<any> | Map<PropertyKey, unknown>): void;
|
55
|
+
/** @hidden */
|
56
|
+
private start;
|
57
|
+
/** @hidden */
|
58
|
+
private compute;
|
59
|
+
/** @hidden */
|
60
|
+
private cleanup;
|
61
|
+
/** @hidden */
|
62
|
+
render(): lit.TemplateResult<1>;
|
63
|
+
}
|
64
|
+
|
65
|
+
export { Popover, PopoverOptions };
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@prosekit/lit",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.1",
|
5
5
|
"private": false,
|
6
6
|
"author": {
|
7
7
|
"name": "ocavue",
|
@@ -55,22 +55,22 @@
|
|
55
55
|
"dist"
|
56
56
|
],
|
57
57
|
"dependencies": {
|
58
|
-
"@floating-ui/dom": "^1.4.
|
59
|
-
"@lit/reactive-element": "^
|
60
|
-
"@prosekit/core": "0.0.
|
61
|
-
"@prosekit/
|
62
|
-
"@prosekit/pm": "0.0.
|
63
|
-
"lit": "^
|
64
|
-
"lit-element": "^
|
65
|
-
"lit-html": "^
|
58
|
+
"@floating-ui/dom": "^1.4.4",
|
59
|
+
"@lit/reactive-element": "^1.6.2",
|
60
|
+
"@prosekit/core": "^0.0.1",
|
61
|
+
"@prosekit/extensions": "^0.0.1",
|
62
|
+
"@prosekit/pm": "^0.0.1",
|
63
|
+
"lit": "^2.7.6",
|
64
|
+
"lit-element": "^3.3.2",
|
65
|
+
"lit-html": "^2.7.5"
|
66
66
|
},
|
67
67
|
"devDependencies": {
|
68
|
-
"
|
68
|
+
"@prosekit/dev": "^0.0.0",
|
69
|
+
"minify-literals": "^1.0.6",
|
69
70
|
"tsup": "^7.1.0",
|
70
|
-
"typescript": "^5.1.
|
71
|
-
"vitest": "^0.
|
72
|
-
"vue": "^3.3.4"
|
73
|
-
"@prosekit/dev": "0.0.0"
|
71
|
+
"typescript": "^5.1.6",
|
72
|
+
"vitest": "^0.33.0",
|
73
|
+
"vue": "^3.3.4"
|
74
74
|
},
|
75
75
|
"scripts": {
|
76
76
|
"build:tsup": "tsup",
|
package/dist/chunk-5VENWR7M.js
DELETED
@@ -1,118 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
__decorateClass,
|
3
|
-
blockComponentStyles
|
4
|
-
} from "./chunk-43BFWKM2.js";
|
5
|
-
|
6
|
-
// src/elements/popover.ts
|
7
|
-
import {
|
8
|
-
autoUpdate,
|
9
|
-
computePosition
|
10
|
-
} from "@floating-ui/dom";
|
11
|
-
import { LitElement, html } from "lit";
|
12
|
-
import { customElement, property, query, state } from "lit/decorators.js";
|
13
|
-
import { styleMap } from "lit/directives/style-map.js";
|
14
|
-
var Popover = class extends LitElement {
|
15
|
-
/** @hidden */
|
16
|
-
constructor() {
|
17
|
-
super();
|
18
|
-
this.active = false;
|
19
|
-
this.autoUpdate = false;
|
20
|
-
}
|
21
|
-
/** @hidden */
|
22
|
-
disconnectedCallback() {
|
23
|
-
this.cleanup();
|
24
|
-
}
|
25
|
-
/** @hidden */
|
26
|
-
updated(changed) {
|
27
|
-
if (!changed.has("computed")) {
|
28
|
-
this.start();
|
29
|
-
}
|
30
|
-
}
|
31
|
-
/** @hidden */
|
32
|
-
start() {
|
33
|
-
this.cleanup();
|
34
|
-
const reference = this.reference;
|
35
|
-
const floating = this.floating;
|
36
|
-
if (!reference)
|
37
|
-
return;
|
38
|
-
if (this.autoUpdate) {
|
39
|
-
this.cleanupAutoUpdate = autoUpdate(
|
40
|
-
reference,
|
41
|
-
floating,
|
42
|
-
() => void this.compute(),
|
43
|
-
this.autoUpdateOptions
|
44
|
-
);
|
45
|
-
} else {
|
46
|
-
void this.compute();
|
47
|
-
}
|
48
|
-
}
|
49
|
-
/** @hidden */
|
50
|
-
async compute() {
|
51
|
-
const reference = this.reference;
|
52
|
-
const floating = this.floating;
|
53
|
-
if (!reference)
|
54
|
-
return;
|
55
|
-
const options = this.options;
|
56
|
-
this.computed = await computePosition(reference, floating, options);
|
57
|
-
}
|
58
|
-
/** @hidden */
|
59
|
-
cleanup() {
|
60
|
-
var _a;
|
61
|
-
(_a = this.cleanupAutoUpdate) == null ? void 0 : _a.call(this);
|
62
|
-
this.cleanupAutoUpdate = void 0;
|
63
|
-
}
|
64
|
-
/** @hidden */
|
65
|
-
render() {
|
66
|
-
var _a;
|
67
|
-
const { x, y, strategy } = (_a = this.computed) != null ? _a : {
|
68
|
-
x: 0,
|
69
|
-
y: 0,
|
70
|
-
strategy: "absolute"
|
71
|
-
};
|
72
|
-
const style = {
|
73
|
-
top: "0",
|
74
|
-
left: "0",
|
75
|
-
position: strategy,
|
76
|
-
transform: `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`,
|
77
|
-
display: this.active ? void 0 : "none"
|
78
|
-
};
|
79
|
-
return html`<div class="floating" style="${styleMap(style)}"><slot></slot></div>`;
|
80
|
-
}
|
81
|
-
};
|
82
|
-
/** @hidden */
|
83
|
-
Popover.styles = blockComponentStyles;
|
84
|
-
__decorateClass([
|
85
|
-
property({ type: Boolean, reflect: true })
|
86
|
-
], Popover.prototype, "active", 2);
|
87
|
-
__decorateClass([
|
88
|
-
query(".floating")
|
89
|
-
], Popover.prototype, "floating", 2);
|
90
|
-
__decorateClass([
|
91
|
-
property()
|
92
|
-
], Popover.prototype, "reference", 2);
|
93
|
-
__decorateClass([
|
94
|
-
property()
|
95
|
-
], Popover.prototype, "options", 2);
|
96
|
-
__decorateClass([
|
97
|
-
property({
|
98
|
-
type: Boolean,
|
99
|
-
reflect: true
|
100
|
-
})
|
101
|
-
], Popover.prototype, "autoUpdate", 2);
|
102
|
-
__decorateClass([
|
103
|
-
property({ type: Object })
|
104
|
-
], Popover.prototype, "autoUpdateOptions", 2);
|
105
|
-
__decorateClass([
|
106
|
-
state()
|
107
|
-
], Popover.prototype, "computed", 2);
|
108
|
-
Popover = __decorateClass([
|
109
|
-
customElement("prosekit-popover")
|
110
|
-
], Popover);
|
111
|
-
function roundByDPR(value) {
|
112
|
-
const dpr = window.devicePixelRatio || 1;
|
113
|
-
return Math.round(value * dpr) / dpr;
|
114
|
-
}
|
115
|
-
|
116
|
-
export {
|
117
|
-
Popover
|
118
|
-
};
|
package/dist/chunk-6EHMW3VI.js
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
// src/utils/visibility.ts
|
2
|
-
function isVisibleElement(element) {
|
3
|
-
return !element.hidden;
|
4
|
-
}
|
5
|
-
function isHiddenElement(element) {
|
6
|
-
return element.hidden;
|
7
|
-
}
|
8
|
-
function createVisibilityFilter(visible) {
|
9
|
-
if (visible === true)
|
10
|
-
return isVisibleElement;
|
11
|
-
if (visible === false)
|
12
|
-
return isHiddenElement;
|
13
|
-
return () => true;
|
14
|
-
}
|
15
|
-
|
16
|
-
export {
|
17
|
-
isVisibleElement,
|
18
|
-
createVisibilityFilter
|
19
|
-
};
|
package/dist/chunk-CFFBSSAU.js
DELETED
@@ -1,121 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
__decorateClass,
|
3
|
-
blockComponentStyles
|
4
|
-
} from "./chunk-43BFWKM2.js";
|
5
|
-
|
6
|
-
// src/elements/popover.ts
|
7
|
-
import {
|
8
|
-
autoUpdate,
|
9
|
-
computePosition
|
10
|
-
} from "@floating-ui/dom";
|
11
|
-
import { LitElement, html } from "lit";
|
12
|
-
import { customElement, property, query, state } from "lit/decorators.js";
|
13
|
-
import { styleMap } from "lit/directives/style-map.js";
|
14
|
-
var Popover = class extends LitElement {
|
15
|
-
constructor() {
|
16
|
-
super(...arguments);
|
17
|
-
this.active = false;
|
18
|
-
this.autoUpdate = false;
|
19
|
-
}
|
20
|
-
/** @hidden */
|
21
|
-
disconnectedCallback() {
|
22
|
-
this.cleanup();
|
23
|
-
}
|
24
|
-
/** @hidden */
|
25
|
-
updated(changed) {
|
26
|
-
if (!changed.has("computed")) {
|
27
|
-
this.start();
|
28
|
-
}
|
29
|
-
}
|
30
|
-
/** @hidden */
|
31
|
-
start() {
|
32
|
-
this.cleanup();
|
33
|
-
const reference = this.reference;
|
34
|
-
const floating = this.floating;
|
35
|
-
if (!reference)
|
36
|
-
return;
|
37
|
-
if (this.autoUpdate) {
|
38
|
-
this.cleanupAutoUpdate = autoUpdate(
|
39
|
-
reference,
|
40
|
-
floating,
|
41
|
-
() => void this.compute(),
|
42
|
-
this.autoUpdateOptions
|
43
|
-
);
|
44
|
-
} else {
|
45
|
-
void this.compute();
|
46
|
-
}
|
47
|
-
}
|
48
|
-
/** @hidden */
|
49
|
-
async compute() {
|
50
|
-
const reference = this.reference;
|
51
|
-
const floating = this.floating;
|
52
|
-
if (!reference)
|
53
|
-
return;
|
54
|
-
const options = this.options;
|
55
|
-
this.computed = await computePosition(reference, floating, options);
|
56
|
-
}
|
57
|
-
/** @hidden */
|
58
|
-
cleanup() {
|
59
|
-
var _a;
|
60
|
-
(_a = this.cleanupAutoUpdate) == null ? void 0 : _a.call(this);
|
61
|
-
this.cleanupAutoUpdate = void 0;
|
62
|
-
}
|
63
|
-
/** @hidden */
|
64
|
-
render() {
|
65
|
-
var _a;
|
66
|
-
const { x, y, strategy } = (_a = this.computed) != null ? _a : {
|
67
|
-
x: 0,
|
68
|
-
y: 0,
|
69
|
-
strategy: "absolute"
|
70
|
-
};
|
71
|
-
const style = {
|
72
|
-
top: "0",
|
73
|
-
left: "0",
|
74
|
-
position: strategy,
|
75
|
-
transform: `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`,
|
76
|
-
display: this.active ? void 0 : "none"
|
77
|
-
};
|
78
|
-
return html`<div class="floating" style="${styleMap(style)}"><slot></slot></div>`;
|
79
|
-
}
|
80
|
-
};
|
81
|
-
/** @hidden */
|
82
|
-
// private constructor(...args) {
|
83
|
-
// super(...args)
|
84
|
-
// }
|
85
|
-
/** @hidden */
|
86
|
-
Popover.styles = blockComponentStyles;
|
87
|
-
__decorateClass([
|
88
|
-
property({ type: Boolean, reflect: true })
|
89
|
-
], Popover.prototype, "active", 2);
|
90
|
-
__decorateClass([
|
91
|
-
query(".floating")
|
92
|
-
], Popover.prototype, "floating", 2);
|
93
|
-
__decorateClass([
|
94
|
-
property()
|
95
|
-
], Popover.prototype, "reference", 2);
|
96
|
-
__decorateClass([
|
97
|
-
property()
|
98
|
-
], Popover.prototype, "options", 2);
|
99
|
-
__decorateClass([
|
100
|
-
property({
|
101
|
-
type: Boolean,
|
102
|
-
reflect: true
|
103
|
-
})
|
104
|
-
], Popover.prototype, "autoUpdate", 2);
|
105
|
-
__decorateClass([
|
106
|
-
property({ type: Object })
|
107
|
-
], Popover.prototype, "autoUpdateOptions", 2);
|
108
|
-
__decorateClass([
|
109
|
-
state()
|
110
|
-
], Popover.prototype, "computed", 2);
|
111
|
-
Popover = __decorateClass([
|
112
|
-
customElement("prosekit-popover")
|
113
|
-
], Popover);
|
114
|
-
function roundByDPR(value) {
|
115
|
-
const dpr = window.devicePixelRatio || 1;
|
116
|
-
return Math.round(value * dpr) / dpr;
|
117
|
-
}
|
118
|
-
|
119
|
-
export {
|
120
|
-
Popover
|
121
|
-
};
|