@octax-app/hot-date-react 0.0.7 → 0.0.8
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.
|
@@ -78,7 +78,7 @@ function y(e) {
|
|
|
78
78
|
return /^\d+$/.test(t) ? Number(t) : l[t] ?? null;
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
|
-
//#region node_modules
|
|
81
|
+
//#region node_modules/@js-temporal/polyfill/dist/index.esm.js
|
|
82
82
|
var b = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
83
83
|
(function(n, r) {
|
|
84
84
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n ||= self, n.JSBI = r());
|
|
@@ -8805,6 +8805,7 @@ var Gc = class extends HTMLElement {
|
|
|
8805
8805
|
parser = new Pc();
|
|
8806
8806
|
internals;
|
|
8807
8807
|
styleObserver = null;
|
|
8808
|
+
fieldElement;
|
|
8808
8809
|
inputElement;
|
|
8809
8810
|
ghostElement;
|
|
8810
8811
|
ghostTypedElement;
|
|
@@ -8822,12 +8823,15 @@ var Gc = class extends HTMLElement {
|
|
|
8822
8823
|
super(), this.attachShadow({ mode: "open" }), this.shadowRoot?.append(Wc().content.cloneNode(!0));
|
|
8823
8824
|
let e = this.shadowRoot;
|
|
8824
8825
|
if (!e) throw Error("Unable to create shadow root.");
|
|
8825
|
-
this.inputElement = e.querySelector("input") ?? document.createElement("input"), this.ghostElement = e.querySelector(".ghost") ?? document.createElement("div"), this.ghostTypedElement = e.querySelector(".ghost-typed") ?? document.createElement("span"), this.ghostTailElement = e.querySelector(".ghost-tail") ?? document.createElement("span"), this.ghostHintElement = e.querySelector(".ghost-hint") ?? document.createElement("kbd"), this.ghostResolutionElement = e.querySelector(".ghost-resolution") ?? document.createElement("span"), this.ambiguityElement = document.createElement("div"), this.ambiguityElement.setAttribute("slot", "ambiguity"), this.ambiguityElement.hidden = !0, this.internals = typeof this.attachInternals == "function" ? this.attachInternals() : null, this.bindEvents();
|
|
8826
|
+
this.fieldElement = e.querySelector(".field") ?? document.createElement("div"), this.inputElement = e.querySelector("input") ?? document.createElement("input"), this.ghostElement = e.querySelector(".ghost") ?? document.createElement("div"), this.ghostTypedElement = e.querySelector(".ghost-typed") ?? document.createElement("span"), this.ghostTailElement = e.querySelector(".ghost-tail") ?? document.createElement("span"), this.ghostHintElement = e.querySelector(".ghost-hint") ?? document.createElement("kbd"), this.ghostResolutionElement = e.querySelector(".ghost-resolution") ?? document.createElement("span"), this.ambiguityElement = document.createElement("div"), this.ambiguityElement.setAttribute("slot", "ambiguity"), this.ambiguityElement.hidden = !0, this.internals = typeof this.attachInternals == "function" ? this.attachInternals() : null, this.bindEvents();
|
|
8826
8827
|
}
|
|
8827
8828
|
connectedCallback() {
|
|
8828
8829
|
this.ambiguityElement.parentNode !== this && this.append(this.ambiguityElement), this.updateStyles(), this.syncExternalStyles(), this.updateHintVisibility(), this.syncInputPresentation(), this.parseAndRender(), this.styleObserver || (this.styleObserver = new MutationObserver(() => this.syncExternalStyles()), this.styleObserver.observe(document.head, {
|
|
8829
8830
|
childList: !0,
|
|
8830
8831
|
subtree: !0
|
|
8832
|
+
}), this.styleObserver.observe(document.documentElement, {
|
|
8833
|
+
attributes: !0,
|
|
8834
|
+
attributeFilter: ["class"]
|
|
8831
8835
|
}));
|
|
8832
8836
|
}
|
|
8833
8837
|
disconnectedCallback() {
|
|
@@ -8976,26 +8980,28 @@ var Gc = class extends HTMLElement {
|
|
|
8976
8980
|
}
|
|
8977
8981
|
syncExternalStyles() {
|
|
8978
8982
|
if (!this.shadowRoot) return;
|
|
8983
|
+
let e = Array.from(document.documentElement.classList);
|
|
8984
|
+
this.fieldElement.className = "field" + (e.length ? " " + e.join(" ") : "");
|
|
8979
8985
|
try {
|
|
8980
8986
|
document.adoptedStyleSheets.length > 0 && (this.shadowRoot.adoptedStyleSheets = [...document.adoptedStyleSheets]);
|
|
8981
8987
|
} catch {}
|
|
8982
|
-
let
|
|
8983
|
-
document.querySelectorAll("link[rel=\"stylesheet\"]").forEach((
|
|
8984
|
-
if (!
|
|
8985
|
-
let
|
|
8986
|
-
|
|
8988
|
+
let t = new Set(Array.from(this.shadowRoot.querySelectorAll("link[data-ext]")).map((e) => e.href));
|
|
8989
|
+
document.querySelectorAll("link[rel=\"stylesheet\"]").forEach((e) => {
|
|
8990
|
+
if (!t.has(e.href)) {
|
|
8991
|
+
let t = document.createElement("link");
|
|
8992
|
+
t.rel = "stylesheet", t.href = e.href, t.dataset.ext = "", this.shadowRoot.append(t);
|
|
8987
8993
|
}
|
|
8988
8994
|
});
|
|
8989
|
-
let
|
|
8990
|
-
|
|
8991
|
-
let
|
|
8992
|
-
if (
|
|
8995
|
+
let n = Array.from(document.head.querySelectorAll("style")), r = Array.from(this.shadowRoot.querySelectorAll("style[data-ext-style]"));
|
|
8996
|
+
n.forEach((e, t) => {
|
|
8997
|
+
let n = e.textContent ?? "";
|
|
8998
|
+
if (r[t]) r[t].textContent !== n && (r[t].textContent = n);
|
|
8993
8999
|
else {
|
|
8994
9000
|
let e = document.createElement("style");
|
|
8995
|
-
e.dataset.extStyle = "", e.textContent =
|
|
9001
|
+
e.dataset.extStyle = "", e.textContent = n, this.shadowRoot.append(e);
|
|
8996
9002
|
}
|
|
8997
9003
|
});
|
|
8998
|
-
for (let e =
|
|
9004
|
+
for (let e = n.length; e < r.length; e++) r[e].remove();
|
|
8999
9005
|
requestAnimationFrame(() => {
|
|
9000
9006
|
let e = window.getComputedStyle(this.inputElement);
|
|
9001
9007
|
this.ghostElement.style.font = e.font;
|
package/dist/hot-date-react.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./hot-date-
|
|
1
|
+
import { t as e } from "./hot-date-DIgUxVss.js";
|
|
2
2
|
import { useEffect as t, useRef as n, useState as r } from "react";
|
|
3
3
|
import { jsx as i } from "react/jsx-runtime";
|
|
4
4
|
//#region src/react/format.ts
|
|
@@ -101,12 +101,12 @@ function p({ value: e, defaultValue: a, onChange: s, onCommit: c, onClear: l, on
|
|
|
101
101
|
let e = H.current, t = J.current;
|
|
102
102
|
if (!e || t == null) return;
|
|
103
103
|
let n = T ? o(t, T) ?? t : t;
|
|
104
|
-
e.value = n, W(!!n), n && (e.setAttribute("display-value", u(n)), e.forceDisplayMode(n));
|
|
104
|
+
e.value = n, W(!!n), n && (e.setAttribute("display-value", u(n)), e.forceDisplayMode?.(n));
|
|
105
105
|
}, []), t(() => {
|
|
106
106
|
let t = H.current;
|
|
107
107
|
if (!t || e === void 0) return;
|
|
108
108
|
let n = e ? T ? o(e, T) ?? e : e : null;
|
|
109
|
-
t.value = n, W(!!n), n ? (t.setAttribute("display-value", u(n)), G || t.forceDisplayMode(n)) : (t.removeAttribute("display-value"), G || t.forceDisplayMode(null));
|
|
109
|
+
t.value = n, W(!!n), n ? (t.setAttribute("display-value", u(n)), G || t.forceDisplayMode?.(n)) : (t.removeAttribute("display-value"), G || t.forceDisplayMode?.(null));
|
|
110
110
|
}, [
|
|
111
111
|
e,
|
|
112
112
|
T,
|
|
@@ -114,24 +114,24 @@ function p({ value: e, defaultValue: a, onChange: s, onCommit: c, onClear: l, on
|
|
|
114
114
|
]), t(() => {
|
|
115
115
|
let e = H.current;
|
|
116
116
|
if (!e) return;
|
|
117
|
-
let t = (e) => {
|
|
117
|
+
let t = e.shadowRoot?.querySelector("input") ?? null, n = (e) => {
|
|
118
118
|
let t = e.detail;
|
|
119
119
|
W(!!t.value), s?.(d(t.value, T));
|
|
120
|
-
},
|
|
120
|
+
}, r = (e) => {
|
|
121
121
|
let t = e.detail;
|
|
122
122
|
c?.(d(t.value, T));
|
|
123
|
-
},
|
|
123
|
+
}, i = () => {
|
|
124
124
|
W(!1), l?.();
|
|
125
|
-
}, i = (e) => {
|
|
126
|
-
K(!0), p?.(e);
|
|
127
125
|
}, a = (e) => {
|
|
126
|
+
K(!0), p?.(e);
|
|
127
|
+
}, o = (e) => {
|
|
128
128
|
K(!1), m?.(e);
|
|
129
|
-
},
|
|
129
|
+
}, u = (e) => h?.(e), f = (e) => g?.(e), E = (e) => {
|
|
130
130
|
let t = e.detail;
|
|
131
131
|
_?.(t.rawInput);
|
|
132
|
-
},
|
|
133
|
-
return e.addEventListener("value-change",
|
|
134
|
-
e.removeEventListener("value-change",
|
|
132
|
+
}, D = (e) => v?.(e), O = (e) => y?.(e), k = (e) => b?.(e), A = (e) => x?.(e), j = (e) => S?.(e), M = (e) => C?.(e), N = (e) => w?.(e);
|
|
133
|
+
return e.addEventListener("value-change", n), e.addEventListener("value-commit", r), e.addEventListener("clear", i), e.addEventListener("focusin", a), e.addEventListener("focusout", o), e.addEventListener("raw-input-change", E), e.addEventListener("click", O), e.addEventListener("mouseenter", k), e.addEventListener("mouseleave", A), e.addEventListener("mousedown", j), e.addEventListener("mouseup", M), e.addEventListener("mousemove", N), t?.addEventListener("keydown", u), t?.addEventListener("keyup", f), t?.addEventListener("paste", D), () => {
|
|
134
|
+
e.removeEventListener("value-change", n), e.removeEventListener("value-commit", r), e.removeEventListener("clear", i), e.removeEventListener("focusin", a), e.removeEventListener("focusout", o), e.removeEventListener("raw-input-change", E), e.removeEventListener("click", O), e.removeEventListener("mouseenter", k), e.removeEventListener("mouseleave", A), e.removeEventListener("mousedown", j), e.removeEventListener("mouseup", M), e.removeEventListener("mousemove", N), t?.removeEventListener("keydown", u), t?.removeEventListener("keyup", f), t?.removeEventListener("paste", D);
|
|
135
135
|
};
|
|
136
136
|
}, [
|
|
137
137
|
s,
|
package/dist/hot-date.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare class HotDateElement extends HTMLElement {
|
|
|
5
5
|
private readonly parser;
|
|
6
6
|
private readonly internals;
|
|
7
7
|
private styleObserver;
|
|
8
|
+
private readonly fieldElement;
|
|
8
9
|
private readonly inputElement;
|
|
9
10
|
private readonly ghostElement;
|
|
10
11
|
private readonly ghostTypedElement;
|
package/dist/hot-date.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./hot-date-
|
|
1
|
+
import { t as e } from "./hot-date-DIgUxVss.js";
|
|
2
2
|
export { e as HotDateElement };
|