@prosekit/lit 0.0.0-next-20230709090937 → 0.0.0-next-20231120040948

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/_tsup-dts-rollup.d.ts +456 -0
  2. package/dist/chunk-55G7TJI3.js +48 -0
  3. package/dist/chunk-6P3YKUWI.js +9 -0
  4. package/dist/chunk-7WLKD2U6.js +184 -0
  5. package/dist/chunk-C4MW43I4.js +9 -0
  6. package/dist/chunk-GWGDLLFN.js +61 -0
  7. package/dist/{chunk-43BFWKM2.js → chunk-O5JP3B34.js} +15 -10
  8. package/dist/chunk-PCXKL6TA.js +109 -0
  9. package/dist/chunk-XBNMYITV.js +191 -0
  10. package/dist/prosekit-lit-autocomplete-empty.d.ts +3 -0
  11. package/dist/prosekit-lit-autocomplete-empty.js +44 -0
  12. package/dist/prosekit-lit-autocomplete-item.d.ts +3 -0
  13. package/dist/prosekit-lit-autocomplete-item.js +10 -0
  14. package/dist/prosekit-lit-autocomplete-list.d.ts +3 -0
  15. package/dist/prosekit-lit-autocomplete-list.js +12 -0
  16. package/dist/prosekit-lit-autocomplete-popover.d.ts +4 -0
  17. package/dist/prosekit-lit-autocomplete-popover.js +252 -0
  18. package/dist/prosekit-lit-combo-box-input.d.ts +3 -0
  19. package/dist/prosekit-lit-combo-box-input.js +72 -0
  20. package/dist/prosekit-lit-combo-box-item.d.ts +3 -0
  21. package/dist/prosekit-lit-combo-box-item.js +10 -0
  22. package/dist/prosekit-lit-combo-box-list.d.ts +3 -0
  23. package/dist/prosekit-lit-combo-box-list.js +48 -0
  24. package/dist/prosekit-lit-combo-box.d.ts +3 -0
  25. package/dist/prosekit-lit-combo-box.js +110 -0
  26. package/dist/prosekit-lit-inline-popover.d.ts +4 -0
  27. package/dist/prosekit-lit-inline-popover.js +154 -0
  28. package/dist/prosekit-lit-popover.d.ts +5 -0
  29. package/dist/prosekit-lit-popover.js +9 -0
  30. package/dist/prosekit-lit.d.ts +1 -2
  31. package/package.json +85 -38
  32. package/src/index.ts +0 -4
  33. package/dist/chunk-6FOWUXQ2.js +0 -26
  34. package/dist/chunk-7C2I5DWH.js +0 -122
  35. package/dist/chunk-WHIPWT4H.js +0 -122
  36. package/dist/options-7235df55.d.ts +0 -14
  37. package/dist/prosekit-lit-elements-menu-item.d.ts +0 -16
  38. package/dist/prosekit-lit-elements-menu-item.js +0 -37
  39. package/dist/prosekit-lit-elements-menu.d.ts +0 -50
  40. package/dist/prosekit-lit-elements-menu.js +0 -169
  41. package/dist/prosekit-lit-elements-popover-suggestion.d.ts +0 -59
  42. package/dist/prosekit-lit-elements-popover-suggestion.js +0 -218
  43. package/dist/prosekit-lit-elements-popover.d.ts +0 -65
  44. package/dist/prosekit-lit-elements-popover.js +0 -7
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@prosekit/lit",
3
3
  "type": "module",
4
- "version": "0.0.0-next-20230709090937",
4
+ "version": "0.0.0-next-20231120040948",
5
5
  "private": false,
6
6
  "author": {
7
7
  "name": "ocavue",
@@ -30,47 +30,76 @@
30
30
  "import": "./dist/prosekit-lit.js",
31
31
  "default": "./dist/prosekit-lit.js"
32
32
  },
