typecomposer 0.1.26 → 0.1.27
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/core/app/Validate.d.ts +61 -0
- package/core/app/Validate.js +2 -0
- package/core/app/Validate.js.map +1 -0
- package/core/app/index.d.ts +39 -0
- package/core/app/index.js +174 -0
- package/core/app/index.js.map +1 -0
- package/core/components/AlertPanel.d.ts +31 -0
- package/core/components/AlertPanel.js +74 -0
- package/core/components/AlertPanel.js.map +1 -0
- package/core/components/AvatarPanel.d.ts +20 -0
- package/core/components/AvatarPanel.js +62 -0
- package/core/components/AvatarPanel.js.map +1 -0
- package/core/components/BorderPanel.d.ts +27 -0
- package/core/components/BorderPanel.js +89 -0
- package/core/components/BorderPanel.js.map +1 -0
- package/core/components/CardPanel.d.ts +4 -0
- package/core/components/CardPanel.js +10 -0
- package/core/components/CardPanel.js.map +1 -0
- package/core/components/CheckBox.d.ts +34 -0
- package/core/components/CheckBox.js +107 -0
- package/core/components/CheckBox.js.map +1 -0
- package/core/components/ColorPicker.d.ts +9 -0
- package/core/components/ColorPicker.js +32 -0
- package/core/components/ColorPicker.js.map +1 -0
- package/core/components/ContextMenu.d.ts +14 -0
- package/core/components/ContextMenu.js +62 -0
- package/core/components/ContextMenu.js.map +1 -0
- package/core/components/DialogPanel.d.ts +14 -0
- package/core/components/DialogPanel.js +62 -0
- package/core/components/DialogPanel.js.map +1 -0
- package/core/components/DropDown.d.ts +51 -0
- package/core/components/DropDown.js +213 -0
- package/core/components/DropDown.js.map +1 -0
- package/core/components/FlowPanel.d.ts +10 -0
- package/core/components/FlowPanel.js +39 -0
- package/core/components/FlowPanel.js.map +1 -0
- package/core/components/ForEach.d.ts +10 -0
- package/core/components/ForEach.js +86 -0
- package/core/components/ForEach.js.map +1 -0
- package/core/components/GridPanel.d.ts +9 -0
- package/core/components/GridPanel.js +29 -0
- package/core/components/GridPanel.js.map +1 -0
- package/core/components/HBox.d.ts +4 -0
- package/core/components/HBox.js +9 -0
- package/core/components/HBox.js.map +1 -0
- package/core/components/LazyLoading.d.ts +18 -0
- package/core/components/LazyLoading.js +35 -0
- package/core/components/LazyLoading.js.map +1 -0
- package/core/components/ListPanel.d.ts +26 -0
- package/core/components/ListPanel.js +152 -0
- package/core/components/ListPanel.js.map +1 -0
- package/core/components/PopUpButton.d.ts +17 -0
- package/core/components/PopUpButton.js +54 -0
- package/core/components/PopUpButton.js.map +1 -0
- package/core/components/ScrollPanel.d.ts +13 -0
- package/core/components/ScrollPanel.js +34 -0
- package/core/components/ScrollPanel.js.map +1 -0
- package/core/components/StackPanel.d.ts +4 -0
- package/core/components/StackPanel.js +9 -0
- package/core/components/StackPanel.js.map +1 -0
- package/core/components/TabItem.d.ts +18 -0
- package/core/components/TabItem.js +81 -0
- package/core/components/TabItem.js.map +1 -0
- package/core/components/TabPanel.d.ts +24 -0
- package/core/components/TabPanel.js +95 -0
- package/core/components/TabPanel.js.map +1 -0
- package/core/components/TablePanel.d.ts +32 -0
- package/core/components/TablePanel.js +125 -0
- package/core/components/TablePanel.js.map +1 -0
- package/core/components/TextEdit.d.ts +31 -0
- package/core/components/TextEdit.js +172 -0
- package/core/components/TextEdit.js.map +1 -0
- package/core/components/TextField.d.ts +32 -0
- package/core/components/TextField.js +147 -0
- package/core/components/TextField.js.map +1 -0
- package/core/components/ToggleButton.d.ts +6 -0
- package/core/components/ToggleButton.js +19 -0
- package/core/components/ToggleButton.js.map +1 -0
- package/core/components/VBox.d.ts +4 -0
- package/core/components/VBox.js +9 -0
- package/core/components/VBox.js.map +1 -0
- package/core/components/VirtualScroll copy 2.d.ts +24 -0
- package/core/components/VirtualScroll copy 2.js +98 -0
- package/core/components/VirtualScroll copy 2.js.map +1 -0
- package/core/components/VirtualScroll.d.ts +19 -0
- package/core/components/VirtualScroll.js +46 -0
- package/core/components/VirtualScroll.js.map +1 -0
- package/core/components/index.d.ts +26 -0
- package/core/components/index.js +28 -0
- package/core/components/index.js.map +1 -0
- package/core/decorators/RegisterComponent.d.ts +8 -0
- package/core/decorators/RegisterComponent.js +5 -0
- package/core/decorators/RegisterComponent.js.map +1 -0
- package/core/decorators/StyleLink.d.ts +1 -0
- package/core/decorators/StyleLink.js +13 -0
- package/core/decorators/StyleLink.js.map +1 -0
- package/core/decorators/index.d.ts +4 -0
- package/core/decorators/index.js +6 -0
- package/core/decorators/index.js.map +1 -0
- package/core/element/AbbreviationElement.d.ts +6 -0
- package/core/element/AbbreviationElement.js +11 -0
- package/core/element/AbbreviationElement.js.map +1 -0
- package/core/element/AnchorElement.d.ts +23 -0
- package/core/element/AnchorElement.js +29 -0
- package/core/element/AnchorElement.js.map +1 -0
- package/core/element/AreaElement.d.ts +17 -0
- package/core/element/AreaElement.js +10 -0
- package/core/element/AreaElement.js.map +1 -0
- package/core/element/ArticleElement.d.ts +4 -0
- package/core/element/ArticleElement.js +11 -0
- package/core/element/ArticleElement.js.map +1 -0
- package/core/element/AudioElement.d.ts +11 -0
- package/core/element/AudioElement.js +9 -0
- package/core/element/AudioElement.js.map +1 -0
- package/core/element/BaseElement.d.ts +7 -0
- package/core/element/BaseElement.js +10 -0
- package/core/element/BaseElement.js.map +1 -0
- package/core/element/BodyElement.d.ts +4 -0
- package/core/element/BodyElement.js +10 -0
- package/core/element/BodyElement.js.map +1 -0
- package/core/element/BoldElement.d.ts +4 -0
- package/core/element/BoldElement.js +9 -0
- package/core/element/BoldElement.js.map +1 -0
- package/core/element/BreakElement.d.ts +4 -0
- package/core/element/BreakElement.js +9 -0
- package/core/element/BreakElement.js.map +1 -0
- package/core/element/ButtonElement.d.ts +25 -0
- package/core/element/ButtonElement.js +46 -0
- package/core/element/ButtonElement.js.map +1 -0
- package/core/element/CanvasElement.d.ts +4 -0
- package/core/element/CanvasElement.js +13 -0
- package/core/element/CanvasElement.js.map +1 -0
- package/core/element/CaptionElement.d.ts +4 -0
- package/core/element/CaptionElement.js +12 -0
- package/core/element/CaptionElement.js.map +1 -0
- package/core/element/CiteElement.d.ts +4 -0
- package/core/element/CiteElement.js +10 -0
- package/core/element/CiteElement.js.map +1 -0
- package/core/element/CodeElement.d.ts +6 -0
- package/core/element/CodeElement.js +12 -0
- package/core/element/CodeElement.js.map +1 -0
- package/core/element/DataListElement.d.ts +4 -0
- package/core/element/DataListElement.js +12 -0
- package/core/element/DataListElement.js.map +1 -0
- package/core/element/DefinitionDescriptionElement.d.ts +4 -0
- package/core/element/DefinitionDescriptionElement.js +12 -0
- package/core/element/DefinitionDescriptionElement.js.map +1 -0
- package/core/element/DefinitionElement.d.ts +4 -0
- package/core/element/DefinitionElement.js +12 -0
- package/core/element/DefinitionElement.js.map +1 -0
- package/core/element/DeletedTextElement.d.ts +6 -0
- package/core/element/DeletedTextElement.js +14 -0
- package/core/element/DeletedTextElement.js.map +1 -0
- package/core/element/DetailsElement.d.ts +8 -0
- package/core/element/DetailsElement.js +27 -0
- package/core/element/DetailsElement.js.map +1 -0
- package/core/element/DialogElement.d.ts +6 -0
- package/core/element/DialogElement.js +13 -0
- package/core/element/DialogElement.js.map +1 -0
- package/core/element/DivElement.d.ts +4 -0
- package/core/element/DivElement.js +9 -0
- package/core/element/DivElement.js.map +1 -0
- package/core/element/EmElement.d.ts +4 -0
- package/core/element/EmElement.js +9 -0
- package/core/element/EmElement.js.map +1 -0
- package/core/element/EmbedElement.d.ts +9 -0
- package/core/element/EmbedElement.js +18 -0
- package/core/element/EmbedElement.js.map +1 -0
- package/core/element/FieldSetElement.d.ts +8 -0
- package/core/element/FieldSetElement.js +33 -0
- package/core/element/FieldSetElement.js.map +1 -0
- package/core/element/FooterElement.d.ts +4 -0
- package/core/element/FooterElement.js +12 -0
- package/core/element/FooterElement.js.map +1 -0
- package/core/element/FormElement.d.ts +13 -0
- package/core/element/FormElement.js +9 -0
- package/core/element/FormElement.js.map +1 -0
- package/core/element/Fragment.d.ts +33 -0
- package/core/element/Fragment.js +146 -0
- package/core/element/Fragment.js.map +1 -0
- package/core/element/H1Element.d.ts +4 -0
- package/core/element/H1Element.js +9 -0
- package/core/element/H1Element.js.map +1 -0
- package/core/element/H2Element.d.ts +4 -0
- package/core/element/H2Element.js +9 -0
- package/core/element/H2Element.js.map +1 -0
- package/core/element/H3Element.d.ts +4 -0
- package/core/element/H3Element.js +9 -0
- package/core/element/H3Element.js.map +1 -0
- package/core/element/H4Element.d.ts +4 -0
- package/core/element/H4Element.js +9 -0
- package/core/element/H4Element.js.map +1 -0
- package/core/element/H5Element.d.ts +4 -0
- package/core/element/H5Element.js +9 -0
- package/core/element/H5Element.js.map +1 -0
- package/core/element/H6Element.d.ts +4 -0
- package/core/element/H6Element.js +9 -0
- package/core/element/H6Element.js.map +1 -0
- package/core/element/HeadElement.d.ts +4 -0
- package/core/element/HeadElement.js +10 -0
- package/core/element/HeadElement.js.map +1 -0
- package/core/element/HeaderElement.d.ts +4 -0
- package/core/element/HeaderElement.js +12 -0
- package/core/element/HeaderElement.js.map +1 -0
- package/core/element/HorizontalRuleElement.d.ts +4 -0
- package/core/element/HorizontalRuleElement.js +12 -0
- package/core/element/HorizontalRuleElement.js.map +1 -0
- package/core/element/HtmlElement.d.ts +8 -0
- package/core/element/HtmlElement.js +18 -0
- package/core/element/HtmlElement.js.map +1 -0
- package/core/element/IFrameElement.d.ts +27 -0
- package/core/element/IFrameElement.js +66 -0
- package/core/element/IFrameElement.js.map +1 -0
- package/core/element/ILayout.d.ts +4 -0
- package/core/element/ILayout.js +8 -0
- package/core/element/ILayout.js.map +1 -0
- package/core/element/IconElement.d.ts +13 -0
- package/core/element/IconElement.js +31 -0
- package/core/element/IconElement.js.map +1 -0
- package/core/element/ImageElement.d.ts +18 -0
- package/core/element/ImageElement.js +16 -0
- package/core/element/ImageElement.js.map +1 -0
- package/core/element/InputElement.d.ts +37 -0
- package/core/element/InputElement.js +81 -0
- package/core/element/InputElement.js.map +1 -0
- package/core/element/LabelElement.d.ts +7 -0
- package/core/element/LabelElement.js +9 -0
- package/core/element/LabelElement.js.map +1 -0
- package/core/element/LegendElement.d.ts +6 -0
- package/core/element/LegendElement.js +14 -0
- package/core/element/LegendElement.js.map +1 -0
- package/core/element/ListItemElement.d.ts +11 -0
- package/core/element/ListItemElement.js +27 -0
- package/core/element/ListItemElement.js.map +1 -0
- package/core/element/MainElement.d.ts +4 -0
- package/core/element/MainElement.js +9 -0
- package/core/element/MainElement.js.map +1 -0
- package/core/element/NavElement.d.ts +4 -0
- package/core/element/NavElement.js +9 -0
- package/core/element/NavElement.js.map +1 -0
- package/core/element/OrderedListElement.d.ts +4 -0
- package/core/element/OrderedListElement.js +9 -0
- package/core/element/OrderedListElement.js.map +1 -0
- package/core/element/ParagraphElement.d.ts +4 -0
- package/core/element/ParagraphElement.js +9 -0
- package/core/element/ParagraphElement.js.map +1 -0
- package/core/element/PreElement.d.ts +4 -0
- package/core/element/PreElement.js +9 -0
- package/core/element/PreElement.js.map +1 -0
- package/core/element/SectionElement.d.ts +4 -0
- package/core/element/SectionElement.js +11 -0
- package/core/element/SectionElement.js.map +1 -0
- package/core/element/SelectElement.d.ts +4 -0
- package/core/element/SelectElement.js +11 -0
- package/core/element/SelectElement.js.map +1 -0
- package/core/element/SourceElement.d.ts +7 -0
- package/core/element/SourceElement.js +13 -0
- package/core/element/SourceElement.js.map +1 -0
- package/core/element/SpanElement.d.ts +4 -0
- package/core/element/SpanElement.js +9 -0
- package/core/element/SpanElement.js.map +1 -0
- package/core/element/StrongElement.d.ts +4 -0
- package/core/element/StrongElement.js +11 -0
- package/core/element/StrongElement.js.map +1 -0
- package/core/element/StyleElement.d.ts +4 -0
- package/core/element/StyleElement.js +9 -0
- package/core/element/StyleElement.js.map +1 -0
- package/core/element/SummaryElement.d.ts +4 -0
- package/core/element/SummaryElement.js +11 -0
- package/core/element/SummaryElement.js.map +1 -0
- package/core/element/SvgElement.d.ts +17 -0
- package/core/element/SvgElement.js +149 -0
- package/core/element/SvgElement.js.map +1 -0
- package/core/element/TableBodyElement.d.ts +4 -0
- package/core/element/TableBodyElement.js +9 -0
- package/core/element/TableBodyElement.js.map +1 -0
- package/core/element/TableCellElement.d.ts +9 -0
- package/core/element/TableCellElement.js +24 -0
- package/core/element/TableCellElement.js.map +1 -0
- package/core/element/TableColElement.d.ts +6 -0
- package/core/element/TableColElement.js +12 -0
- package/core/element/TableColElement.js.map +1 -0
- package/core/element/TableColGroupElement.d.ts +6 -0
- package/core/element/TableColGroupElement.js +14 -0
- package/core/element/TableColGroupElement.js.map +1 -0
- package/core/element/TableElement.d.ts +44 -0
- package/core/element/TableElement.js +227 -0
- package/core/element/TableElement.js.map +1 -0
- package/core/element/TableFootElement.d.ts +4 -0
- package/core/element/TableFootElement.js +9 -0
- package/core/element/TableFootElement.js.map +1 -0
- package/core/element/TableFootRowElement.d.ts +8 -0
- package/core/element/TableFootRowElement.js +22 -0
- package/core/element/TableFootRowElement.js.map +1 -0
- package/core/element/TableHeadCellElement.d.ts +9 -0
- package/core/element/TableHeadCellElement.js +23 -0
- package/core/element/TableHeadCellElement.js.map +1 -0
- package/core/element/TableHeadElement.d.ts +4 -0
- package/core/element/TableHeadElement.js +9 -0
- package/core/element/TableHeadElement.js.map +1 -0
- package/core/element/TableHeadRowElement.d.ts +10 -0
- package/core/element/TableHeadRowElement.js +28 -0
- package/core/element/TableHeadRowElement.js.map +1 -0
- package/core/element/TableRowElement.d.ts +10 -0
- package/core/element/TableRowElement.js +28 -0
- package/core/element/TableRowElement.js.map +1 -0
- package/core/element/TextAreaElement.d.ts +6 -0
- package/core/element/TextAreaElement.js +9 -0
- package/core/element/TextAreaElement.js.map +1 -0
- package/core/element/UListElement.d.ts +4 -0
- package/core/element/UListElement.js +9 -0
- package/core/element/UListElement.js.map +1 -0
- package/core/element/VideoElement.d.ts +12 -0
- package/core/element/VideoElement.js +15 -0
- package/core/element/VideoElement.js.map +1 -0
- package/core/element/index.d.ts +71 -0
- package/core/element/index.js +72 -0
- package/core/element/index.js.map +1 -0
- package/core/event/index.d.ts +16 -0
- package/core/event/index.js +75 -0
- package/core/event/index.js.map +1 -0
- package/core/index.d.ts +9 -0
- package/core/index.js +10 -0
- package/core/index.js.map +1 -0
- package/core/ref/RefBoolean.d.ts +26 -0
- package/core/ref/RefBoolean.js +58 -0
- package/core/ref/RefBoolean.js.map +1 -0
- package/core/ref/RefContainer.d.ts +25 -0
- package/core/ref/RefContainer.js +105 -0
- package/core/ref/RefContainer.js.map +1 -0
- package/core/ref/RefList.d.ts +51 -0
- package/core/ref/RefList.js +155 -0
- package/core/ref/RefList.js.map +1 -0
- package/core/ref/RefMap.d.ts +25 -0
- package/core/ref/RefMap.js +71 -0
- package/core/ref/RefMap.js.map +1 -0
- package/core/ref/RefNumber.d.ts +30 -0
- package/core/ref/RefNumber.js +69 -0
- package/core/ref/RefNumber.js.map +1 -0
- package/core/ref/RefObject.d.ts +30 -0
- package/core/ref/RefObject.js +211 -0
- package/core/ref/RefObject.js.map +1 -0
- package/core/ref/RefProperty.d.ts +3 -0
- package/core/ref/RefProperty.js +46 -0
- package/core/ref/RefProperty.js.map +1 -0
- package/core/ref/RefSet.d.ts +25 -0
- package/core/ref/RefSet.js +72 -0
- package/core/ref/RefSet.js.map +1 -0
- package/core/ref/RefState.d.ts +23 -0
- package/core/ref/RefState.js +79 -0
- package/core/ref/RefState.js.map +1 -0
- package/core/ref/RefString.d.ts +75 -0
- package/core/ref/RefString.js +202 -0
- package/core/ref/RefString.js.map +1 -0
- package/core/ref/index.d.ts +21 -0
- package/core/ref/index.js +64 -0
- package/core/ref/index.js.map +1 -0
- package/core/router/RouteView.d.ts +19 -0
- package/core/router/RouteView.js +75 -0
- package/core/router/RouteView.js.map +1 -0
- package/core/router/Router.d.ts +70 -0
- package/core/router/Router.js +287 -0
- package/core/router/Router.js.map +1 -0
- package/core/router/RouterEvent.d.ts +36 -0
- package/core/router/RouterEvent.js +43 -0
- package/core/router/RouterEvent.js.map +1 -0
- package/core/router/RouterGuard.d.ts +12 -0
- package/core/router/RouterGuard.js +3 -0
- package/core/router/RouterGuard.js.map +1 -0
- package/core/router/index.d.ts +4 -0
- package/core/router/index.js +5 -0
- package/core/router/index.js.map +1 -0
- package/core/styles/index.d.ts +97 -0
- package/core/styles/index.js +36 -0
- package/core/styles/index.js.map +1 -0
- package/global/index.d.ts +79 -0
- package/global/index.js +931 -0
- package/global/index.js.map +1 -0
- package/global/safari-polyfill.d.ts +0 -0
- package/global/safari-polyfill.js +234 -0
- package/global/safari-polyfill.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.js.map +1 -0
- package/package.json +7 -3
package/global/index.js
ADDED
|
@@ -0,0 +1,931 @@
|
|
|
1
|
+
import { EventComponent } from "../core/event";
|
|
2
|
+
import { InputElement, ref, RefBoolean, RefList, RefMap, RefNumber, RefSet, RefString } from "../";
|
|
3
|
+
// safari-polyfill
|
|
4
|
+
if (/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
|
5
|
+
const { keys: e } = Object, t = !0, r = !1, n = "querySelectorAll", o = "querySelectorAll", { document: l, Element: s, MutationObserver: a, Set: c, WeakMap: u } = self,
|
|
6
|
+
/// @ts-ignore
|
|
7
|
+
i = (e) => o in e, { filter: d } = [];
|
|
8
|
+
/// @ts-ignore
|
|
9
|
+
var h = (e) => {
|
|
10
|
+
const h = new u(),
|
|
11
|
+
/// @ts-ignore
|
|
12
|
+
f = (t, r) => {
|
|
13
|
+
let n;
|
|
14
|
+
if (r)
|
|
15
|
+
for (let o, l = ((e) => e.matches || e.webkitMatchesSelector || e.msMatchesSelector)(t), s = 0, { length: a } = p; s < a; s++)
|
|
16
|
+
l.call(t, (o = p[s])) &&
|
|
17
|
+
(h.has(t) || h.set(t, new c()),
|
|
18
|
+
(n = h.get(t)),
|
|
19
|
+
n.has(o) || (n.add(o), e.handle(t, r, o)));
|
|
20
|
+
else
|
|
21
|
+
h.has(t) &&
|
|
22
|
+
((n = h.get(t)),
|
|
23
|
+
h.delete(t),
|
|
24
|
+
/// @ts-ignore
|
|
25
|
+
n.forEach((n) => {
|
|
26
|
+
e.handle(t, r, n);
|
|
27
|
+
}));
|
|
28
|
+
},
|
|
29
|
+
/// @ts-ignore
|
|
30
|
+
g = (e, t = !0) => {
|
|
31
|
+
for (let r = 0, { length: n } = e; r < n; r++)
|
|
32
|
+
f(e[r], t);
|
|
33
|
+
}, { query: p } = e, b = e.root || l, y = ((e, o = document, l = MutationObserver, s = ["*"]) => {
|
|
34
|
+
/// @ts-ignore
|
|
35
|
+
const a = (r, o, l, s, c, u) => {
|
|
36
|
+
for (const i of r)
|
|
37
|
+
(u || n in i) &&
|
|
38
|
+
(c
|
|
39
|
+
? l.has(i) || (l.add(i), s.delete(i), e(i, c))
|
|
40
|
+
: s.has(i) || (s.add(i), l.delete(i), e(i, c)),
|
|
41
|
+
u || a(i[n](o), o, l, s, c, t));
|
|
42
|
+
}, c = new l((e) => {
|
|
43
|
+
if (s.length) {
|
|
44
|
+
const n = s.join(","), o = new Set(), l = new Set();
|
|
45
|
+
for (const { addedNodes: s, removedNodes: c } of e)
|
|
46
|
+
a(c, n, o, l, r, r), a(s, n, o, l, t, r);
|
|
47
|
+
}
|
|
48
|
+
}), { observe: u } = c;
|
|
49
|
+
return ((c.observe = (e) => u.call(c, e, { subtree: t, childList: t }))(o), c);
|
|
50
|
+
})(f, b, a, p), { attachShadow: w } = s.prototype;
|
|
51
|
+
return (w &&
|
|
52
|
+
(s.prototype.attachShadow = function (e) {
|
|
53
|
+
const t = w.call(this, e);
|
|
54
|
+
return y.observe(t), t;
|
|
55
|
+
}),
|
|
56
|
+
p.length && g(b[o](p)),
|
|
57
|
+
{
|
|
58
|
+
/// @ts-ignore
|
|
59
|
+
drop: (e) => {
|
|
60
|
+
for (let t = 0, { length: r } = e; t < r; t++)
|
|
61
|
+
h.delete(e[t]);
|
|
62
|
+
},
|
|
63
|
+
flush: () => {
|
|
64
|
+
const e = y.takeRecords();
|
|
65
|
+
for (let t = 0, { length: r } = e; t < r; t++)
|
|
66
|
+
g(d.call(e[t].removedNodes, i), !1),
|
|
67
|
+
g(d.call(e[t].addedNodes, i), !0);
|
|
68
|
+
},
|
|
69
|
+
observer: y,
|
|
70
|
+
parse: g,
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
const { customElements: f, document: g, Element: p, MutationObserver: b, Object: y, Promise: w, Map: m, Set: S, WeakMap: v, Reflect: A, } = self, { createElement: E } = g, { define: M, get: O, upgrade: q } = f, { construct: k } = A || {
|
|
74
|
+
/// @ts-ignore
|
|
75
|
+
construct(e) {
|
|
76
|
+
return e.call(this);
|
|
77
|
+
},
|
|
78
|
+
}, { defineProperty: N, getOwnPropertyNames: $, setPrototypeOf: P } = y, C = new v(), j = new S(), V = new m(), L = new m(), R = new m(), T = new m(),
|
|
79
|
+
/// @ts-ignore
|
|
80
|
+
W = [],
|
|
81
|
+
/// @ts-ignore
|
|
82
|
+
_ = [],
|
|
83
|
+
/// @ts-ignore
|
|
84
|
+
x = (e) => T.get(e) || O.call(f, e), { parse: D } = h({
|
|
85
|
+
/// @ts-ignore
|
|
86
|
+
query: _,
|
|
87
|
+
/// @ts-ignore
|
|
88
|
+
handle: (t, r, n) => {
|
|
89
|
+
const o = R.get(n);
|
|
90
|
+
if (r && !o.isPrototypeOf(t)) {
|
|
91
|
+
const r = ((t) => {
|
|
92
|
+
const r = e(t),
|
|
93
|
+
/// @ts-ignore
|
|
94
|
+
n = [], o = new Set(), { length: l } = r;
|
|
95
|
+
for (let e = 0; e < l; e++) {
|
|
96
|
+
n[e] = t[r[e]];
|
|
97
|
+
try {
|
|
98
|
+
delete t[r[e]];
|
|
99
|
+
}
|
|
100
|
+
catch (t) {
|
|
101
|
+
o.add(e);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return () => {
|
|
105
|
+
/// @ts-ignore
|
|
106
|
+
for (let e = 0; e < l; e++)
|
|
107
|
+
o.has(e) || (t[r[e]] = n[e]);
|
|
108
|
+
};
|
|
109
|
+
})(t);
|
|
110
|
+
B = P(t, o);
|
|
111
|
+
try {
|
|
112
|
+
new o.constructor();
|
|
113
|
+
}
|
|
114
|
+
finally {
|
|
115
|
+
(B = null), r();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const l = (r ? "" : "dis") + "connectedCallback";
|
|
119
|
+
l in o && t[l]();
|
|
120
|
+
},
|
|
121
|
+
}), { parse: F } = h({
|
|
122
|
+
/// @ts-ignore
|
|
123
|
+
query: W,
|
|
124
|
+
/// @ts-ignore
|
|
125
|
+
handle(e, t) {
|
|
126
|
+
/// @ts-ignore
|
|
127
|
+
C.has(e) && (t ? j.add(e) : j.delete(e), _.length && G.call(_, e));
|
|
128
|
+
},
|
|
129
|
+
}), { attachShadow: H } = p.prototype;
|
|
130
|
+
H &&
|
|
131
|
+
(p.prototype.attachShadow = function (e) {
|
|
132
|
+
const t = H.call(this, e);
|
|
133
|
+
return C.set(this, t), t;
|
|
134
|
+
});
|
|
135
|
+
/// @ts-ignore
|
|
136
|
+
const I = (e) => {
|
|
137
|
+
if (!L.has(e)) {
|
|
138
|
+
let t, r = new w((e) => {
|
|
139
|
+
t = e;
|
|
140
|
+
});
|
|
141
|
+
L.set(e, { $: r, _: t });
|
|
142
|
+
}
|
|
143
|
+
return L.get(e).$;
|
|
144
|
+
}, z = ((e, t) => {
|
|
145
|
+
/// @ts-ignore
|
|
146
|
+
const r = (e) => {
|
|
147
|
+
for (let t = 0, { length: r } = e; t < r; t++)
|
|
148
|
+
n(e[t]);
|
|
149
|
+
},
|
|
150
|
+
/// @ts-ignore
|
|
151
|
+
n = ({ target: e, attributeName: t, oldValue: r }) => {
|
|
152
|
+
e.attributeChangedCallback(t, r, e.getAttribute(t));
|
|
153
|
+
};
|
|
154
|
+
/// @ts-ignore
|
|
155
|
+
return (o, l) => {
|
|
156
|
+
const { observedAttributes: s } = o.constructor;
|
|
157
|
+
return (s &&
|
|
158
|
+
e(l).then(() => {
|
|
159
|
+
new t(r).observe(o, {
|
|
160
|
+
attributes: !0,
|
|
161
|
+
attributeOldValue: !0,
|
|
162
|
+
attributeFilter: s,
|
|
163
|
+
});
|
|
164
|
+
for (let e = 0, { length: t } = s; e < t; e++)
|
|
165
|
+
o.hasAttribute(s[e]) &&
|
|
166
|
+
n({ target: o, attributeName: s[e], oldValue: null });
|
|
167
|
+
}),
|
|
168
|
+
o);
|
|
169
|
+
};
|
|
170
|
+
})(I, b);
|
|
171
|
+
/// @ts-ignore
|
|
172
|
+
let B = null;
|
|
173
|
+
/// @ts-ignore
|
|
174
|
+
function G(e) {
|
|
175
|
+
const t = C.get(e);
|
|
176
|
+
/// @ts-ignore
|
|
177
|
+
D(t.querySelectorAll(this), e.isConnected);
|
|
178
|
+
}
|
|
179
|
+
$(self)
|
|
180
|
+
.filter((e) => /^HTML.*Element$/.test(e))
|
|
181
|
+
.forEach((e) => {
|
|
182
|
+
/// @ts-ignore
|
|
183
|
+
const t = self[e];
|
|
184
|
+
function r() {
|
|
185
|
+
/// @ts-ignore
|
|
186
|
+
const { constructor: e } = this;
|
|
187
|
+
if (!V.has(e))
|
|
188
|
+
throw new TypeError("Illegal constructor");
|
|
189
|
+
const { is: r, tag: n } = V.get(e);
|
|
190
|
+
if (r) {
|
|
191
|
+
/// @ts-ignore
|
|
192
|
+
if (B)
|
|
193
|
+
return z(B, r);
|
|
194
|
+
const t = E.call(g, n);
|
|
195
|
+
return t.setAttribute("is", r), z(P(t, e.prototype), r);
|
|
196
|
+
}
|
|
197
|
+
/// @ts-ignore
|
|
198
|
+
return k.call(this, t, [], e);
|
|
199
|
+
}
|
|
200
|
+
P(r, t),
|
|
201
|
+
N((r.prototype = t.prototype), "constructor", { value: r }),
|
|
202
|
+
N(self, e, { value: r });
|
|
203
|
+
}),
|
|
204
|
+
/// @ts-ignore
|
|
205
|
+
(g.createElement = function (e, t) {
|
|
206
|
+
const r = t && t.is;
|
|
207
|
+
if (r) {
|
|
208
|
+
const t = T.get(r);
|
|
209
|
+
if (t && V.get(t).tag === e)
|
|
210
|
+
return new t();
|
|
211
|
+
}
|
|
212
|
+
const n = E.call(g, e);
|
|
213
|
+
return r && n.setAttribute("is", r), n;
|
|
214
|
+
}),
|
|
215
|
+
(f.get = x),
|
|
216
|
+
(f.whenDefined = I),
|
|
217
|
+
(f.upgrade = function (e) {
|
|
218
|
+
/// @ts-ignore
|
|
219
|
+
const t = e.getAttribute("is");
|
|
220
|
+
if (t) {
|
|
221
|
+
const r = T.get(t);
|
|
222
|
+
if (r)
|
|
223
|
+
return void z(P(e, r.prototype), t);
|
|
224
|
+
}
|
|
225
|
+
q.call(f, e);
|
|
226
|
+
}),
|
|
227
|
+
(f.define = function (e, t, r) {
|
|
228
|
+
if (x(e))
|
|
229
|
+
throw new Error(`'${e}' has already been defined as a custom element`);
|
|
230
|
+
/// @ts-ignore
|
|
231
|
+
let n;
|
|
232
|
+
const o = r && r.extends;
|
|
233
|
+
V.set(t, o ? { is: e, tag: o } : { is: "", tag: e }),
|
|
234
|
+
o
|
|
235
|
+
? ((n = `${o}[is="${e}"]`),
|
|
236
|
+
R.set(n, t.prototype),
|
|
237
|
+
T.set(e, t),
|
|
238
|
+
_.push(n))
|
|
239
|
+
/// @ts-ignore
|
|
240
|
+
: (M.apply(f, arguments), W.push((n = e))),
|
|
241
|
+
I(e).then(() => {
|
|
242
|
+
o
|
|
243
|
+
/// @ts-ignore
|
|
244
|
+
? (D(g.querySelectorAll(n)), j.forEach(G, [n]))
|
|
245
|
+
/// @ts-ignore
|
|
246
|
+
: F(g.querySelectorAll(n));
|
|
247
|
+
}),
|
|
248
|
+
L.get(e)._(t);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
const styleRef = Symbol("styleRef");
|
|
252
|
+
export class Component extends HTMLElement {
|
|
253
|
+
constructor(props) {
|
|
254
|
+
super();
|
|
255
|
+
Component.applyProps(this, props);
|
|
256
|
+
}
|
|
257
|
+
static async applyProps(element, props) {
|
|
258
|
+
const hasProxy = Object.hasOwn(element.style, "styleRef");
|
|
259
|
+
if (!hasProxy) {
|
|
260
|
+
const style = element.style;
|
|
261
|
+
// @ts-ignore
|
|
262
|
+
style["styleRef"] = styleRef;
|
|
263
|
+
const customStyle = new Proxy(style, {
|
|
264
|
+
get(target, property) {
|
|
265
|
+
const value = Reflect.get(target, property);
|
|
266
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
267
|
+
},
|
|
268
|
+
set(target, property, value) {
|
|
269
|
+
if (value instanceof ref) {
|
|
270
|
+
// @ts-ignore
|
|
271
|
+
value.subscribe(target, property);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
// @ts-ignore
|
|
275
|
+
Reflect.set(target, property, value);
|
|
276
|
+
}
|
|
277
|
+
return true;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
Object.defineProperty(element, "style", {
|
|
281
|
+
get: () => customStyle
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
if (props) {
|
|
285
|
+
for (const [key, propValue] of Object.entries(props)) {
|
|
286
|
+
if (propValue === undefined)
|
|
287
|
+
continue;
|
|
288
|
+
switch (key) {
|
|
289
|
+
case "itemLoading":
|
|
290
|
+
element.setAttribute("item-loading", propValue);
|
|
291
|
+
break;
|
|
292
|
+
case "children":
|
|
293
|
+
if (Array.isArray(propValue))
|
|
294
|
+
element.append(...propValue);
|
|
295
|
+
else
|
|
296
|
+
element.append(propValue);
|
|
297
|
+
break;
|
|
298
|
+
case "for":
|
|
299
|
+
element.setAttribute("for", propValue);
|
|
300
|
+
break;
|
|
301
|
+
case "className":
|
|
302
|
+
element.addClassName(propValue);
|
|
303
|
+
break;
|
|
304
|
+
case "text":
|
|
305
|
+
element.innerText = propValue;
|
|
306
|
+
break;
|
|
307
|
+
case "html":
|
|
308
|
+
element.innerHTML = propValue;
|
|
309
|
+
break;
|
|
310
|
+
default:
|
|
311
|
+
if (key in element.style) {
|
|
312
|
+
element.style[key] = propValue;
|
|
313
|
+
}
|
|
314
|
+
else if (key in element && propValue) {
|
|
315
|
+
try {
|
|
316
|
+
element[key] = propValue;
|
|
317
|
+
}
|
|
318
|
+
catch {
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (hasProxy)
|
|
325
|
+
return;
|
|
326
|
+
if (typeof element.template === "function") {
|
|
327
|
+
setTimeout(() => {
|
|
328
|
+
const templateResult = element.template();
|
|
329
|
+
if (templateResult) {
|
|
330
|
+
element.append(templateResult);
|
|
331
|
+
}
|
|
332
|
+
}, 0);
|
|
333
|
+
}
|
|
334
|
+
if (typeof element.onInit === "function") {
|
|
335
|
+
element.onInit();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
static createElement(html) {
|
|
339
|
+
const element = document.createElement("div");
|
|
340
|
+
element.innerHTML = html;
|
|
341
|
+
return (element?.children[0] || element);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
globalThis.Component = Component;
|
|
345
|
+
customElements.define("base-component", Component);
|
|
346
|
+
const isValideRef = (value) => (value && typeof value === "object" && (value instanceof RefString || value instanceof RefNumber || value instanceof RefBoolean || value instanceof RefList || value instanceof RefMap || value instanceof RefSet));
|
|
347
|
+
const consolecheck = (callback, message, ...optionalParams) => {
|
|
348
|
+
if (isValideRef(message))
|
|
349
|
+
message = message.valueOf();
|
|
350
|
+
for (let i = 0; i < optionalParams.length; i++) {
|
|
351
|
+
if (isValideRef(optionalParams[i])) {
|
|
352
|
+
optionalParams[i] = optionalParams[i].valueOf();
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
callback(message, ...optionalParams);
|
|
356
|
+
};
|
|
357
|
+
const originalConsoleLog = console.log;
|
|
358
|
+
console.log = function (message, ...optionalParams) {
|
|
359
|
+
consolecheck(originalConsoleLog, message, ...optionalParams);
|
|
360
|
+
};
|
|
361
|
+
const originalConsoleError = console.error;
|
|
362
|
+
console.error = function (message, ...optionalParams) {
|
|
363
|
+
consolecheck(originalConsoleError, message, ...optionalParams);
|
|
364
|
+
};
|
|
365
|
+
const originalConsoleWarn = console.warn;
|
|
366
|
+
console.warn = function (message, ...optionalParams) {
|
|
367
|
+
consolecheck(originalConsoleWarn, message, ...optionalParams);
|
|
368
|
+
};
|
|
369
|
+
const originalConsoleInfo = console.info;
|
|
370
|
+
console.info = function (message, ...optionalParams) {
|
|
371
|
+
consolecheck(originalConsoleInfo, message, ...optionalParams);
|
|
372
|
+
};
|
|
373
|
+
function deepCopy(obj, cache = new WeakMap()) {
|
|
374
|
+
if (obj === null || typeof obj !== "object")
|
|
375
|
+
return obj;
|
|
376
|
+
if (cache.has(obj))
|
|
377
|
+
return cache.get(obj);
|
|
378
|
+
if (obj instanceof HTMLElement)
|
|
379
|
+
return obj.cloneNode(true);
|
|
380
|
+
if (Array.isArray(obj)) {
|
|
381
|
+
const clonedArray = obj.map((item) => deepCopy(item, cache));
|
|
382
|
+
cache.set(obj, clonedArray);
|
|
383
|
+
return clonedArray;
|
|
384
|
+
}
|
|
385
|
+
if (obj instanceof Date)
|
|
386
|
+
return new Date(obj);
|
|
387
|
+
if (obj instanceof RegExp)
|
|
388
|
+
return new RegExp(obj);
|
|
389
|
+
if (obj instanceof Map) {
|
|
390
|
+
const clonedMap = new Map();
|
|
391
|
+
cache.set(obj, clonedMap);
|
|
392
|
+
for (const [key, value] of obj) {
|
|
393
|
+
clonedMap.set(deepCopy(key, cache), deepCopy(value, cache));
|
|
394
|
+
}
|
|
395
|
+
return clonedMap;
|
|
396
|
+
}
|
|
397
|
+
if (obj instanceof Set) {
|
|
398
|
+
const clonedSet = new Set();
|
|
399
|
+
cache.set(obj, clonedSet);
|
|
400
|
+
for (const value of obj) {
|
|
401
|
+
clonedSet.add(deepCopy(value, cache));
|
|
402
|
+
}
|
|
403
|
+
return clonedSet;
|
|
404
|
+
}
|
|
405
|
+
if (typeof obj === "function") {
|
|
406
|
+
return obj;
|
|
407
|
+
}
|
|
408
|
+
//if (typeof obj === "object" && obj instanceof ref)
|
|
409
|
+
// obj = obj.valueOf() as any;
|
|
410
|
+
const clonedObj = Object.create(Object.getPrototypeOf(obj));
|
|
411
|
+
cache.set(obj, clonedObj);
|
|
412
|
+
for (const key of [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)]) {
|
|
413
|
+
clonedObj[key] = deepCopy(obj[key], cache);
|
|
414
|
+
}
|
|
415
|
+
if (Object.isFrozen(obj))
|
|
416
|
+
Object.freeze(clonedObj);
|
|
417
|
+
if (Object.isSealed(obj))
|
|
418
|
+
Object.seal(clonedObj);
|
|
419
|
+
return clonedObj;
|
|
420
|
+
}
|
|
421
|
+
globalThis.deepCopy = deepCopy;
|
|
422
|
+
WeakRef.prototype.equals = function (value) {
|
|
423
|
+
return this.deref() === value.deref();
|
|
424
|
+
};
|
|
425
|
+
Object.defineProperty(Element.prototype, "onChangeRoute", {
|
|
426
|
+
value: function (url) { },
|
|
427
|
+
writable: true,
|
|
428
|
+
configurable: true,
|
|
429
|
+
enumerable: true,
|
|
430
|
+
});
|
|
431
|
+
function basePrototypeRefInjection(prototype) {
|
|
432
|
+
Object.defineProperty(prototype, "value", {
|
|
433
|
+
get: function () {
|
|
434
|
+
return this.valueOf();
|
|
435
|
+
},
|
|
436
|
+
set: function (value) {
|
|
437
|
+
this.valueOf(value);
|
|
438
|
+
},
|
|
439
|
+
});
|
|
440
|
+
Object.defineProperty(prototype, "subscribe", {
|
|
441
|
+
value: function (target) {
|
|
442
|
+
return undefined;
|
|
443
|
+
},
|
|
444
|
+
});
|
|
445
|
+
Object.defineProperty(prototype, "unsubscribe", {
|
|
446
|
+
value: function (target) {
|
|
447
|
+
return undefined;
|
|
448
|
+
},
|
|
449
|
+
});
|
|
450
|
+
}
|
|
451
|
+
basePrototypeRefInjection(String.prototype);
|
|
452
|
+
basePrototypeRefInjection(Number.prototype);
|
|
453
|
+
basePrototypeRefInjection(Boolean.prototype);
|
|
454
|
+
basePrototypeRefInjection(Array.prototype);
|
|
455
|
+
basePrototypeRefInjection(Map.prototype);
|
|
456
|
+
basePrototypeRefInjection(Set.prototype);
|
|
457
|
+
function componentInjectionValue(prototype) {
|
|
458
|
+
const original = Object.getOwnPropertyDescriptor(prototype, "value");
|
|
459
|
+
if (!original)
|
|
460
|
+
return;
|
|
461
|
+
Object.defineProperty(prototype, "value", {
|
|
462
|
+
set: function (value) {
|
|
463
|
+
if (value instanceof ref) {
|
|
464
|
+
// @ts-ignore
|
|
465
|
+
const onInput = () => (value.value = this.value);
|
|
466
|
+
this.addEventListener("input", onInput);
|
|
467
|
+
value.subscribe(this, "value", () => this.removeEventListener("input", onInput));
|
|
468
|
+
}
|
|
469
|
+
else {
|
|
470
|
+
original.set.call(this, value);
|
|
471
|
+
}
|
|
472
|
+
},
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
function componentInjectionChecked(prototype) {
|
|
476
|
+
const original = Object.getOwnPropertyDescriptor(prototype, "checked");
|
|
477
|
+
if (!original)
|
|
478
|
+
return;
|
|
479
|
+
Object.defineProperty(prototype, "checked", {
|
|
480
|
+
set: function (value) {
|
|
481
|
+
if (value instanceof ref) {
|
|
482
|
+
const onInput = () => (value.value = this.checked);
|
|
483
|
+
this.addEventListener("input", onInput);
|
|
484
|
+
this.subscribe(this, "checked", () => this.removeEventListener("input", onInput));
|
|
485
|
+
}
|
|
486
|
+
else {
|
|
487
|
+
original.set.call(this, value);
|
|
488
|
+
}
|
|
489
|
+
},
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
function componentInjectionDisabled(prototype) {
|
|
493
|
+
Object.defineProperty(prototype, "disabled", {
|
|
494
|
+
get: function () {
|
|
495
|
+
return this.hasAttribute("disabled");
|
|
496
|
+
},
|
|
497
|
+
set: function (value) {
|
|
498
|
+
if (value instanceof ref)
|
|
499
|
+
value.subscribe(this, "disabled");
|
|
500
|
+
else {
|
|
501
|
+
if (value)
|
|
502
|
+
this.setAttribute("disabled", "");
|
|
503
|
+
else
|
|
504
|
+
this.removeAttribute("disabled");
|
|
505
|
+
}
|
|
506
|
+
},
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
function componentInjectionHidden(prototype) {
|
|
510
|
+
Object.defineProperty(prototype, "hidden", {
|
|
511
|
+
get: function () {
|
|
512
|
+
return this.hasAttribute("hidden");
|
|
513
|
+
},
|
|
514
|
+
set: function (value) {
|
|
515
|
+
if (value instanceof ref)
|
|
516
|
+
value.subscribe(this, "hidden");
|
|
517
|
+
else {
|
|
518
|
+
if (value)
|
|
519
|
+
this.setAttribute("hidden", "");
|
|
520
|
+
else
|
|
521
|
+
this.removeAttribute("hidden");
|
|
522
|
+
}
|
|
523
|
+
},
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
function isWritable(descriptor) {
|
|
527
|
+
if (!descriptor || typeof descriptor?.value == "function") {
|
|
528
|
+
return false;
|
|
529
|
+
}
|
|
530
|
+
if ("value" in descriptor) {
|
|
531
|
+
return !!descriptor.writable;
|
|
532
|
+
}
|
|
533
|
+
if ("get" in descriptor || "set" in descriptor) {
|
|
534
|
+
return typeof descriptor.set === "function";
|
|
535
|
+
}
|
|
536
|
+
return false;
|
|
537
|
+
}
|
|
538
|
+
function componentInjectionVariableController(prototype, propertyName) {
|
|
539
|
+
const original = getOwnPropertyDescriptor(prototype, propertyName);
|
|
540
|
+
if (!isWritable(original))
|
|
541
|
+
return;
|
|
542
|
+
Object.defineProperty(prototype, propertyName, {
|
|
543
|
+
set: function (value) {
|
|
544
|
+
if (value instanceof ref) {
|
|
545
|
+
value.subscribe(this, propertyName?.toString());
|
|
546
|
+
}
|
|
547
|
+
else
|
|
548
|
+
original.set.call(this, value?.valueOf());
|
|
549
|
+
},
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
function getOwnPropertyDescriptor(prototype, propertName) {
|
|
553
|
+
if (prototype == null)
|
|
554
|
+
return undefined;
|
|
555
|
+
const d = Object.getOwnPropertyDescriptor(prototype, propertName) || getOwnPropertyDescriptor(Object.getPrototypeOf(prototype), propertName);
|
|
556
|
+
return d;
|
|
557
|
+
}
|
|
558
|
+
function componentInjectionController(prototype, propertNames) {
|
|
559
|
+
if (propertNames == undefined)
|
|
560
|
+
propertNames = Object.getOwnPropertyNames(prototype);
|
|
561
|
+
if (!propertNames.includes("disabled"))
|
|
562
|
+
componentInjectionDisabled(prototype);
|
|
563
|
+
if (!propertNames.includes("hidden"))
|
|
564
|
+
componentInjectionHidden(prototype);
|
|
565
|
+
for (const propertName of propertNames) {
|
|
566
|
+
if (propertName == "value")
|
|
567
|
+
componentInjectionValue(prototype);
|
|
568
|
+
else if (propertName == "checked")
|
|
569
|
+
componentInjectionChecked(prototype);
|
|
570
|
+
else
|
|
571
|
+
componentInjectionVariableController(prototype, propertName);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
componentInjectionController(Element.prototype);
|
|
575
|
+
componentInjectionController(HTMLElement.prototype);
|
|
576
|
+
componentInjectionController(HTMLButtonElement.prototype);
|
|
577
|
+
componentInjectionController(HTMLInputElement.prototype);
|
|
578
|
+
componentInjectionController(HTMLTextAreaElement.prototype);
|
|
579
|
+
componentInjectionController(HTMLImageElement.prototype);
|
|
580
|
+
Object.defineProperty(Element.prototype, "variant", {
|
|
581
|
+
get: function () {
|
|
582
|
+
return this.getAttribute("variant") || "default";
|
|
583
|
+
},
|
|
584
|
+
set: function (v) {
|
|
585
|
+
// @ts-ignore
|
|
586
|
+
if (v instanceof ref) {
|
|
587
|
+
// @ts-ignore
|
|
588
|
+
v.subscribe(this, "variant");
|
|
589
|
+
}
|
|
590
|
+
else {
|
|
591
|
+
v = v?.toString()?.trim() || "default";
|
|
592
|
+
if (v == "default" || v == undefined || v.trim().length == 0)
|
|
593
|
+
this.removeAttribute("variant");
|
|
594
|
+
else {
|
|
595
|
+
this.setAttribute("variant", v);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
});
|
|
600
|
+
Object.defineProperty(Element.prototype, "connectedCallback", {
|
|
601
|
+
value: function () {
|
|
602
|
+
this.dispatchEvent(new CustomEvent("onConnected", { bubbles: false, cancelable: true }));
|
|
603
|
+
this?.onConnected();
|
|
604
|
+
},
|
|
605
|
+
writable: true,
|
|
606
|
+
configurable: true,
|
|
607
|
+
enumerable: true,
|
|
608
|
+
});
|
|
609
|
+
Object.defineProperty(Element.prototype, "disconnectedCallback", {
|
|
610
|
+
value: function () {
|
|
611
|
+
this.dispatchEvent(new CustomEvent("onDisconnected", { bubbles: false, cancelable: true }));
|
|
612
|
+
this?.onDisconnected();
|
|
613
|
+
},
|
|
614
|
+
writable: true,
|
|
615
|
+
configurable: true,
|
|
616
|
+
enumerable: true,
|
|
617
|
+
});
|
|
618
|
+
Object.defineProperty(window, "scoped", {
|
|
619
|
+
value: function (target) { },
|
|
620
|
+
writable: true,
|
|
621
|
+
configurable: true,
|
|
622
|
+
enumerable: true,
|
|
623
|
+
});
|
|
624
|
+
try {
|
|
625
|
+
const originalButton = Object.getOwnPropertyDescriptor(HTMLButtonElement.prototype, "type").set;
|
|
626
|
+
Object.defineProperty(HTMLButtonElement.prototype, "onfile", {
|
|
627
|
+
value: function (fileList) { },
|
|
628
|
+
writable: true,
|
|
629
|
+
configurable: true,
|
|
630
|
+
enumerable: true,
|
|
631
|
+
});
|
|
632
|
+
Object.defineProperty(HTMLButtonElement.prototype, "accept", {
|
|
633
|
+
get: function () {
|
|
634
|
+
return this.getAttribute("accept") || "";
|
|
635
|
+
},
|
|
636
|
+
set: function (value) {
|
|
637
|
+
this.setAttribute("accept", value);
|
|
638
|
+
},
|
|
639
|
+
});
|
|
640
|
+
Object.defineProperty(HTMLButtonElement.prototype, "multiple", {
|
|
641
|
+
get: function () {
|
|
642
|
+
return this.hasAttribute("multiple");
|
|
643
|
+
},
|
|
644
|
+
set: function (value) {
|
|
645
|
+
if (value)
|
|
646
|
+
this.setAttribute("multiple", "");
|
|
647
|
+
else
|
|
648
|
+
this.removeAttribute("multiple");
|
|
649
|
+
},
|
|
650
|
+
});
|
|
651
|
+
Object.defineProperty(HTMLButtonElement.prototype, "type", {
|
|
652
|
+
set: function (value) {
|
|
653
|
+
if (this.__onButtonFile__) {
|
|
654
|
+
if (this.__input_file__)
|
|
655
|
+
this.removeChild(this.__input_file__);
|
|
656
|
+
this.__input_file__ = undefined;
|
|
657
|
+
this.removeEventListener("click", this.__onButtonFile__);
|
|
658
|
+
}
|
|
659
|
+
if (value == "file") {
|
|
660
|
+
this.__input_file__ = new InputElement({ type: "file", display: "none" });
|
|
661
|
+
this.__input_file__.onchange = (event) => {
|
|
662
|
+
this.onfile(event.target.files);
|
|
663
|
+
event.stopPropagation();
|
|
664
|
+
event.preventDefault();
|
|
665
|
+
};
|
|
666
|
+
this.__input_file__.onclick = (event) => {
|
|
667
|
+
this.removeChild(this.__input_file__);
|
|
668
|
+
event.stopPropagation();
|
|
669
|
+
};
|
|
670
|
+
this.__onButtonFile__ = () => {
|
|
671
|
+
this.__input_file__.accept = this.accept;
|
|
672
|
+
this.__input_file__.multiple = this.multiple;
|
|
673
|
+
this.appendChild(this.__input_file__);
|
|
674
|
+
this.__input_file__.click();
|
|
675
|
+
};
|
|
676
|
+
this.addEventListener("click", this.__onButtonFile__);
|
|
677
|
+
}
|
|
678
|
+
originalButton.call(this, value);
|
|
679
|
+
},
|
|
680
|
+
});
|
|
681
|
+
}
|
|
682
|
+
catch (__) { }
|
|
683
|
+
Object.defineProperty(Element.prototype, "onInit", {
|
|
684
|
+
value: function () { },
|
|
685
|
+
writable: true,
|
|
686
|
+
configurable: true,
|
|
687
|
+
enumerable: true,
|
|
688
|
+
});
|
|
689
|
+
Object.defineProperty(Element.prototype, "getParent", {
|
|
690
|
+
value: function () {
|
|
691
|
+
return this.parentElement;
|
|
692
|
+
},
|
|
693
|
+
writable: true,
|
|
694
|
+
configurable: true,
|
|
695
|
+
enumerable: true,
|
|
696
|
+
});
|
|
697
|
+
Object.defineProperty(Element.prototype, "onConnected", {
|
|
698
|
+
value: function () { },
|
|
699
|
+
writable: true,
|
|
700
|
+
configurable: true,
|
|
701
|
+
enumerable: true,
|
|
702
|
+
});
|
|
703
|
+
Object.defineProperty(Element.prototype, "onDisconnected", {
|
|
704
|
+
value: function () { },
|
|
705
|
+
writable: true,
|
|
706
|
+
configurable: true,
|
|
707
|
+
enumerable: true,
|
|
708
|
+
});
|
|
709
|
+
Object.defineProperty(Element.prototype, "unmount", {
|
|
710
|
+
value: function () { },
|
|
711
|
+
writable: true,
|
|
712
|
+
configurable: true,
|
|
713
|
+
enumerable: true,
|
|
714
|
+
});
|
|
715
|
+
Object.defineProperty(Element.prototype, "addClassName", {
|
|
716
|
+
value: function (...names) {
|
|
717
|
+
for (const name of names) {
|
|
718
|
+
const strs = name.match(/\S+/g) || [];
|
|
719
|
+
if (strs.length > 0)
|
|
720
|
+
this.classList.add(...strs);
|
|
721
|
+
}
|
|
722
|
+
},
|
|
723
|
+
writable: true,
|
|
724
|
+
configurable: true,
|
|
725
|
+
enumerable: true,
|
|
726
|
+
});
|
|
727
|
+
// remove class
|
|
728
|
+
Object.defineProperty(Element.prototype, "removeClassName", {
|
|
729
|
+
value: function (...names) {
|
|
730
|
+
for (const name of names) {
|
|
731
|
+
const strs = name.match(/\S+/g) || [];
|
|
732
|
+
if (strs.length > 0)
|
|
733
|
+
this.classList.remove(...strs);
|
|
734
|
+
}
|
|
735
|
+
},
|
|
736
|
+
writable: true,
|
|
737
|
+
configurable: true,
|
|
738
|
+
enumerable: true,
|
|
739
|
+
});
|
|
740
|
+
Object.defineProperty(Element.prototype, "setStyle", {
|
|
741
|
+
value: function (styles) {
|
|
742
|
+
Component.applyProps(this, styles);
|
|
743
|
+
},
|
|
744
|
+
writable: true,
|
|
745
|
+
configurable: true,
|
|
746
|
+
enumerable: true,
|
|
747
|
+
});
|
|
748
|
+
Object.defineProperty(Element.prototype, "onEvent", {
|
|
749
|
+
value: function (type, listener, options) {
|
|
750
|
+
EventComponent.addEventListener(this, type, listener, options);
|
|
751
|
+
},
|
|
752
|
+
writable: true,
|
|
753
|
+
configurable: true,
|
|
754
|
+
enumerable: true,
|
|
755
|
+
});
|
|
756
|
+
Object.defineProperty(Element.prototype, "createEvent", {
|
|
757
|
+
value: function (type, ...data) {
|
|
758
|
+
return EventComponent.createEvent(type, ...data);
|
|
759
|
+
},
|
|
760
|
+
writable: true,
|
|
761
|
+
configurable: true,
|
|
762
|
+
enumerable: true,
|
|
763
|
+
});
|
|
764
|
+
Object.defineProperty(Element.prototype, "removeEvent", {
|
|
765
|
+
value: function (type) {
|
|
766
|
+
EventComponent.removeEventListener(this, type);
|
|
767
|
+
},
|
|
768
|
+
writable: true,
|
|
769
|
+
configurable: true,
|
|
770
|
+
enumerable: true,
|
|
771
|
+
});
|
|
772
|
+
Object.defineProperty(Element.prototype, "removeEvents", {
|
|
773
|
+
value: function () {
|
|
774
|
+
EventComponent.removeEventListeners(this);
|
|
775
|
+
},
|
|
776
|
+
writable: true,
|
|
777
|
+
configurable: true,
|
|
778
|
+
enumerable: true,
|
|
779
|
+
});
|
|
780
|
+
Object.defineProperty(Element.prototype, "emitEvent", {
|
|
781
|
+
value: function (type, ...params) {
|
|
782
|
+
return EventComponent.emitEvent(type, ...params);
|
|
783
|
+
},
|
|
784
|
+
writable: true,
|
|
785
|
+
configurable: true,
|
|
786
|
+
enumerable: true,
|
|
787
|
+
});
|
|
788
|
+
Object.defineProperty(Element.prototype, "deleteEvent", {
|
|
789
|
+
value: function (type) {
|
|
790
|
+
EventComponent.deleteEvent(type);
|
|
791
|
+
},
|
|
792
|
+
writable: true,
|
|
793
|
+
configurable: true,
|
|
794
|
+
enumerable: true,
|
|
795
|
+
});
|
|
796
|
+
const construcorOriginal = Element.prototype.constructor;
|
|
797
|
+
Element.prototype.constructor = function () {
|
|
798
|
+
construcorOriginal.call(this);
|
|
799
|
+
this.onInit();
|
|
800
|
+
};
|
|
801
|
+
Window.prototype.getTheme = function () {
|
|
802
|
+
return localStorage.getItem("theme") || "light";
|
|
803
|
+
};
|
|
804
|
+
Window.prototype.setTheme = function (theme) {
|
|
805
|
+
const html = document.querySelector("html");
|
|
806
|
+
html?.setAttribute("data-theme", theme);
|
|
807
|
+
localStorage.setItem("theme", theme);
|
|
808
|
+
};
|
|
809
|
+
Array.prototype.clear = function () {
|
|
810
|
+
this.length = 0;
|
|
811
|
+
};
|
|
812
|
+
{
|
|
813
|
+
Object.defineProperty(SVGElement.prototype, "complete", {
|
|
814
|
+
value: false,
|
|
815
|
+
writable: true,
|
|
816
|
+
configurable: true,
|
|
817
|
+
enumerable: true,
|
|
818
|
+
});
|
|
819
|
+
Object.defineProperty(SVGElement.prototype, "src", {
|
|
820
|
+
get: function () {
|
|
821
|
+
return this.getAttribute("src") || "";
|
|
822
|
+
},
|
|
823
|
+
set: function (value) {
|
|
824
|
+
if (value)
|
|
825
|
+
this.setAttribute("src", value);
|
|
826
|
+
else
|
|
827
|
+
this.removeAttribute("src");
|
|
828
|
+
},
|
|
829
|
+
});
|
|
830
|
+
}
|
|
831
|
+
const TypeComposer = {
|
|
832
|
+
createElement: (tag, props, ...children) => {
|
|
833
|
+
const isComponent = tag?.prototype instanceof HTMLElement;
|
|
834
|
+
if (typeof tag === "string" || isComponent) {
|
|
835
|
+
if (tag === "fragment") {
|
|
836
|
+
const fragment = document.createDocumentFragment();
|
|
837
|
+
for (const child of children) {
|
|
838
|
+
if (Array.isArray(child)) {
|
|
839
|
+
fragment.append(...child);
|
|
840
|
+
}
|
|
841
|
+
else if (child instanceof Node) {
|
|
842
|
+
fragment.append(child);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
return fragment;
|
|
846
|
+
}
|
|
847
|
+
const newComponentProps = (props?.props || {});
|
|
848
|
+
const el = isComponent ? new tag(newComponentProps) : document.createElement(tag);
|
|
849
|
+
const componentProps = {};
|
|
850
|
+
if (props) {
|
|
851
|
+
delete props?.props;
|
|
852
|
+
for (const key of Object.keys(props)) {
|
|
853
|
+
const value = props[key];
|
|
854
|
+
if (key === "ref") {
|
|
855
|
+
value && value(el);
|
|
856
|
+
}
|
|
857
|
+
else if (key.startsWith("on") && typeof value === "function") {
|
|
858
|
+
const eventName = key.slice(2).toLowerCase();
|
|
859
|
+
el.addEventListener(eventName, value);
|
|
860
|
+
}
|
|
861
|
+
else if (key === "style" && typeof value === "object") {
|
|
862
|
+
for (const styleKey in value) {
|
|
863
|
+
componentProps[styleKey] = value[styleKey];
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
else if (key === "className" || key === "class") {
|
|
867
|
+
componentProps[key] = value;
|
|
868
|
+
}
|
|
869
|
+
else
|
|
870
|
+
el.setAttribute(key, value);
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
Component.applyProps(el, componentProps);
|
|
874
|
+
const appendChild = (parent, child) => {
|
|
875
|
+
if (Array.isArray(child)) {
|
|
876
|
+
child.forEach(c => appendChild(parent, c));
|
|
877
|
+
}
|
|
878
|
+
else if (child instanceof Node) {
|
|
879
|
+
parent.appendChild(child);
|
|
880
|
+
}
|
|
881
|
+
else if (child !== null && child !== undefined) {
|
|
882
|
+
if (child instanceof ref) {
|
|
883
|
+
const value = child.valueOf();
|
|
884
|
+
if (value instanceof Node) {
|
|
885
|
+
let childValue = parent.appendChild(value);
|
|
886
|
+
child.subscribe(() => {
|
|
887
|
+
const newValue = child.valueOf();
|
|
888
|
+
if (newValue instanceof Node) {
|
|
889
|
+
parent.replaceChild(newValue, childValue);
|
|
890
|
+
childValue = newValue;
|
|
891
|
+
}
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
else {
|
|
895
|
+
let childValue = parent.appendChild(document.createTextNode(value?.toString() || ""));
|
|
896
|
+
child.subscribe(() => {
|
|
897
|
+
const newValue = document.createTextNode(child?.valueOf()?.toString() || "");
|
|
898
|
+
parent.replaceChild(newValue, childValue);
|
|
899
|
+
childValue = newValue;
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
else
|
|
904
|
+
parent.appendChild(document.createTextNode(child.toString()));
|
|
905
|
+
}
|
|
906
|
+
};
|
|
907
|
+
children.forEach(c => appendChild(el, c));
|
|
908
|
+
return el;
|
|
909
|
+
}
|
|
910
|
+
return tag({ ...props, children });
|
|
911
|
+
},
|
|
912
|
+
createFragment: (...children) => {
|
|
913
|
+
const components = [];
|
|
914
|
+
for (const node of children) {
|
|
915
|
+
const elements = [];
|
|
916
|
+
for (const child of node.children) {
|
|
917
|
+
if (Array.isArray(child)) {
|
|
918
|
+
elements.push(...child);
|
|
919
|
+
}
|
|
920
|
+
else if (child instanceof Node) {
|
|
921
|
+
elements.push(child);
|
|
922
|
+
}
|
|
923
|
+
}
|
|
924
|
+
components.push(...elements);
|
|
925
|
+
}
|
|
926
|
+
return components;
|
|
927
|
+
},
|
|
928
|
+
Fragment: "fragment"
|
|
929
|
+
};
|
|
930
|
+
globalThis.TypeComposer = TypeComposer;
|
|
931
|
+
//# sourceMappingURL=index.js.map
|