@prosekit/lit 0.1.3 → 0.1.5

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.
@@ -1,62 +0,0 @@
1
- import {
2
- commandListContext
3
- } from "./chunk-6P3YKUWI.js";
4
- import {
5
- LightElement,
6
- __decorateClass
7
- } from "./chunk-O5JP3B34.js";
8
-
9
- // src/components/autocomplete-item/component.ts
10
- import { consume } from "@lit/context";
11
- import "lit";
12
- import { customElement, property, state } from "lit/decorators.js";
13
- var propNames = ["value", "onSelect"];
14
- var AutocompleteItem = class extends LightElement {
15
- constructor() {
16
- super(...arguments);
17
- this.value = "";
18
- this.selected = false;
19
- }
20
- get content() {
21
- const text = this.value || this.textContent || "";
22
- return text.trim().toLowerCase();
23
- }
24
- connectedCallback() {
25
- super.connectedCallback();
26
- this.role = "option";
27
- }
28
- willUpdate() {
29
- var _a, _b;
30
- const content = this.content;
31
- this.selected = content === ((_a = this.listContext) == null ? void 0 : _a.selectedValue);
32
- const score = ((_b = this.listContext) == null ? void 0 : _b.scores.get(content)) || 0;
33
- this.setHidden(score <= 0);
34
- }
35
- updated(changedProperties) {
36
- var _a;
37
- if (this.selected && changedProperties.has("selected") && !changedProperties.get("selected") && ((_a = this.listContext) == null ? void 0 : _a.selectedReason) === "keyboard") {
38
- this.scrollIntoView({ block: "nearest" });
39
- }
40
- }
41
- };
42
- __decorateClass([
43
- property({ type: String, reflect: true, attribute: "data-value" })
44
- ], AutocompleteItem.prototype, "value", 2);
45
- __decorateClass([
46
- property({ type: Boolean, reflect: true, attribute: "data-selected" })
47
- ], AutocompleteItem.prototype, "selected", 2);
48
- __decorateClass([
49
- property({ attribute: false })
50
- ], AutocompleteItem.prototype, "onSelect", 2);
51
- __decorateClass([
52
- consume({ context: commandListContext, subscribe: true }),
53
- state({})
54
- ], AutocompleteItem.prototype, "listContext", 2);
55
- AutocompleteItem = __decorateClass([
56
- customElement("prosekit-autocomplete-item")
57
- ], AutocompleteItem);
58
-
59
- export {
60
- propNames,
61
- AutocompleteItem
62
- };
@@ -1,31 +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/components/block-element/index.ts
14
- import { LitElement } from "lit";
15
- var LightElement = class extends LitElement {
16
- createRenderRoot() {
17
- return this;
18
- }
19
- setHidden(hidden) {
20
- if (this.hidden !== hidden) {
21
- this.hidden = hidden;
22
- const display = this.style.display;
23
- this.style.display = hidden ? "none" : display === "none" ? "" : display;
24
- }
25
- }
26
- };
27
-
28
- export {
29
- __decorateClass,
30
- LightElement
31
- };