33
- "./elements/menu": {
34
- "types": "./dist/prosekit-lit-elements-menu.d.ts",
35
- "import": "./dist/prosekit-lit-elements-menu.js",
36
- "default": "./dist/prosekit-lit-elements-menu.js"
33
+ "./autocomplete-empty": {
34
+ "types": "./dist/prosekit-lit-autocomplete-empty.d.ts",
35
+ "import": "./dist/prosekit-lit-autocomplete-empty.js",
36
+ "default": "./dist/prosekit-lit-autocomplete-empty.js"
37
37
  },
38
- "./elements/menu-item": {
39
- "types": "./dist/prosekit-lit-elements-menu-item.d.ts",
40
- "import": "./dist/prosekit-lit-elements-menu-item.js",
41
- "default": "./dist/prosekit-lit-elements-menu-item.js"
38
+ "./autocomplete-item": {
39
+ "types": "./dist/prosekit-lit-autocomplete-item.d.ts",
40
+ "import": "./dist/prosekit-lit-autocomplete-item.js",
41
+ "default": "./dist/prosekit-lit-autocomplete-item.js"
42
42
  },
43
- "./elements/popover": {
44
- "types": "./dist/prosekit-lit-elements-popover.d.ts",
45
- "import": "./dist/prosekit-lit-elements-popover.js",
46
- "default": "./dist/prosekit-lit-elements-popover.js"
43
+ "./autocomplete-list": {
44
+ "types": "./dist/prosekit-lit-autocomplete-list.d.ts",
45
+ "import": "./dist/prosekit-lit-autocomplete-list.js",
46
+ "default": "./dist/prosekit-lit-autocomplete-list.js"
47
47
  },
48
- "./elements/popover-suggestion": {
49
- "types": "./dist/prosekit-lit-elements-popover-suggestion.d.ts",
50
- "import": "./dist/prosekit-lit-elements-popover-suggestion.js",
51
- "default": "./dist/prosekit-lit-elements-popover-suggestion.js"
48
+ "./autocomplete-popover": {
49
+ "types": "./dist/prosekit-lit-autocomplete-popover.d.ts",
50
+ "import": "./dist/prosekit-lit-autocomplete-popover.js",
51
+ "default": "./dist/prosekit-lit-autocomplete-popover.js"
52
+ },
53
+ "./combo-box": {
54
+ "types": "./dist/prosekit-lit-combo-box.d.ts",
55
+ "import": "./dist/prosekit-lit-combo-box.js",
56
+ "default": "./dist/prosekit-lit-combo-box.js"
57
+ },
58
+ "./combo-box-input": {
59
+ "types": "./dist/prosekit-lit-combo-box-input.d.ts",
60
+ "import": "./dist/prosekit-lit-combo-box-input.js",
61
+ "default": "./dist/prosekit-lit-combo-box-input.js"
62
+ },
63
+ "./combo-box-item": {
64
+ "types": "./dist/prosekit-lit-combo-box-item.d.ts",
65
+ "import": "./dist/prosekit-lit-combo-box-item.js",
66
+ "default": "./dist/prosekit-lit-combo-box-item.js"
67
+ },
68
+ "./combo-box-list": {
69
+ "types": "./dist/prosekit-lit-combo-box-list.d.ts",
70
+ "import": "./dist/prosekit-lit-combo-box-list.js",
71
+ "default": "./dist/prosekit-lit-combo-box-list.js"
72
+ },
73
+ "./inline-popover": {
74
+ "types": "./dist/prosekit-lit-inline-popover.d.ts",
75
+ "import": "./dist/prosekit-lit-inline-popover.js",
76
+ "default": "./dist/prosekit-lit-inline-popover.js"
77
+ },
78
+ "./popover": {
79
+ "types": "./dist/prosekit-lit-popover.d.ts",
80
+ "import": "./dist/prosekit-lit-popover.js",
81
+ "default": "./dist/prosekit-lit-popover.js"
52
82
  }
53
83
  },
54
84
  "files": [
55
85
  "dist"
56
86
  ],
57
87
  "dependencies": {
58
- "@floating-ui/dom": "^1.4.4",
59
- "@lit/reactive-element": "^1.6.2",
60
- "@prosekit/core": "0.0.0-next-20230709090937",
61
- "@prosekit/extensions": "0.0.0-next-20230709090937",
62
- "@prosekit/pm": "0.0.0-next-20230709090937",
63
- "lit": "^2.7.6",
64
- "lit-element": "^3.3.2",
65
- "lit-html": "^2.7.5"
88
+ "@floating-ui/dom": "^1.5.3",
89
+ "@lit/context": "^1.1.0",
90
+ "@prosekit/core": "0.0.0-next-20231120040948",
91
+ "@prosekit/extensions": "0.0.0-next-20231120040948",
92
+ "@prosekit/pm": "0.0.0-next-20231120040948",
93
+ "@superhuman/command-score": "^0.5.0",
94
+ "lit": "^3.1.0"
66
95
  },
67
96
  "devDependencies": {
68
97
  "@prosekit/dev": "*",
69
- "minify-literals": "^1.0.6",
70
- "tsup": "^7.1.0",
71
- "typescript": "^5.1.6",
72
- "vitest": "^0.33.0",
73
- "vue": "^3.3.4"
98
+ "minify-literals": "^1.0.7",
99
+ "tsup": "^8.0.0",
100
+ "typescript": "^5.2.2",
101
+ "vitest": "^0.34.6",
102
+ "vue": "^3.3.8"
74
103
  },
75
104
  "scripts": {
76
105
  "build:tsup": "tsup",
@@ -82,17 +111,35 @@
82
111
  ".": [
83
112
  "./dist/prosekit-lit.d.ts"
84
113
  ],
85
- "elements/menu": [
86
- "./dist/prosekit-lit-elements-menu.d.ts"
114
+ "autocomplete-empty": [
115
+ "./dist/prosekit-lit-autocomplete-empty.d.ts"
116
+ ],
117
+ "autocomplete-item": [
118
+ "./dist/prosekit-lit-autocomplete-item.d.ts"
119
+ ],
120
+ "autocomplete-list": [
121
+ "./dist/prosekit-lit-autocomplete-list.d.ts"
122
+ ],
123
+ "autocomplete-popover": [
124
+ "./dist/prosekit-lit-autocomplete-popover.d.ts"
125
+ ],
126
+ "combo-box": [
127
+ "./dist/prosekit-lit-combo-box.d.ts"
128
+ ],
129
+ "combo-box-input": [
130
+ "./dist/prosekit-lit-combo-box-input.d.ts"
131
+ ],
132
+ "combo-box-item": [
133
+ "./dist/prosekit-lit-combo-box-item.d.ts"
87
134
  ],
88
- "elements/menu-item": [
89
- "./dist/prosekit-lit-elements-menu-item.d.ts"
135
+ "combo-box-list": [
136
+ "./dist/prosekit-lit-combo-box-list.d.ts"
90
137
  ],
91
- "elements/popover": [
92
- "./dist/prosekit-lit-elements-popover.d.ts"
138
+ "inline-popover": [
139
+ "./dist/prosekit-lit-inline-popover.d.ts"
93
140
  ],
94
- "elements/popover-suggestion": [
95
- "./dist/prosekit-lit-elements-popover-suggestion.d.ts"
141
+ "popover": [
142
+ "./dist/prosekit-lit-popover.d.ts"
96
143
  ]
97
144
  }
98
145
  }
package/src/index.ts CHANGED
@@ -1,5 +1 @@
1
- /**
2
- * @module @prosekit/lit
3
- */
4
-
5
1
  export {}
@@ -1,26 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __decorateClass = (decorators, target, key, kind) => {
4
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
5
- for (var i = decorators.length - 1, decorator; i >= 0; i--)
6
- if (decorator = decorators[i])
7
- result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8
- if (kind && result)
9
- __defProp(target, key, result);
10
- return result;
11
- };
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
-
23
- export {
24
- __decorateClass,
25
- blockComponentStyles
26
- };
@@ -1,122 +0,0 @@
1
- import {
2
- __decorateClass,
3
- blockComponentStyles
4
- } from "./chunk-43BFWKM2.js";
5
-
6
- // src/elements/popover/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
-
15
- // src/utils/round-by-dpr.ts
16
- function roundByDPR(value) {
17
- const dpr = window.devicePixelRatio || 1;
18
- return Math.round(value * dpr) / dpr;
19
- }
20
-
21
- // src/elements/popover/popover.ts
22
- var Popover = class extends LitElement {
23
- /** @hidden */
24
- constructor() {
25
- super();
26
- this.active = false;
27
- this.autoUpdate = false;
28
- }
29
- /** @hidden */
30
- disconnectedCallback() {
31
- this.cleanup();
32
- }
33
- /** @hidden */
34
- updated(changed) {
35
- if (!changed.has("computed")) {
36
- this.start();
37
- }
38
- }
39
- /** @hidden */
40
- start() {
41
- this.cleanup();
42
- const reference = this.reference;
43
- const floating = this.floating;
44
- if (!reference)
45
- return;
46
- if (this.autoUpdate) {
47
- this.cleanupAutoUpdate = autoUpdate(
48
- reference,
49
- floating,
50
- () => void this.compute(),
51
- this.autoUpdateOptions
52
- );
53
- } else {
54
- void this.compute();
55
- }
56
- }
57
- /** @hidden */
58
- async compute() {
59
- const reference = this.reference;
60
- const floating = this.floating;
61
- if (!reference)
62
- return;
63
- const options = this.options;
64
- this.computed = await computePosition(reference, floating, options);
65
- }
66
- /** @hidden */
67
- cleanup() {
68
- var _a;
69
- (_a = this.cleanupAutoUpdate) == null ? void 0 : _a.call(this);
70
- this.cleanupAutoUpdate = void 0;
71
- }
72
- /** @hidden */
73
- render() {
74
- var _a;
75
- const { x, y, strategy } = (_a = this.computed) != null ? _a : {
76
- x: 0,
77
- y: 0,
78
- strategy: "absolute"
79
- };
80
- const style = {
81
- top: "0",
82
- left: "0",
83
- position: strategy,
84
- transform: `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`,
85
- display: this.active ? void 0 : "none"
86
- };
87
- return html`<div class="floating" style="${styleMap(style)}"><slot></slot></div>`;
88
- }
89
- };
90
- /** @hidden */
91
- Popover.styles = blockComponentStyles;
92
- __decorateClass([
93
- property({ type: Boolean, reflect: true })
94
- ], Popover.prototype, "active", 2);
95
- __decorateClass([
96
- query(".floating")
97
- ], Popover.prototype, "floating", 2);
98
- __decorateClass([
99
- property()
100
- ], Popover.prototype, "reference", 2);
101
- __decorateClass([
102
- property()
103
- ], Popover.prototype, "options", 2);
104
- __decorateClass([
105
- property({
106
- type: Boolean,
107
- reflect: true
108
- })
109
- ], Popover.prototype, "autoUpdate", 2);
110
- __decorateClass([
111
- property({ type: Object })
112
- ], Popover.prototype, "autoUpdateOptions", 2);
113
- __decorateClass([
114
- state()
115
- ], Popover.prototype, "computed", 2);
116
- Popover = __decorateClass([
117
- customElement("prosekit-popover")
118
- ], Popover);
119
-
120
- export {
121
- Popover
122
- };
@@ -1,122 +0,0 @@
1
- import {
2
- __decorateClass,
3
- blockComponentStyles
4
- } from "./chunk-6FOWUXQ2.js";
5
-
6
- // src/elements/popover/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
-
15
- // src/utils/round-by-dpr.ts
16
- function roundByDPR(value) {
17
- const dpr = window.devicePixelRatio || 1;
18
- return Math.round(value * dpr) / dpr;
19
- }
20
-
21
- // src/elements/popover/popover.ts
22
- var Popover = class extends LitElement {
23
- /** @hidden */
24
- constructor() {
25
- super();
26
- this.active = false;
27
- this.autoUpdate = false;
28
- }
29
- /** @hidden */
30
- disconnectedCallback() {
31
- this.cleanup();
32
- }
33
- /** @hidden */
34
- updated(changed) {
35
- if (!changed.has("computed")) {
36
- this.start();
37
- }
38
- }
39
- /** @hidden */
40
- start() {
41
- this.cleanup();
42
- const reference = this.reference;
43
- const floating = this.floating;
44
- if (!reference)
45
- return;
46
- if (this.autoUpdate) {
47
- this.cleanupAutoUpdate = autoUpdate(
48
- reference,
49
- floating,
50
- () => void this.compute(),
51
- this.autoUpdateOptions
52
- );
53
- } else {
54
- void this.compute();
55
- }
56
- }
57
- /** @hidden */
58
- async compute() {
59
- const reference = this.reference;
60
- const floating = this.floating;
61
- if (!reference)
62
- return;
63
- const options = this.options;
64
- this.computed = await computePosition(reference, floating, options);
65
- }
66
- /** @hidden */
67
- cleanup() {
68
- var _a;
69
- (_a = this.cleanupAutoUpdate) == null ? void 0 : _a.call(this);
70
- this.cleanupAutoUpdate = void 0;
71
- }
72
- /** @hidden */
73
- render() {
74
- var _a;
75
- const { x, y, strategy } = (_a = this.computed) != null ? _a : {
76
- x: 0,
77
- y: 0,
78
- strategy: "absolute"
79
- };
80
- const style = {
81
- top: "0",
82
- left: "0",
83
- position: strategy,
84
- transform: `translate(${roundByDPR(x)}px,${roundByDPR(y)}px)`,
85
- display: this.active ? void 0 : "none"
86
- };
87
- return html`<div class="floating" style="${styleMap(style)}"><slot></slot></div>`;
88
- }
89
- };
90
- /** @hidden */
91
- Popover.styles = blockComponentStyles;
92
- __decorateClass([
93
- property({ type: Boolean, reflect: true })
94
- ], Popover.prototype, "active", 2);
95
- __decorateClass([
96
- query(".floating")
97
- ], Popover.prototype, "floating", 2);
98
- __decorateClass([
99
- property()
100
- ], Popover.prototype, "reference", 2);
101
- __decorateClass([
102
- property()
103
- ], Popover.prototype, "options", 2);
104
- __decorateClass([
105
- property({
106
- type: Boolean,
107
- reflect: true
108
- })
109
- ], Popover.prototype, "autoUpdate", 2);
110
- __decorateClass([
111
- property({ type: Object })
112
- ], Popover.prototype, "autoUpdateOptions", 2);
113
- __decorateClass([
114
- state()
115
- ], Popover.prototype, "computed", 2);
116
- Popover = __decorateClass([
117
- customElement("prosekit-popover")
118
- ], Popover);
119
-
120
- export {
121
- Popover
122
- };
@@ -1,14 +0,0 @@
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 };
@@ -1,16 +0,0 @@
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 };
@@ -1,37 +0,0 @@
1
- import {
2
- __decorateClass,
3
- blockComponentStyles
4
- } from "./chunk-6FOWUXQ2.js";
5
-
6
- // src/elements/menu-item.ts
7
- import { LitElement, html } from "lit";
8
- import { customElement, property } from "lit/decorators.js";
9
- var MenuItem = class extends LitElement {
10
- /** @hidden */
11
- constructor() {
12
- super();
13
- this.focused = false;
14
- this.hidden = false;
15
- }
16
- /** @hidden */
17
- render() {
18
- return html`<div role="menuitem"><slot></slot></div>`;
19
- }
20
- };
21
- /** @hidden */
22
- MenuItem.styles = blockComponentStyles;
23
- __decorateClass([
24
- property({ type: Boolean, reflect: true, attribute: "data-focused" })
25
- ], MenuItem.prototype, "focused", 2);
26
- __decorateClass([
27
- property({ type: Boolean, reflect: true, attribute: "data-hidden" })
28
- ], MenuItem.prototype, "hidden", 2);
29
- __decorateClass([
30
- property({ attribute: false })
31
- ], MenuItem.prototype, "onSelect", 2);
32
- MenuItem = __decorateClass([
33
- customElement("prosekit-menu-item")
34
- ], MenuItem);
35
- export {
36
- MenuItem
37
- };
@@ -1,50 +0,0 @@
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 };