typecomposer 0.1.49 → 0.1.50
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/assets/index.js +1 -0
- package/core/components/AlertPanel.d.ts +32 -0
- package/core/components/AlertPanel.js +1 -0
- package/core/components/AlertPanel.js.map +1 -0
- package/core/components/AvatarPanel.d.ts +21 -0
- package/core/components/AvatarPanel.js +1 -0
- package/core/components/AvatarPanel.js.map +1 -0
- package/core/components/BorderPanel.d.ts +28 -0
- package/core/components/BorderPanel.js +1 -0
- package/core/components/BorderPanel.js.map +1 -0
- package/core/components/CardPanel.d.ts +5 -0
- package/core/components/CardPanel.js +1 -0
- package/core/components/CardPanel.js.map +1 -0
- package/core/components/CheckBox.d.ts +36 -0
- package/core/components/CheckBox.js +1 -0
- package/core/components/CheckBox.js.map +1 -0
- package/core/components/ColorPicker.d.ts +10 -0
- package/core/components/ColorPicker.js +1 -0
- package/core/components/ColorPicker.js.map +1 -0
- package/core/components/ContextMenu.d.ts +16 -0
- package/core/components/ContextMenu.js +1 -0
- package/core/components/ContextMenu.js.map +1 -0
- package/core/components/DialogPanel.d.ts +15 -0
- package/core/components/DialogPanel.js +1 -0
- package/core/components/DialogPanel.js.map +1 -0
- package/core/components/DropDown.d.ts +54 -0
- package/core/components/DropDown.js +1 -0
- package/core/components/DropDown.js.map +1 -0
- package/core/components/FlowPanel.d.ts +11 -0
- package/core/components/FlowPanel.js +1 -0
- package/core/components/FlowPanel.js.map +1 -0
- package/core/components/ForEach.d.ts +11 -0
- package/core/components/ForEach.js +1 -0
- package/core/components/ForEach.js.map +1 -0
- package/core/components/GridPanel.d.ts +7 -0
- package/core/components/GridPanel.js +1 -0
- package/core/components/GridPanel.js.map +1 -0
- package/core/components/HBox.d.ts +5 -0
- package/core/components/HBox.js +1 -0
- package/core/components/HBox.js.map +1 -0
- package/core/components/LazyLoading.d.ts +19 -0
- package/core/components/LazyLoading.js +1 -0
- package/core/components/LazyLoading.js.map +1 -0
- package/core/components/ListPanel.d.ts +27 -0
- package/core/components/ListPanel.js +1 -0
- package/core/components/ListPanel.js.map +1 -0
- package/core/components/PopUpButton.d.ts +18 -0
- package/core/components/PopUpButton.js +1 -0
- package/core/components/PopUpButton.js.map +1 -0
- package/core/components/ScrollPanel.d.ts +14 -0
- package/core/components/ScrollPanel.js +1 -0
- package/core/components/ScrollPanel.js.map +1 -0
- package/core/components/SliderPanel.d.ts +7 -0
- package/core/components/SliderPanel.js +1 -0
- package/core/components/SliderPanel.js.map +1 -0
- package/core/components/StackPanel.d.ts +5 -0
- package/core/components/StackPanel.js +1 -0
- package/core/components/StackPanel.js.map +1 -0
- package/core/components/TabItem.d.ts +19 -0
- package/core/components/TabItem.js +1 -0
- package/core/components/TabItem.js.map +1 -0
- package/core/components/TabPanel.d.ts +25 -0
- package/core/components/TabPanel.js +1 -0
- package/core/components/TabPanel.js.map +1 -0
- package/core/components/TextEdit.d.ts +32 -0
- package/core/components/TextEdit.js +1 -0
- package/core/components/TextEdit.js.map +1 -0
- package/core/components/TextField.d.ts +34 -0
- package/core/components/TextField.js +1 -0
- package/core/components/TextField.js.map +1 -0
- package/core/components/ToggleButton.d.ts +7 -0
- package/core/components/ToggleButton.js +1 -0
- package/core/components/ToggleButton.js.map +1 -0
- package/core/components/Tooltip.d.ts +8 -0
- package/core/components/Tooltip.js +1 -0
- package/core/components/Tooltip.js.map +1 -0
- package/core/components/VBox.d.ts +5 -0
- package/core/components/VBox.js +1 -0
- package/core/components/VBox.js.map +1 -0
- package/core/components/VirtualScroll.d.ts +20 -0
- package/core/components/VirtualScroll.js +1 -0
- package/core/components/VirtualScroll.js.map +1 -0
- package/core/components/index.d.ts +27 -0
- package/core/components/index.js +1 -0
- package/core/components/index.js.map +1 -0
- package/core/decorators/RegisterComponent.d.ts +8 -0
- package/core/decorators/RegisterComponent.js +1 -0
- package/core/decorators/RegisterComponent.js.map +1 -0
- package/core/decorators/StyleLink.d.ts +1 -0
- package/core/decorators/StyleLink.js +1 -0
- package/core/decorators/StyleLink.js.map +1 -0
- package/core/decorators/index.d.ts +4 -0
- package/core/decorators/index.js +1 -0
- package/core/decorators/index.js.map +1 -0
- package/core/element/AbbreviationElement.d.ts +5 -0
- package/core/element/AbbreviationElement.js +1 -0
- package/core/element/AbbreviationElement.js.map +1 -0
- package/core/element/AnchorElement.d.ts +8 -0
- package/core/element/AnchorElement.js +1 -0
- package/core/element/AnchorElement.js.map +1 -0
- package/core/element/AreaElement.d.ts +5 -0
- package/core/element/AreaElement.js +1 -0
- package/core/element/AreaElement.js.map +1 -0
- package/core/element/ArticleElement.d.ts +5 -0
- package/core/element/ArticleElement.js +1 -0
- package/core/element/ArticleElement.js.map +1 -0
- package/core/element/AudioElement.d.ts +5 -0
- package/core/element/AudioElement.js +1 -0
- package/core/element/AudioElement.js.map +1 -0
- package/core/element/BaseElement.d.ts +5 -0
- package/core/element/BaseElement.js +1 -0
- package/core/element/BaseElement.js.map +1 -0
- package/core/element/BodyElement.d.ts +5 -0
- package/core/element/BodyElement.js +1 -0
- package/core/element/BodyElement.js.map +1 -0
- package/core/element/BoldElement.d.ts +5 -0
- package/core/element/BoldElement.js +1 -0
- package/core/element/BoldElement.js.map +1 -0
- package/core/element/BreakElement.d.ts +5 -0
- package/core/element/BreakElement.js +1 -0
- package/core/element/BreakElement.js.map +1 -0
- package/core/element/ButtonElement.d.ts +9 -0
- package/core/element/ButtonElement.js +1 -0
- package/core/element/ButtonElement.js.map +1 -0
- package/core/element/CanvasElement.d.ts +5 -0
- package/core/element/CanvasElement.js +1 -0
- package/core/element/CanvasElement.js.map +1 -0
- package/core/element/CaptionElement.d.ts +5 -0
- package/core/element/CaptionElement.js +1 -0
- package/core/element/CaptionElement.js.map +1 -0
- package/core/element/CiteElement.d.ts +5 -0
- package/core/element/CiteElement.js +1 -0
- package/core/element/CiteElement.js.map +1 -0
- package/core/element/CodeElement.d.ts +7 -0
- package/core/element/CodeElement.js +1 -0
- package/core/element/CodeElement.js.map +1 -0
- package/core/element/DataListElement.d.ts +5 -0
- package/core/element/DataListElement.js +1 -0
- package/core/element/DataListElement.js.map +1 -0
- package/core/element/DefinitionDescriptionElement.d.ts +5 -0
- package/core/element/DefinitionDescriptionElement.js +1 -0
- package/core/element/DefinitionDescriptionElement.js.map +1 -0
- package/core/element/DefinitionElement.d.ts +5 -0
- package/core/element/DefinitionElement.js +1 -0
- package/core/element/DefinitionElement.js.map +1 -0
- package/core/element/DeletedTextElement.d.ts +5 -0
- package/core/element/DeletedTextElement.js +1 -0
- package/core/element/DeletedTextElement.js.map +1 -0
- package/core/element/DetailsElement.d.ts +6 -0
- package/core/element/DetailsElement.js +1 -0
- package/core/element/DetailsElement.js.map +1 -0
- package/core/element/DialogElement.d.ts +5 -0
- package/core/element/DialogElement.js +1 -0
- package/core/element/DialogElement.js.map +1 -0
- package/core/element/DivElement.d.ts +5 -0
- package/core/element/DivElement.js +1 -0
- package/core/element/DivElement.js.map +1 -0
- package/core/element/EmElement.d.ts +5 -0
- package/core/element/EmElement.js +1 -0
- package/core/element/EmElement.js.map +1 -0
- package/core/element/EmbedElement.d.ts +5 -0
- package/core/element/EmbedElement.js +1 -0
- package/core/element/EmbedElement.js.map +1 -0
- package/core/element/FieldSetElement.d.ts +6 -0
- package/core/element/FieldSetElement.js +1 -0
- package/core/element/FieldSetElement.js.map +1 -0
- package/core/element/FooterElement.d.ts +5 -0
- package/core/element/FooterElement.js +1 -0
- package/core/element/FooterElement.js.map +1 -0
- package/core/element/FormElement.d.ts +5 -0
- package/core/element/FormElement.js +1 -0
- package/core/element/FormElement.js.map +1 -0
- package/core/element/Fragment.d.ts +32 -0
- package/core/element/Fragment.js +1 -0
- package/core/element/Fragment.js.map +1 -0
- package/core/element/H1Element.d.ts +5 -0
- package/core/element/H1Element.js +1 -0
- package/core/element/H1Element.js.map +1 -0
- package/core/element/H2Element.d.ts +5 -0
- package/core/element/H2Element.js +1 -0
- package/core/element/H2Element.js.map +1 -0
- package/core/element/H3Element.d.ts +5 -0
- package/core/element/H3Element.js +1 -0
- package/core/element/H3Element.js.map +1 -0
- package/core/element/H4Element.d.ts +5 -0
- package/core/element/H4Element.js +1 -0
- package/core/element/H4Element.js.map +1 -0
- package/core/element/H5Element.d.ts +5 -0
- package/core/element/H5Element.js +1 -0
- package/core/element/H5Element.js.map +1 -0
- package/core/element/H6Element.d.ts +5 -0
- package/core/element/H6Element.js +1 -0
- package/core/element/H6Element.js.map +1 -0
- package/core/element/HeadElement.d.ts +5 -0
- package/core/element/HeadElement.js +1 -0
- package/core/element/HeadElement.js.map +1 -0
- package/core/element/HeaderElement.d.ts +5 -0
- package/core/element/HeaderElement.js +1 -0
- package/core/element/HeaderElement.js.map +1 -0
- package/core/element/HorizontalRuleElement.d.ts +5 -0
- package/core/element/HorizontalRuleElement.js +1 -0
- package/core/element/HorizontalRuleElement.js.map +1 -0
- package/core/element/HtmlElement.d.ts +7 -0
- package/core/element/HtmlElement.js +1 -0
- package/core/element/HtmlElement.js.map +1 -0
- package/core/element/IFrameElement.d.ts +15 -0
- package/core/element/IFrameElement.js +1 -0
- package/core/element/IFrameElement.js.map +1 -0
- package/core/element/ILayout.d.ts +5 -0
- package/core/element/ILayout.js +1 -0
- package/core/element/ILayout.js.map +1 -0
- package/core/element/IconElement.d.ts +14 -0
- package/core/element/IconElement.js +1 -0
- package/core/element/IconElement.js.map +1 -0
- package/core/element/IdiomaticElement.d.ts +5 -0
- package/core/element/IdiomaticElement.js +1 -0
- package/core/element/IdiomaticElement.js.map +1 -0
- package/core/element/ImageElement.d.ts +19 -0
- package/core/element/ImageElement.js +1 -0
- package/core/element/ImageElement.js.map +1 -0
- package/core/element/InputElement.d.ts +5 -0
- package/core/element/InputElement.js +1 -0
- package/core/element/InputElement.js.map +1 -0
- package/core/element/LabelElement.d.ts +5 -0
- package/core/element/LabelElement.js +1 -0
- package/core/element/LabelElement.js.map +1 -0
- package/core/element/LegendElement.d.ts +5 -0
- package/core/element/LegendElement.js +1 -0
- package/core/element/LegendElement.js.map +1 -0
- package/core/element/ListItemElement.d.ts +10 -0
- package/core/element/ListItemElement.js +1 -0
- package/core/element/ListItemElement.js.map +1 -0
- package/core/element/MainElement.d.ts +5 -0
- package/core/element/MainElement.js +1 -0
- package/core/element/MainElement.js.map +1 -0
- package/core/element/NavElement.d.ts +5 -0
- package/core/element/NavElement.js +1 -0
- package/core/element/NavElement.js.map +1 -0
- package/core/element/OrderedListElement.d.ts +5 -0
- package/core/element/OrderedListElement.js +1 -0
- package/core/element/OrderedListElement.js.map +1 -0
- package/core/element/ParagraphElement.d.ts +5 -0
- package/core/element/ParagraphElement.js +1 -0
- package/core/element/ParagraphElement.js.map +1 -0
- package/core/element/PreElement.d.ts +5 -0
- package/core/element/PreElement.js +1 -0
- package/core/element/PreElement.js.map +1 -0
- package/core/element/SectionElement.d.ts +5 -0
- package/core/element/SectionElement.js +1 -0
- package/core/element/SectionElement.js.map +1 -0
- package/core/element/SelectElement.d.ts +5 -0
- package/core/element/SelectElement.js +1 -0
- package/core/element/SelectElement.js.map +1 -0
- package/core/element/SourceElement.d.ts +5 -0
- package/core/element/SourceElement.js +1 -0
- package/core/element/SourceElement.js.map +1 -0
- package/core/element/SpanElement.d.ts +5 -0
- package/core/element/SpanElement.js +1 -0
- package/core/element/SpanElement.js.map +1 -0
- package/core/element/StrongElement.d.ts +5 -0
- package/core/element/StrongElement.js +1 -0
- package/core/element/StrongElement.js.map +1 -0
- package/core/element/StyleElement.d.ts +5 -0
- package/core/element/StyleElement.js +1 -0
- package/core/element/StyleElement.js.map +1 -0
- package/core/element/SummaryElement.d.ts +5 -0
- package/core/element/SummaryElement.js +1 -0
- package/core/element/SummaryElement.js.map +1 -0
- package/core/element/SvgElement.d.ts +18 -0
- package/core/element/SvgElement.js +1 -0
- package/core/element/SvgElement.js.map +1 -0
- package/core/element/TableBodyElement.d.ts +5 -0
- package/core/element/TableBodyElement.js +1 -0
- package/core/element/TableBodyElement.js.map +1 -0
- package/core/element/TableCellElement.d.ts +7 -0
- package/core/element/TableCellElement.js +1 -0
- package/core/element/TableCellElement.js.map +1 -0
- package/core/element/TableColElement.d.ts +5 -0
- package/core/element/TableColElement.js +1 -0
- package/core/element/TableColElement.js.map +1 -0
- package/core/element/TableColGroupElement.d.ts +5 -0
- package/core/element/TableColGroupElement.js +1 -0
- package/core/element/TableColGroupElement.js.map +1 -0
- package/core/element/TableElement.d.ts +5 -0
- package/core/element/TableElement.js +1 -0
- package/core/element/TableElement.js.map +1 -0
- package/core/element/TableFootElement.d.ts +5 -0
- package/core/element/TableFootElement.js +1 -0
- package/core/element/TableFootElement.js.map +1 -0
- package/core/element/TableFootRowElement.d.ts +9 -0
- package/core/element/TableFootRowElement.js +1 -0
- package/core/element/TableFootRowElement.js.map +1 -0
- package/core/element/TableHeadCellElement.d.ts +10 -0
- package/core/element/TableHeadCellElement.js +1 -0
- package/core/element/TableHeadCellElement.js.map +1 -0
- package/core/element/TableHeadElement.d.ts +5 -0
- package/core/element/TableHeadElement.js +1 -0
- package/core/element/TableHeadElement.js.map +1 -0
- package/core/element/TableHeadRowElement.d.ts +11 -0
- package/core/element/TableHeadRowElement.js +1 -0
- package/core/element/TableHeadRowElement.js.map +1 -0
- package/core/element/TableRowElement.d.ts +11 -0
- package/core/element/TableRowElement.js +1 -0
- package/core/element/TableRowElement.js.map +1 -0
- package/core/element/TextAreaElement.d.ts +5 -0
- package/core/element/TextAreaElement.js +1 -0
- package/core/element/TextAreaElement.js.map +1 -0
- package/core/element/UListElement.d.ts +5 -0
- package/core/element/UListElement.js +1 -0
- package/core/element/UListElement.js.map +1 -0
- package/core/element/VideoElement.d.ts +5 -0
- package/core/element/VideoElement.js +1 -0
- package/core/element/VideoElement.js.map +1 -0
- package/core/element/index.d.ts +72 -0
- package/core/element/index.js +1 -0
- package/core/element/index.js.map +1 -0
- package/core/event/index.d.ts +16 -0
- package/core/event/index.js +1 -0
- package/core/event/index.js.map +1 -0
- package/core/index.js +1 -0
- package/core/ref/Computed.d.ts +3 -0
- package/core/ref/Computed.js +1 -0
- package/core/ref/Computed.js.map +1 -0
- package/core/ref/RefBoolean.d.ts +91 -0
- package/core/ref/RefBoolean.js +1 -0
- package/core/ref/RefBoolean.js.map +1 -0
- package/core/ref/RefContainer.d.ts +28 -0
- package/core/ref/RefContainer.js +1 -0
- package/core/ref/RefContainer.js.map +1 -0
- package/core/ref/RefList.d.ts +120 -0
- package/core/ref/RefList.js +1 -0
- package/core/ref/RefList.js.map +1 -0
- package/core/ref/RefMap.d.ts +100 -0
- package/core/ref/RefMap.js +1 -0
- package/core/ref/RefMap.js.map +1 -0
- package/core/ref/RefNumber.d.ts +118 -0
- package/core/ref/RefNumber.js +1 -0
- package/core/ref/RefNumber.js.map +1 -0
- package/core/ref/RefObject.d.ts +120 -0
- package/core/ref/RefObject.js +1 -0
- package/core/ref/RefObject.js.map +1 -0
- package/core/ref/RefProperty.d.ts +3 -0
- package/core/ref/RefProperty.js +1 -0
- package/core/ref/RefProperty.js.map +1 -0
- package/core/ref/RefSet.d.ts +99 -0
- package/core/ref/RefSet.js +1 -0
- package/core/ref/RefSet.js.map +1 -0
- package/core/ref/RefState.d.ts +25 -0
- package/core/ref/RefState.js +1 -0
- package/core/ref/RefState.js.map +1 -0
- package/core/ref/RefString.d.ts +148 -0
- package/core/ref/RefString.js +1 -0
- package/core/ref/RefString.js.map +1 -0
- package/core/ref/index.d.ts +23 -0
- package/core/ref/index.js +1 -0
- package/core/ref/index.js.map +1 -0
- package/core/router/RouteView.d.ts +20 -0
- package/core/router/RouteView.js +1 -0
- package/core/router/RouteView.js.map +1 -0
- package/core/router/Router.d.ts +77 -0
- package/core/router/Router.js +1 -0
- package/core/router/Router.js.map +1 -0
- package/core/router/RouterEvent.d.ts +36 -0
- package/core/router/RouterEvent.js +1 -0
- package/core/router/RouterEvent.js.map +1 -0
- package/core/router/RouterGuard.d.ts +12 -0
- package/core/router/RouterGuard.js +1 -0
- package/core/router/RouterGuard.js.map +1 -0
- package/core/router/index.d.ts +4 -0
- package/core/router/index.js +1 -0
- package/core/router/index.js.map +1 -0
- package/core/styles/index.js +1 -0
- package/global/app.d.ts +38 -0
- package/global/app.js +1 -0
- package/global/app.js.map +1 -0
- package/global/index.js +1 -0
- package/global/safari-polyfill.d.ts +0 -0
- package/global/safari-polyfill.js +1 -0
- package/global/safari-polyfill.js.map +1 -0
- package/index.js +1 -0
- package/package.json +6 -31
- package/translation/index.d.ts +0 -0
- package/LICENSE +0 -21
- package/README.md +0 -62
- package/dist/assets/index.js +0 -2
- package/dist/core/index.js +0 -7
- package/dist/core/styles/index.js +0 -28
- package/dist/global/index.js +0 -1351
- package/dist/index.js +0 -3
- /package/{dist/assets → assets}/index.d.ts +0 -0
- /package/{dist/assets → assets}/index.js.map +0 -0
- /package/{dist/core → core}/index.d.ts +0 -0
- /package/{dist/core → core}/index.js.map +0 -0
- /package/{dist/core → core}/styles/index.d.ts +0 -0
- /package/{dist/core → core}/styles/index.js.map +0 -0
- /package/{dist/global → global}/index.d.ts +0 -0
- /package/{dist/global → global}/index.js.map +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.js.map → index.js.map} +0 -0
package/dist/global/index.js
DELETED
|
@@ -1,1351 +0,0 @@
|
|
|
1
|
-
import "./safari-polyfill";
|
|
2
|
-
import { EventComponent } from "../core/event";
|
|
3
|
-
import { computed, InputElement, ref, RefBoolean, RefList, RefMap, RefNumber, RefSet, RefString } from "../";
|
|
4
|
-
function deepCopy(obj, cache = new WeakMap()) {
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
if (obj instanceof ref)
|
|
7
|
-
obj = obj.valueOf();
|
|
8
|
-
if (obj === null || typeof obj !== "object")
|
|
9
|
-
return obj;
|
|
10
|
-
if (cache.has(obj))
|
|
11
|
-
return cache.get(obj);
|
|
12
|
-
if (obj instanceof HTMLElement)
|
|
13
|
-
return obj;
|
|
14
|
-
if (typeof obj === "function")
|
|
15
|
-
return obj;
|
|
16
|
-
if (Object.getPrototypeOf(obj) === null)
|
|
17
|
-
return obj;
|
|
18
|
-
if (Array.isArray(obj)) {
|
|
19
|
-
const arr = obj.map((item) => deepCopy(item, cache));
|
|
20
|
-
cache.set(obj, arr);
|
|
21
|
-
return arr;
|
|
22
|
-
}
|
|
23
|
-
if (obj instanceof Date)
|
|
24
|
-
return new Date(obj);
|
|
25
|
-
if (obj instanceof RegExp)
|
|
26
|
-
return new RegExp(obj);
|
|
27
|
-
if (obj instanceof Map) {
|
|
28
|
-
const map = new Map();
|
|
29
|
-
cache.set(obj, map);
|
|
30
|
-
for (const [k, v] of obj)
|
|
31
|
-
map.set(deepCopy(k, cache), deepCopy(v, cache));
|
|
32
|
-
return map;
|
|
33
|
-
}
|
|
34
|
-
if (obj instanceof Set) {
|
|
35
|
-
const set = new Set();
|
|
36
|
-
cache.set(obj, set);
|
|
37
|
-
for (const v of obj)
|
|
38
|
-
set.add(deepCopy(v, cache));
|
|
39
|
-
return set;
|
|
40
|
-
}
|
|
41
|
-
const clonedObj = Object.create(Object.getPrototypeOf(obj));
|
|
42
|
-
cache.set(obj, clonedObj);
|
|
43
|
-
for (const key of Reflect.ownKeys(obj)) {
|
|
44
|
-
clonedObj[key] = deepCopy(obj[key], cache);
|
|
45
|
-
}
|
|
46
|
-
if (Object.isFrozen(obj))
|
|
47
|
-
Object.freeze(clonedObj);
|
|
48
|
-
else if (Object.isSealed(obj))
|
|
49
|
-
Object.seal(clonedObj);
|
|
50
|
-
return clonedObj;
|
|
51
|
-
}
|
|
52
|
-
globalThis.deepCopy = deepCopy;
|
|
53
|
-
// // safari-polyfill
|
|
54
|
-
// if (/^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent) || /iP(hone|od|ad)/.test(navigator.userAgent)) {
|
|
55
|
-
// const { keys: e } = Object,
|
|
56
|
-
// t = !0,
|
|
57
|
-
// r = !1,
|
|
58
|
-
// n = "querySelectorAll",
|
|
59
|
-
// o = "querySelectorAll",
|
|
60
|
-
// { document: l, Element: s, MutationObserver: a, Set: c, WeakMap: u } = self,
|
|
61
|
-
// /// @ts-ignore
|
|
62
|
-
// i = (e) => o in e,
|
|
63
|
-
// { filter: d } = [];
|
|
64
|
-
// /// @ts-ignore
|
|
65
|
-
// var h = (e) => {
|
|
66
|
-
// const h = new u(),
|
|
67
|
-
// /// @ts-ignore
|
|
68
|
-
// f = (t, r) => {
|
|
69
|
-
// let n;
|
|
70
|
-
// if (r)
|
|
71
|
-
// for (let o, l = ((e) => e.matches || e.webkitMatchesSelector || e.msMatchesSelector)(t), s = 0, { length: a } = p; s < a; s++)
|
|
72
|
-
// l.call(t, (o = p[s])) && (h.has(t) || h.set(t, new c()), (n = h.get(t)), n.has(o) || (n.add(o), e.handle(t, r, o)));
|
|
73
|
-
// else
|
|
74
|
-
// h.has(t) &&
|
|
75
|
-
// ((n = h.get(t)),
|
|
76
|
-
// h.delete(t),
|
|
77
|
-
// /// @ts-ignore
|
|
78
|
-
// n.forEach((n) => {
|
|
79
|
-
// e.handle(t, r, n);
|
|
80
|
-
// }));
|
|
81
|
-
// },
|
|
82
|
-
// /// @ts-ignore
|
|
83
|
-
// g = (e, t = !0) => {
|
|
84
|
-
// for (let r = 0, { length: n } = e; r < n; r++) f(e[r], t);
|
|
85
|
-
// },
|
|
86
|
-
// { query: p } = e,
|
|
87
|
-
// b = e.root || l,
|
|
88
|
-
// y = ((e, o = document, l = MutationObserver, s = ["*"]) => {
|
|
89
|
-
// /// @ts-ignore
|
|
90
|
-
// const a = (r, o, l, s, c, u) => {
|
|
91
|
-
// for (const i of r)
|
|
92
|
-
// (u || n in i) && (c ? l.has(i) || (l.add(i), s.delete(i), e(i, c)) : s.has(i) || (s.add(i), l.delete(i), e(i, c)), u || a(i[n](o), o, l, s, c, t));
|
|
93
|
-
// },
|
|
94
|
-
// c = new l((e) => {
|
|
95
|
-
// if (s.length) {
|
|
96
|
-
// const n = s.join(","),
|
|
97
|
-
// o = new Set(),
|
|
98
|
-
// l = new Set();
|
|
99
|
-
// for (const { addedNodes: s, removedNodes: c } of e) a(c, n, o, l, r, r), a(s, n, o, l, t, r);
|
|
100
|
-
// }
|
|
101
|
-
// }),
|
|
102
|
-
// { observe: u } = c;
|
|
103
|
-
// return (c.observe = (e) => u.call(c, e, { subtree: t, childList: t }))(o), c;
|
|
104
|
-
// })(f, b, a, p),
|
|
105
|
-
// { attachShadow: w } = s.prototype;
|
|
106
|
-
// return (
|
|
107
|
-
// w &&
|
|
108
|
-
// (s.prototype.attachShadow = function (e) {
|
|
109
|
-
// const t = w.call(this, e);
|
|
110
|
-
// return y.observe(t), t;
|
|
111
|
-
// }),
|
|
112
|
-
// p.length && g(b[o](p)),
|
|
113
|
-
// {
|
|
114
|
-
// /// @ts-ignore
|
|
115
|
-
// drop: (e) => {
|
|
116
|
-
// for (let t = 0, { length: r } = e; t < r; t++) h.delete(e[t]);
|
|
117
|
-
// },
|
|
118
|
-
// flush: () => {
|
|
119
|
-
// const e = y.takeRecords();
|
|
120
|
-
// for (let t = 0, { length: r } = e; t < r; t++) g(d.call(e[t].removedNodes, i), !1), g(d.call(e[t].addedNodes, i), !0);
|
|
121
|
-
// },
|
|
122
|
-
// observer: y,
|
|
123
|
-
// parse: g,
|
|
124
|
-
// }
|
|
125
|
-
// );
|
|
126
|
-
// };
|
|
127
|
-
// const { customElements: f, document: g, Element: p, MutationObserver: b, Object: y, Promise: w, Map: m, Set: S, WeakMap: v, Reflect: A } = self,
|
|
128
|
-
// { createElement: E } = g,
|
|
129
|
-
// { define: M, get: O, upgrade: q } = f,
|
|
130
|
-
// { construct: k } = A || {
|
|
131
|
-
// /// @ts-ignore
|
|
132
|
-
// construct(e) {
|
|
133
|
-
// return e.call(this);
|
|
134
|
-
// },
|
|
135
|
-
// },
|
|
136
|
-
// { defineProperty: N, getOwnPropertyNames: $, setPrototypeOf: P } = y,
|
|
137
|
-
// C = new v(),
|
|
138
|
-
// j = new S(),
|
|
139
|
-
// V = new m(),
|
|
140
|
-
// L = new m(),
|
|
141
|
-
// R = new m(),
|
|
142
|
-
// T = new m(),
|
|
143
|
-
// /// @ts-ignore
|
|
144
|
-
// W = [],
|
|
145
|
-
// /// @ts-ignore
|
|
146
|
-
// _ = [],
|
|
147
|
-
// /// @ts-ignore
|
|
148
|
-
// x = (e) => T.get(e) || O.call(f, e),
|
|
149
|
-
// { parse: D } = h({
|
|
150
|
-
// /// @ts-ignore
|
|
151
|
-
// query: _,
|
|
152
|
-
// /// @ts-ignore
|
|
153
|
-
// handle: (t, r, n) => {
|
|
154
|
-
// const o = R.get(n);
|
|
155
|
-
// if (r && !o.isPrototypeOf(t)) {
|
|
156
|
-
// const r = ((t) => {
|
|
157
|
-
// const r = e(t),
|
|
158
|
-
// /// @ts-ignore
|
|
159
|
-
// n = [],
|
|
160
|
-
// o = new Set(),
|
|
161
|
-
// { length: l } = r;
|
|
162
|
-
// for (let e = 0; e < l; e++) {
|
|
163
|
-
// n[e] = t[r[e]];
|
|
164
|
-
// try {
|
|
165
|
-
// delete t[r[e]];
|
|
166
|
-
// } catch (t) {
|
|
167
|
-
// o.add(e);
|
|
168
|
-
// }
|
|
169
|
-
// }
|
|
170
|
-
// return () => {
|
|
171
|
-
// /// @ts-ignore
|
|
172
|
-
// for (let e = 0; e < l; e++) o.has(e) || (t[r[e]] = n[e]);
|
|
173
|
-
// };
|
|
174
|
-
// })(t);
|
|
175
|
-
// B = P(t, o);
|
|
176
|
-
// try {
|
|
177
|
-
// new o.constructor();
|
|
178
|
-
// } finally {
|
|
179
|
-
// (B = null), r();
|
|
180
|
-
// }
|
|
181
|
-
// }
|
|
182
|
-
// const l = (r ? "" : "dis") + "connectedCallback";
|
|
183
|
-
// l in o && t[l]();
|
|
184
|
-
// },
|
|
185
|
-
// }),
|
|
186
|
-
// { parse: F } = h({
|
|
187
|
-
// /// @ts-ignore
|
|
188
|
-
// query: W,
|
|
189
|
-
// /// @ts-ignore
|
|
190
|
-
// handle(e, t) {
|
|
191
|
-
// /// @ts-ignore
|
|
192
|
-
// C.has(e) && (t ? j.add(e) : j.delete(e), _.length && G.call(_, e));
|
|
193
|
-
// },
|
|
194
|
-
// }),
|
|
195
|
-
// { attachShadow: H } = p.prototype;
|
|
196
|
-
// H &&
|
|
197
|
-
// (p.prototype.attachShadow = function (e) {
|
|
198
|
-
// const t = H.call(this, e);
|
|
199
|
-
// return C.set(this, t), t;
|
|
200
|
-
// });
|
|
201
|
-
// /// @ts-ignore
|
|
202
|
-
// const I = (e) => {
|
|
203
|
-
// if (!L.has(e)) {
|
|
204
|
-
// let t,
|
|
205
|
-
// r = new w((e) => {
|
|
206
|
-
// t = e;
|
|
207
|
-
// });
|
|
208
|
-
// L.set(e, { $: r, _: t });
|
|
209
|
-
// }
|
|
210
|
-
// return L.get(e).$;
|
|
211
|
-
// },
|
|
212
|
-
// z = ((e, t) => {
|
|
213
|
-
// /// @ts-ignore
|
|
214
|
-
// const r = (e) => {
|
|
215
|
-
// for (let t = 0, { length: r } = e; t < r; t++) n(e[t]);
|
|
216
|
-
// },
|
|
217
|
-
// /// @ts-ignore
|
|
218
|
-
// n = ({ target: e, attributeName: t, oldValue: r }) => {
|
|
219
|
-
// e.attributeChangedCallback(t, r, e.getAttribute(t));
|
|
220
|
-
// };
|
|
221
|
-
// /// @ts-ignore
|
|
222
|
-
// return (o, l) => {
|
|
223
|
-
// const { observedAttributes: s } = o.constructor;
|
|
224
|
-
// return (
|
|
225
|
-
// s &&
|
|
226
|
-
// e(l).then(() => {
|
|
227
|
-
// new t(r).observe(o, {
|
|
228
|
-
// attributes: !0,
|
|
229
|
-
// attributeOldValue: !0,
|
|
230
|
-
// attributeFilter: s,
|
|
231
|
-
// });
|
|
232
|
-
// for (let e = 0, { length: t } = s; e < t; e++) o.hasAttribute(s[e]) && n({ target: o, attributeName: s[e], oldValue: null });
|
|
233
|
-
// }),
|
|
234
|
-
// o
|
|
235
|
-
// );
|
|
236
|
-
// };
|
|
237
|
-
// })(I, b);
|
|
238
|
-
// /// @ts-ignore
|
|
239
|
-
// let B = null;
|
|
240
|
-
// /// @ts-ignore
|
|
241
|
-
// function G(e) {
|
|
242
|
-
// const t = C.get(e);
|
|
243
|
-
// /// @ts-ignore
|
|
244
|
-
// D(t.querySelectorAll(this), e.isConnected);
|
|
245
|
-
// }
|
|
246
|
-
// $(self)
|
|
247
|
-
// .filter((e) => /^HTML.*Element$/.test(e))
|
|
248
|
-
// .forEach((e) => {
|
|
249
|
-
// /// @ts-ignore
|
|
250
|
-
// const t = self[e];
|
|
251
|
-
// function r() {
|
|
252
|
-
// /// @ts-ignore
|
|
253
|
-
// const { constructor: e } = this;
|
|
254
|
-
// if (!V.has(e)) throw new TypeError("Illegal constructor");
|
|
255
|
-
// const { is: r, tag: n } = V.get(e);
|
|
256
|
-
// if (r) {
|
|
257
|
-
// /// @ts-ignore
|
|
258
|
-
// if (B) return z(B, r);
|
|
259
|
-
// const t = E.call(g, n);
|
|
260
|
-
// return t.setAttribute("is", r), z(P(t, e.prototype), r);
|
|
261
|
-
// }
|
|
262
|
-
// /// @ts-ignore
|
|
263
|
-
// return k.call(this, t, [], e);
|
|
264
|
-
// }
|
|
265
|
-
// P(r, t), N((r.prototype = t.prototype), "constructor", { value: r }), N(self, e, { value: r });
|
|
266
|
-
// }),
|
|
267
|
-
// /// @ts-ignore
|
|
268
|
-
// (g.createElement = function (e, t) {
|
|
269
|
-
// const r = t && t.is;
|
|
270
|
-
// if (r) {
|
|
271
|
-
// const t = T.get(r);
|
|
272
|
-
// if (t && V.get(t).tag === e) return new t();
|
|
273
|
-
// }
|
|
274
|
-
// const n = E.call(g, e);
|
|
275
|
-
// return r && n.setAttribute("is", r), n;
|
|
276
|
-
// }),
|
|
277
|
-
// (f.get = x),
|
|
278
|
-
// (f.whenDefined = I),
|
|
279
|
-
// (f.upgrade = function (e) {
|
|
280
|
-
// /// @ts-ignore
|
|
281
|
-
// const t = e.getAttribute("is");
|
|
282
|
-
// if (t) {
|
|
283
|
-
// const r = T.get(t);
|
|
284
|
-
// if (r) return void z(P(e, r.prototype), t);
|
|
285
|
-
// }
|
|
286
|
-
// q.call(f, e);
|
|
287
|
-
// }),
|
|
288
|
-
// (f.define = function (e, t, r) {
|
|
289
|
-
// if (x(e)) throw new Error(`'${e}' has already been defined as a custom element`);
|
|
290
|
-
// /// @ts-ignore
|
|
291
|
-
// let n;
|
|
292
|
-
// const o = r && r.extends;
|
|
293
|
-
// V.set(t, o ? { is: e, tag: o } : { is: "", tag: e }),
|
|
294
|
-
// o
|
|
295
|
-
// ? ((n = `${o}[is="${e}"]`), R.set(n, t.prototype), T.set(e, t), _.push(n))
|
|
296
|
-
// : /// @ts-ignore
|
|
297
|
-
// (M.apply(f, arguments), W.push((n = e))),
|
|
298
|
-
// I(e).then(() => {
|
|
299
|
-
// o
|
|
300
|
-
// ? /// @ts-ignore
|
|
301
|
-
// (D(g.querySelectorAll(n)), j.forEach(G, [n]))
|
|
302
|
-
// : /// @ts-ignore
|
|
303
|
-
// F(g.querySelectorAll(n));
|
|
304
|
-
// }),
|
|
305
|
-
// L.get(e)._(t);
|
|
306
|
-
// });
|
|
307
|
-
// }
|
|
308
|
-
const styleRef = Symbol("styleRef");
|
|
309
|
-
const variantAll = Symbol("variantAll");
|
|
310
|
-
const variants = new Map();
|
|
311
|
-
const mergeVariants = new Map();
|
|
312
|
-
Object.defineProperty(Element.prototype, "extendedStyle", {
|
|
313
|
-
get: function () {
|
|
314
|
-
const el = this;
|
|
315
|
-
return {
|
|
316
|
-
add(tag) {
|
|
317
|
-
const tags = (el.getAttribute("tc-style") || "").split(/\s+/).filter(Boolean);
|
|
318
|
-
if (!tags.includes(tag)) {
|
|
319
|
-
tags.push(tag);
|
|
320
|
-
el.setAttribute("tc-style", tags.join(" "));
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
remove(tag) {
|
|
324
|
-
const tags = (el.getAttribute("tc-style") || "").split(/\s+/).filter(Boolean);
|
|
325
|
-
const i = tags.indexOf(tag);
|
|
326
|
-
if (i !== -1) {
|
|
327
|
-
tags.splice(i, 1);
|
|
328
|
-
el.setAttribute("tc-style", tags.join(" "));
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
has(tag) {
|
|
332
|
-
return (el.getAttribute("tc-style") || "").split(/\s+/).filter(Boolean).includes(tag);
|
|
333
|
-
},
|
|
334
|
-
toggle(tag) {
|
|
335
|
-
this.has(tag) ? this.remove(tag) : this.add(tag);
|
|
336
|
-
},
|
|
337
|
-
clear() {
|
|
338
|
-
el.removeAttribute("tc-style");
|
|
339
|
-
},
|
|
340
|
-
toString() {
|
|
341
|
-
return el.getAttribute("tc-style") || "";
|
|
342
|
-
},
|
|
343
|
-
getReferences() {
|
|
344
|
-
return (el.getAttribute("tc-style") || "")
|
|
345
|
-
.split(/\s+/)
|
|
346
|
-
.filter(Boolean)
|
|
347
|
-
.map((tag) => customElements.get(tag))
|
|
348
|
-
.filter(Boolean);
|
|
349
|
-
},
|
|
350
|
-
};
|
|
351
|
-
},
|
|
352
|
-
configurable: true,
|
|
353
|
-
});
|
|
354
|
-
const TypeComposer = {
|
|
355
|
-
defineElement(name, constructor, options) {
|
|
356
|
-
Component.mergeVariant(constructor, Object.getPrototypeOf(constructor.prototype).constructor);
|
|
357
|
-
customElements.define(name, constructor, options);
|
|
358
|
-
},
|
|
359
|
-
createElement: (tag, props, ...children) => {
|
|
360
|
-
const isComponent = tag?.prototype instanceof HTMLElement;
|
|
361
|
-
if (typeof tag === "string" || isComponent) {
|
|
362
|
-
if (tag === "fragment") {
|
|
363
|
-
const fragment = document.createDocumentFragment();
|
|
364
|
-
for (const child of children) {
|
|
365
|
-
if (Array.isArray(child)) {
|
|
366
|
-
fragment.append(...child);
|
|
367
|
-
}
|
|
368
|
-
else if (child instanceof Node) {
|
|
369
|
-
fragment.append(child);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
return fragment;
|
|
373
|
-
}
|
|
374
|
-
const key = props?.key;
|
|
375
|
-
const isValideKey = key && typeof key === "object" && key["controller"] && key["controller"]["getCache"] && key["controller"]["setCache"];
|
|
376
|
-
if (isValideKey) {
|
|
377
|
-
const cacheElement = key.controller.getCache(key.key);
|
|
378
|
-
if (cacheElement)
|
|
379
|
-
return cacheElement;
|
|
380
|
-
}
|
|
381
|
-
const onInit = props?.onInit;
|
|
382
|
-
const style = props?.style;
|
|
383
|
-
const refKey = props?.ref;
|
|
384
|
-
const className = props?.className || props?.class;
|
|
385
|
-
delete props?.className;
|
|
386
|
-
delete props?.class;
|
|
387
|
-
delete props?.onInit;
|
|
388
|
-
delete props?.ref;
|
|
389
|
-
delete props?.key;
|
|
390
|
-
if (style)
|
|
391
|
-
props.style = {};
|
|
392
|
-
const ElementType = props || {};
|
|
393
|
-
const el = isComponent ? new tag(ElementType) : document.createElement(tag);
|
|
394
|
-
if (isValideKey)
|
|
395
|
-
key.controller.setCache(key.key, el);
|
|
396
|
-
if (style)
|
|
397
|
-
el.setStyle(style);
|
|
398
|
-
if (className)
|
|
399
|
-
el.addClassName(className);
|
|
400
|
-
if (refKey)
|
|
401
|
-
refKey(el);
|
|
402
|
-
Component.applyProps(el, ElementType);
|
|
403
|
-
const appendChild = (parent, child) => {
|
|
404
|
-
if (child instanceof ref) {
|
|
405
|
-
// @ts-ignore
|
|
406
|
-
parent.append(child);
|
|
407
|
-
}
|
|
408
|
-
else if (Array.isArray(child)) {
|
|
409
|
-
child.forEach((c) => appendChild(parent, c));
|
|
410
|
-
}
|
|
411
|
-
else if (child instanceof Node) {
|
|
412
|
-
parent.appendChild(child);
|
|
413
|
-
}
|
|
414
|
-
else if (child !== null && child !== undefined) {
|
|
415
|
-
parent.appendChild(document.createTextNode(child.toString()));
|
|
416
|
-
}
|
|
417
|
-
};
|
|
418
|
-
children.forEach((c) => appendChild(el, c));
|
|
419
|
-
if (onInit)
|
|
420
|
-
onInit();
|
|
421
|
-
return el;
|
|
422
|
-
}
|
|
423
|
-
return tag({ ...props, children });
|
|
424
|
-
},
|
|
425
|
-
createFragment: (...children) => {
|
|
426
|
-
const fragment = document.createDocumentFragment();
|
|
427
|
-
fragment.append(...children);
|
|
428
|
-
return fragment;
|
|
429
|
-
},
|
|
430
|
-
deepCopy: deepCopy,
|
|
431
|
-
computed: computed,
|
|
432
|
-
Fragment: "fragment",
|
|
433
|
-
};
|
|
434
|
-
globalThis.TypeComposer = TypeComposer;
|
|
435
|
-
export const componentProps = Symbol("componentProps");
|
|
436
|
-
// const componentStyle = Symbol("componentStyle");
|
|
437
|
-
export class Component extends HTMLElement {
|
|
438
|
-
static TAG = "tc-component";
|
|
439
|
-
constructor(props) {
|
|
440
|
-
super();
|
|
441
|
-
Component.initComponent(this, Component, props);
|
|
442
|
-
}
|
|
443
|
-
static async applyProps(element, props, ignoreStyle = false) {
|
|
444
|
-
const hasProxy = Object.hasOwn(element.style, "styleRef");
|
|
445
|
-
if (!hasProxy) {
|
|
446
|
-
const style = element.style;
|
|
447
|
-
// @ts-ignore
|
|
448
|
-
style["styleRef"] = styleRef;
|
|
449
|
-
const customStyle = new Proxy(style, {
|
|
450
|
-
get(target, property) {
|
|
451
|
-
const value = Reflect.get(target, property);
|
|
452
|
-
return typeof value === "function" ? value.bind(target) : value;
|
|
453
|
-
},
|
|
454
|
-
set(target, property, value) {
|
|
455
|
-
if (value instanceof ref) {
|
|
456
|
-
// @ts-ignore
|
|
457
|
-
value.subscribe(target, property);
|
|
458
|
-
}
|
|
459
|
-
else {
|
|
460
|
-
// @ts-ignore
|
|
461
|
-
Reflect.set(target, property, value);
|
|
462
|
-
}
|
|
463
|
-
return true;
|
|
464
|
-
},
|
|
465
|
-
});
|
|
466
|
-
Object.defineProperty(element, "style", {
|
|
467
|
-
get: () => customStyle,
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
if (props) {
|
|
471
|
-
// @ts-ignore
|
|
472
|
-
// const isStyle = props?.style !== undefined;
|
|
473
|
-
for (const [key, propValue] of Object.entries(props)) {
|
|
474
|
-
if (propValue === undefined || propValue === null)
|
|
475
|
-
continue;
|
|
476
|
-
switch (key) {
|
|
477
|
-
case "key":
|
|
478
|
-
element.key = propValue;
|
|
479
|
-
break;
|
|
480
|
-
case "onInit":
|
|
481
|
-
if (typeof propValue === "function") {
|
|
482
|
-
element.onInit = () => propValue();
|
|
483
|
-
}
|
|
484
|
-
break;
|
|
485
|
-
case "style":
|
|
486
|
-
element.setStyle(propValue);
|
|
487
|
-
break;
|
|
488
|
-
case "itemLoading":
|
|
489
|
-
element.setAttribute("item-loading", propValue);
|
|
490
|
-
break;
|
|
491
|
-
case "children":
|
|
492
|
-
if (Array.isArray(propValue))
|
|
493
|
-
element.append(...propValue);
|
|
494
|
-
else
|
|
495
|
-
element.append(propValue);
|
|
496
|
-
break;
|
|
497
|
-
case "for":
|
|
498
|
-
element.setAttribute("for", propValue);
|
|
499
|
-
break;
|
|
500
|
-
case "className":
|
|
501
|
-
element.addClassName(propValue);
|
|
502
|
-
break;
|
|
503
|
-
case "text":
|
|
504
|
-
element.innerText = propValue;
|
|
505
|
-
break;
|
|
506
|
-
case "html":
|
|
507
|
-
element.innerHTML = propValue;
|
|
508
|
-
break;
|
|
509
|
-
case "style":
|
|
510
|
-
for (const [styleKey, styleValue] of Object.entries(propValue)) {
|
|
511
|
-
element.style[styleKey] = styleValue;
|
|
512
|
-
}
|
|
513
|
-
break;
|
|
514
|
-
default:
|
|
515
|
-
if (key in element && propValue) {
|
|
516
|
-
try {
|
|
517
|
-
element[key] = propValue;
|
|
518
|
-
if (propValue === undefined)
|
|
519
|
-
element.removeAttribute(key);
|
|
520
|
-
}
|
|
521
|
-
catch { }
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
static initComponent(thisObj, constructorObj, props) {
|
|
528
|
-
if (thisObj.constructor === constructorObj) {
|
|
529
|
-
Component.applyProps(thisObj, thisObj[componentProps] || props);
|
|
530
|
-
if (thisObj?.template && typeof thisObj.template === "function") {
|
|
531
|
-
const templateResult = thisObj.template();
|
|
532
|
-
if (templateResult) {
|
|
533
|
-
thisObj.append(templateResult);
|
|
534
|
-
}
|
|
535
|
-
}
|
|
536
|
-
thisObj?.onInit();
|
|
537
|
-
if (thisObj[componentProps])
|
|
538
|
-
delete thisObj[componentProps];
|
|
539
|
-
return;
|
|
540
|
-
}
|
|
541
|
-
else if (props) {
|
|
542
|
-
thisObj[componentProps] = props;
|
|
543
|
-
}
|
|
544
|
-
Component.applyProps(thisObj, props);
|
|
545
|
-
}
|
|
546
|
-
static createElement(html) {
|
|
547
|
-
const element = document.createElement("div");
|
|
548
|
-
element.innerHTML = html;
|
|
549
|
-
return (element?.children[0] || element);
|
|
550
|
-
}
|
|
551
|
-
static setVariant(element, variant, apply) {
|
|
552
|
-
if (!variants.has(element)) {
|
|
553
|
-
variants.set(element, new Map());
|
|
554
|
-
}
|
|
555
|
-
const map = variants.get(element);
|
|
556
|
-
if (map) {
|
|
557
|
-
map.set(variant, apply);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
static getVariant(element, variant) {
|
|
561
|
-
const map = variants.get(element);
|
|
562
|
-
let action = undefined;
|
|
563
|
-
if (map) {
|
|
564
|
-
action = map.get(variant);
|
|
565
|
-
}
|
|
566
|
-
if (!action) {
|
|
567
|
-
const v = mergeVariants.get(element);
|
|
568
|
-
if (!v)
|
|
569
|
-
return action;
|
|
570
|
-
const varia = v.get(variant) || v.get(variantAll);
|
|
571
|
-
if (varia)
|
|
572
|
-
return Component.getVariant(varia, variant);
|
|
573
|
-
}
|
|
574
|
-
return action;
|
|
575
|
-
}
|
|
576
|
-
static getVariants(element) {
|
|
577
|
-
const map = variants.get(element);
|
|
578
|
-
if (!map)
|
|
579
|
-
return [];
|
|
580
|
-
return Array.from(map.keys());
|
|
581
|
-
}
|
|
582
|
-
static removeVariant(element, variant) {
|
|
583
|
-
const map = variants.get(element);
|
|
584
|
-
if (map) {
|
|
585
|
-
map.delete(variant);
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
static mergeVariant(element, src, ...variant) {
|
|
589
|
-
if (!mergeVariants.has(element)) {
|
|
590
|
-
mergeVariants.set(element, new Map());
|
|
591
|
-
}
|
|
592
|
-
const map = mergeVariants.get(element);
|
|
593
|
-
if (map) {
|
|
594
|
-
if (variant && variant.length) {
|
|
595
|
-
for (const v of variant)
|
|
596
|
-
map.set(v, src);
|
|
597
|
-
}
|
|
598
|
-
else
|
|
599
|
-
map.set(variantAll, src);
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
static lazyLoad(source, options) {
|
|
603
|
-
const component = new (options?.component || Component)();
|
|
604
|
-
source().then((module) => {
|
|
605
|
-
// @ts-ignore
|
|
606
|
-
const TestLazy = module.default;
|
|
607
|
-
const parent = component.parentElement;
|
|
608
|
-
if (parent) {
|
|
609
|
-
parent.replaceChild(new TestLazy(options?.props), component);
|
|
610
|
-
}
|
|
611
|
-
});
|
|
612
|
-
return component;
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
globalThis.Component = Component;
|
|
616
|
-
TypeComposer.defineElement(Component.TAG, Component);
|
|
617
|
-
const isValideRef = (value) => value &&
|
|
618
|
-
typeof value === "object" &&
|
|
619
|
-
(value instanceof RefString ||
|
|
620
|
-
value instanceof RefNumber ||
|
|
621
|
-
value instanceof RefBoolean ||
|
|
622
|
-
value instanceof RefList ||
|
|
623
|
-
value instanceof RefMap ||
|
|
624
|
-
value instanceof RefSet);
|
|
625
|
-
const consolecheck = (callback, message, ...optionalParams) => {
|
|
626
|
-
if (isValideRef(message))
|
|
627
|
-
message = message.valueOf();
|
|
628
|
-
for (let i = 0; i < optionalParams.length; i++) {
|
|
629
|
-
if (isValideRef(optionalParams[i])) {
|
|
630
|
-
optionalParams[i] = optionalParams[i].valueOf();
|
|
631
|
-
}
|
|
632
|
-
}
|
|
633
|
-
callback(message, ...optionalParams);
|
|
634
|
-
};
|
|
635
|
-
const originalConsoleLog = console.log;
|
|
636
|
-
console.log = function (message, ...optionalParams) {
|
|
637
|
-
consolecheck(originalConsoleLog, message, ...optionalParams);
|
|
638
|
-
};
|
|
639
|
-
const originalConsoleError = console.error;
|
|
640
|
-
console.error = function (message, ...optionalParams) {
|
|
641
|
-
consolecheck(originalConsoleError, message, ...optionalParams);
|
|
642
|
-
};
|
|
643
|
-
const originalConsoleWarn = console.warn;
|
|
644
|
-
console.warn = function (message, ...optionalParams) {
|
|
645
|
-
consolecheck(originalConsoleWarn, message, ...optionalParams);
|
|
646
|
-
};
|
|
647
|
-
const originalConsoleInfo = console.info;
|
|
648
|
-
console.info = function (message, ...optionalParams) {
|
|
649
|
-
consolecheck(originalConsoleInfo, message, ...optionalParams);
|
|
650
|
-
};
|
|
651
|
-
// function deepCopy<T>(obj: T, cache = new WeakMap()): T {
|
|
652
|
-
// if (obj instanceof ref) {
|
|
653
|
-
// // @ts-ignore
|
|
654
|
-
// obj = obj.valueOf();
|
|
655
|
-
// }
|
|
656
|
-
// if (obj === null || typeof obj !== "object")
|
|
657
|
-
// return obj;
|
|
658
|
-
// if (cache.has(obj))
|
|
659
|
-
// return cache.get(obj);
|
|
660
|
-
// if (obj instanceof HTMLElement)
|
|
661
|
-
// return obj;
|
|
662
|
-
// if (Array.isArray(obj)) {
|
|
663
|
-
// const clonedArray = obj.map((item) => deepCopy(item, cache)) as unknown as T;
|
|
664
|
-
// cache.set(obj, clonedArray);
|
|
665
|
-
// return clonedArray;
|
|
666
|
-
// }
|
|
667
|
-
// if (obj instanceof Date)
|
|
668
|
-
// return new Date(obj) as unknown as T;
|
|
669
|
-
// if (obj instanceof RegExp)
|
|
670
|
-
// return new RegExp(obj) as unknown as T;
|
|
671
|
-
// if (obj instanceof Map) {
|
|
672
|
-
// const clonedMap = new Map();
|
|
673
|
-
// cache.set(obj, clonedMap);
|
|
674
|
-
// for (const [key, value] of obj) {
|
|
675
|
-
// clonedMap.set(deepCopy(key, cache), deepCopy(value, cache));
|
|
676
|
-
// }
|
|
677
|
-
// return clonedMap as unknown as T;
|
|
678
|
-
// }
|
|
679
|
-
// if (obj instanceof Set) {
|
|
680
|
-
// const clonedSet = new Set();
|
|
681
|
-
// cache.set(obj, clonedSet);
|
|
682
|
-
// for (const value of obj) {
|
|
683
|
-
// clonedSet.add(deepCopy(value, cache));
|
|
684
|
-
// }
|
|
685
|
-
// return clonedSet as unknown as T;
|
|
686
|
-
// }
|
|
687
|
-
// if (typeof obj === "function") {
|
|
688
|
-
// return obj;
|
|
689
|
-
// }
|
|
690
|
-
// if (typeof obj === "object" && Object.getPrototypeOf(obj) === null) {
|
|
691
|
-
// return obj;
|
|
692
|
-
// }
|
|
693
|
-
// const clonedObj = Object.create(Object.getPrototypeOf(obj));
|
|
694
|
-
// cache.set(obj, clonedObj);
|
|
695
|
-
// for (const key of [...Object.keys(obj), ...Object.getOwnPropertySymbols(obj)]) {
|
|
696
|
-
// (clonedObj as any)[key] = deepCopy((obj as any)[key], cache);
|
|
697
|
-
// }
|
|
698
|
-
// if (Object.isFrozen(obj)) Object.freeze(clonedObj);
|
|
699
|
-
// if (Object.isSealed(obj)) Object.seal(clonedObj);
|
|
700
|
-
// return clonedObj as T;
|
|
701
|
-
// }
|
|
702
|
-
WeakRef.prototype.equals = function (value) {
|
|
703
|
-
return this.deref() === value.deref();
|
|
704
|
-
};
|
|
705
|
-
Object.defineProperty(Element.prototype, "onInit", {
|
|
706
|
-
value: function () { },
|
|
707
|
-
writable: true,
|
|
708
|
-
configurable: true,
|
|
709
|
-
enumerable: true,
|
|
710
|
-
});
|
|
711
|
-
Object.defineProperty(Element.prototype, "getElementById", {
|
|
712
|
-
value: function (id) {
|
|
713
|
-
return this.querySelector(`#${id}`);
|
|
714
|
-
},
|
|
715
|
-
writable: true,
|
|
716
|
-
configurable: true,
|
|
717
|
-
enumerable: true,
|
|
718
|
-
});
|
|
719
|
-
function basePrototypeRefInjection(prototype) {
|
|
720
|
-
Object.defineProperty(prototype, "value", {
|
|
721
|
-
get: function () {
|
|
722
|
-
return this.valueOf();
|
|
723
|
-
},
|
|
724
|
-
set: function (value) {
|
|
725
|
-
this.valueOf(value);
|
|
726
|
-
},
|
|
727
|
-
});
|
|
728
|
-
Object.defineProperty(prototype, "subscribe", {
|
|
729
|
-
value: function (target) {
|
|
730
|
-
return undefined;
|
|
731
|
-
},
|
|
732
|
-
});
|
|
733
|
-
Object.defineProperty(prototype, "unsubscribe", {
|
|
734
|
-
value: function (target) {
|
|
735
|
-
return undefined;
|
|
736
|
-
},
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
basePrototypeRefInjection(String.prototype);
|
|
740
|
-
basePrototypeRefInjection(Number.prototype);
|
|
741
|
-
basePrototypeRefInjection(Boolean.prototype);
|
|
742
|
-
basePrototypeRefInjection(Array.prototype);
|
|
743
|
-
basePrototypeRefInjection(Map.prototype);
|
|
744
|
-
basePrototypeRefInjection(Set.prototype);
|
|
745
|
-
function componentInjectionValue(prototype) {
|
|
746
|
-
const original = Object.getOwnPropertyDescriptor(prototype, "value");
|
|
747
|
-
if (!original)
|
|
748
|
-
return;
|
|
749
|
-
Object.defineProperty(prototype, "value", {
|
|
750
|
-
set: function (value) {
|
|
751
|
-
if (value instanceof ref) {
|
|
752
|
-
// @ts-ignore
|
|
753
|
-
const onInput = () => (value.value = this.value);
|
|
754
|
-
this.addEventListener("input", onInput);
|
|
755
|
-
value.subscribe(this, "value", () => this.removeEventListener("input", onInput));
|
|
756
|
-
}
|
|
757
|
-
else {
|
|
758
|
-
original.set.call(this, value);
|
|
759
|
-
}
|
|
760
|
-
},
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
function componentInjectionChecked(prototype) {
|
|
764
|
-
const original = Object.getOwnPropertyDescriptor(prototype, "checked");
|
|
765
|
-
if (!original)
|
|
766
|
-
return;
|
|
767
|
-
Object.defineProperty(prototype, "checked", {
|
|
768
|
-
set: function (value) {
|
|
769
|
-
if (value instanceof ref) {
|
|
770
|
-
const onInput = () => (value.value = this.checked);
|
|
771
|
-
this.addEventListener("input", onInput);
|
|
772
|
-
this.subscribe(this, "checked", () => this.removeEventListener("input", onInput));
|
|
773
|
-
}
|
|
774
|
-
else {
|
|
775
|
-
original.set.call(this, value);
|
|
776
|
-
}
|
|
777
|
-
},
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
function componentInjectionDisabled(prototype) {
|
|
781
|
-
Object.defineProperty(prototype, "disabled", {
|
|
782
|
-
get: function () {
|
|
783
|
-
return this.hasAttribute("disabled");
|
|
784
|
-
},
|
|
785
|
-
set: function (value) {
|
|
786
|
-
if (value instanceof ref)
|
|
787
|
-
value.subscribe(this, "disabled");
|
|
788
|
-
else {
|
|
789
|
-
if (value)
|
|
790
|
-
this.setAttribute("disabled", "");
|
|
791
|
-
else
|
|
792
|
-
this.removeAttribute("disabled");
|
|
793
|
-
}
|
|
794
|
-
},
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
function componentInjectionHidden(prototype) {
|
|
798
|
-
Object.defineProperty(prototype, "hidden", {
|
|
799
|
-
get: function () {
|
|
800
|
-
return this.hasAttribute("hidden");
|
|
801
|
-
},
|
|
802
|
-
set: function (value) {
|
|
803
|
-
if (value instanceof ref)
|
|
804
|
-
value.subscribe(this, "hidden");
|
|
805
|
-
else {
|
|
806
|
-
if (value)
|
|
807
|
-
this.setAttribute("hidden", "");
|
|
808
|
-
else
|
|
809
|
-
this.removeAttribute("hidden");
|
|
810
|
-
}
|
|
811
|
-
},
|
|
812
|
-
});
|
|
813
|
-
}
|
|
814
|
-
function isWritable(descriptor) {
|
|
815
|
-
if (!descriptor || typeof descriptor?.value == "function") {
|
|
816
|
-
return false;
|
|
817
|
-
}
|
|
818
|
-
if ("value" in descriptor) {
|
|
819
|
-
return !!descriptor.writable;
|
|
820
|
-
}
|
|
821
|
-
if ("get" in descriptor || "set" in descriptor) {
|
|
822
|
-
return typeof descriptor.set === "function";
|
|
823
|
-
}
|
|
824
|
-
return false;
|
|
825
|
-
}
|
|
826
|
-
function componentInjectionVariableController(prototype, propertyName) {
|
|
827
|
-
const original = getOwnPropertyDescriptor(prototype, propertyName);
|
|
828
|
-
if (!isWritable(original))
|
|
829
|
-
return;
|
|
830
|
-
Object.defineProperty(prototype, propertyName, {
|
|
831
|
-
set: function (value) {
|
|
832
|
-
if (value instanceof ref) {
|
|
833
|
-
value.subscribe(this, propertyName?.toString());
|
|
834
|
-
}
|
|
835
|
-
else
|
|
836
|
-
original.set.call(this, value?.valueOf());
|
|
837
|
-
},
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
function getOwnPropertyDescriptor(prototype, propertName) {
|
|
841
|
-
if (prototype == null)
|
|
842
|
-
return undefined;
|
|
843
|
-
const d = Object.getOwnPropertyDescriptor(prototype, propertName) || getOwnPropertyDescriptor(Object.getPrototypeOf(prototype), propertName);
|
|
844
|
-
return d;
|
|
845
|
-
}
|
|
846
|
-
function componentInjectionController(prototype, propertNames) {
|
|
847
|
-
if (propertNames == undefined)
|
|
848
|
-
propertNames = Object.getOwnPropertyNames(prototype);
|
|
849
|
-
if (!propertNames.includes("disabled"))
|
|
850
|
-
componentInjectionDisabled(prototype);
|
|
851
|
-
if (!propertNames.includes("hidden"))
|
|
852
|
-
componentInjectionHidden(prototype);
|
|
853
|
-
for (const propertName of propertNames) {
|
|
854
|
-
if (propertName == "value")
|
|
855
|
-
componentInjectionValue(prototype);
|
|
856
|
-
else if (propertName == "checked")
|
|
857
|
-
componentInjectionChecked(prototype);
|
|
858
|
-
else
|
|
859
|
-
componentInjectionVariableController(prototype, propertName);
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
componentInjectionController(Element.prototype);
|
|
863
|
-
componentInjectionController(HTMLElement.prototype);
|
|
864
|
-
componentInjectionController(HTMLButtonElement.prototype);
|
|
865
|
-
componentInjectionController(HTMLInputElement.prototype);
|
|
866
|
-
componentInjectionController(HTMLTextAreaElement.prototype);
|
|
867
|
-
componentInjectionController(HTMLImageElement.prototype);
|
|
868
|
-
Object.defineProperty(Element.prototype, "variant", {
|
|
869
|
-
get: function () {
|
|
870
|
-
return this.getAttribute("variant") || "default";
|
|
871
|
-
},
|
|
872
|
-
set: function (v) {
|
|
873
|
-
// @ts-ignore
|
|
874
|
-
if (v instanceof ref) {
|
|
875
|
-
// @ts-ignore
|
|
876
|
-
v.subscribe(this, "variant");
|
|
877
|
-
}
|
|
878
|
-
else {
|
|
879
|
-
v = v?.toString()?.trim() || "default";
|
|
880
|
-
if (v == "default" || v == undefined || v.trim().length == 0)
|
|
881
|
-
this.removeAttribute("variant");
|
|
882
|
-
else {
|
|
883
|
-
this.setAttribute("variant", v);
|
|
884
|
-
}
|
|
885
|
-
Component.getVariant(this.constructor, v)?.(this);
|
|
886
|
-
}
|
|
887
|
-
},
|
|
888
|
-
});
|
|
889
|
-
Object.defineProperty(Element.prototype, "connectedCallback", {
|
|
890
|
-
value: function () {
|
|
891
|
-
this.dispatchEvent(new CustomEvent("onConnected", { bubbles: false, cancelable: true }));
|
|
892
|
-
this?.onConnected();
|
|
893
|
-
},
|
|
894
|
-
writable: true,
|
|
895
|
-
configurable: true,
|
|
896
|
-
enumerable: true,
|
|
897
|
-
});
|
|
898
|
-
Object.defineProperty(Element.prototype, "disconnectedCallback", {
|
|
899
|
-
value: function () {
|
|
900
|
-
this.dispatchEvent(new CustomEvent("onDisconnected", { bubbles: false, cancelable: true }));
|
|
901
|
-
this?.onDisconnected();
|
|
902
|
-
},
|
|
903
|
-
writable: true,
|
|
904
|
-
configurable: true,
|
|
905
|
-
enumerable: true,
|
|
906
|
-
});
|
|
907
|
-
Object.defineProperty(window, "scoped", {
|
|
908
|
-
value: function (target) { },
|
|
909
|
-
writable: true,
|
|
910
|
-
configurable: true,
|
|
911
|
-
enumerable: true,
|
|
912
|
-
});
|
|
913
|
-
try {
|
|
914
|
-
const originalButton = Object.getOwnPropertyDescriptor(HTMLButtonElement.prototype, "type").set;
|
|
915
|
-
Object.defineProperty(HTMLButtonElement.prototype, "onfile", {
|
|
916
|
-
value: function (fileList) { },
|
|
917
|
-
writable: true,
|
|
918
|
-
configurable: true,
|
|
919
|
-
enumerable: true,
|
|
920
|
-
});
|
|
921
|
-
Object.defineProperty(HTMLButtonElement.prototype, "accept", {
|
|
922
|
-
get: function () {
|
|
923
|
-
return this.getAttribute("accept") || "";
|
|
924
|
-
},
|
|
925
|
-
set: function (value) {
|
|
926
|
-
this.setAttribute("accept", value);
|
|
927
|
-
},
|
|
928
|
-
});
|
|
929
|
-
Object.defineProperty(HTMLButtonElement.prototype, "multiple", {
|
|
930
|
-
get: function () {
|
|
931
|
-
return this.hasAttribute("multiple");
|
|
932
|
-
},
|
|
933
|
-
set: function (value) {
|
|
934
|
-
if (value)
|
|
935
|
-
this.setAttribute("multiple", "");
|
|
936
|
-
else
|
|
937
|
-
this.removeAttribute("multiple");
|
|
938
|
-
},
|
|
939
|
-
});
|
|
940
|
-
Object.defineProperty(HTMLButtonElement.prototype, "type", {
|
|
941
|
-
set: function (value) {
|
|
942
|
-
if (this.__onButtonFile__) {
|
|
943
|
-
if (this.__input_file__)
|
|
944
|
-
this.removeChild(this.__input_file__);
|
|
945
|
-
this.__input_file__ = undefined;
|
|
946
|
-
this.removeEventListener("click", this.__onButtonFile__);
|
|
947
|
-
}
|
|
948
|
-
if (value == "file") {
|
|
949
|
-
this.__input_file__ = new InputElement({ type: "file", style: { display: "none" } });
|
|
950
|
-
this.__input_file__.onchange = (event) => {
|
|
951
|
-
this.onfile(event.target.files);
|
|
952
|
-
event.stopPropagation();
|
|
953
|
-
event.preventDefault();
|
|
954
|
-
};
|
|
955
|
-
this.__input_file__.onclick = (event) => {
|
|
956
|
-
this.removeChild(this.__input_file__);
|
|
957
|
-
event.stopPropagation();
|
|
958
|
-
};
|
|
959
|
-
this.__onButtonFile__ = () => {
|
|
960
|
-
this.__input_file__.accept = this.accept;
|
|
961
|
-
this.__input_file__.multiple = this.multiple;
|
|
962
|
-
this.appendChild(this.__input_file__);
|
|
963
|
-
this.__input_file__.click();
|
|
964
|
-
};
|
|
965
|
-
this.addEventListener("click", this.__onButtonFile__);
|
|
966
|
-
}
|
|
967
|
-
originalButton.call(this, value);
|
|
968
|
-
},
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
catch (__) { }
|
|
972
|
-
Object.defineProperty(Element.prototype, "onInit", {
|
|
973
|
-
value: function () { },
|
|
974
|
-
writable: true,
|
|
975
|
-
configurable: true,
|
|
976
|
-
enumerable: true,
|
|
977
|
-
});
|
|
978
|
-
Object.defineProperty(Element.prototype, "getParent", {
|
|
979
|
-
value: function () {
|
|
980
|
-
return this.parentElement;
|
|
981
|
-
},
|
|
982
|
-
writable: true,
|
|
983
|
-
configurable: true,
|
|
984
|
-
enumerable: true,
|
|
985
|
-
});
|
|
986
|
-
Object.defineProperty(Element.prototype, "onConnected", {
|
|
987
|
-
value: function () { },
|
|
988
|
-
writable: true,
|
|
989
|
-
configurable: true,
|
|
990
|
-
enumerable: true,
|
|
991
|
-
});
|
|
992
|
-
Object.defineProperty(Element.prototype, "onDisconnected", {
|
|
993
|
-
value: function () { },
|
|
994
|
-
writable: true,
|
|
995
|
-
configurable: true,
|
|
996
|
-
enumerable: true,
|
|
997
|
-
});
|
|
998
|
-
Object.defineProperty(Element.prototype, "unmount", {
|
|
999
|
-
value: function () { },
|
|
1000
|
-
writable: true,
|
|
1001
|
-
configurable: true,
|
|
1002
|
-
enumerable: true,
|
|
1003
|
-
});
|
|
1004
|
-
Object.defineProperty(Element.prototype, "addClassName", {
|
|
1005
|
-
value: function (...names) {
|
|
1006
|
-
for (const name of names) {
|
|
1007
|
-
const strs = name.match(/\S+/g) || [];
|
|
1008
|
-
if (strs.length > 0)
|
|
1009
|
-
this.classList.add(...strs);
|
|
1010
|
-
}
|
|
1011
|
-
},
|
|
1012
|
-
writable: true,
|
|
1013
|
-
configurable: true,
|
|
1014
|
-
enumerable: true,
|
|
1015
|
-
});
|
|
1016
|
-
// remove class
|
|
1017
|
-
Object.defineProperty(Element.prototype, "removeClassName", {
|
|
1018
|
-
value: function (...names) {
|
|
1019
|
-
for (const name of names) {
|
|
1020
|
-
const strs = name.match(/\S+/g) || [];
|
|
1021
|
-
if (strs.length > 0)
|
|
1022
|
-
this.classList.remove(...strs);
|
|
1023
|
-
}
|
|
1024
|
-
},
|
|
1025
|
-
writable: true,
|
|
1026
|
-
configurable: true,
|
|
1027
|
-
enumerable: true,
|
|
1028
|
-
});
|
|
1029
|
-
Object.defineProperty(Element.prototype, "setStyle", {
|
|
1030
|
-
value: function (style) {
|
|
1031
|
-
for (const [key, value] of Object.entries(style)) {
|
|
1032
|
-
this.style[key] = value;
|
|
1033
|
-
}
|
|
1034
|
-
},
|
|
1035
|
-
writable: true,
|
|
1036
|
-
configurable: true,
|
|
1037
|
-
enumerable: true,
|
|
1038
|
-
});
|
|
1039
|
-
Object.defineProperty(Element.prototype, "onEvent", {
|
|
1040
|
-
value: function (type, listener, options) {
|
|
1041
|
-
EventComponent.addEventListener(this, type, listener, options);
|
|
1042
|
-
},
|
|
1043
|
-
writable: true,
|
|
1044
|
-
configurable: true,
|
|
1045
|
-
enumerable: true,
|
|
1046
|
-
});
|
|
1047
|
-
Object.defineProperty(Element.prototype, "createEvent", {
|
|
1048
|
-
value: function (type, ...data) {
|
|
1049
|
-
return EventComponent.createEvent(type, ...data);
|
|
1050
|
-
},
|
|
1051
|
-
writable: true,
|
|
1052
|
-
configurable: true,
|
|
1053
|
-
enumerable: true,
|
|
1054
|
-
});
|
|
1055
|
-
Object.defineProperty(Element.prototype, "removeEvent", {
|
|
1056
|
-
value: function (type) {
|
|
1057
|
-
EventComponent.removeEventListener(this, type);
|
|
1058
|
-
},
|
|
1059
|
-
writable: true,
|
|
1060
|
-
configurable: true,
|
|
1061
|
-
enumerable: true,
|
|
1062
|
-
});
|
|
1063
|
-
Object.defineProperty(Element.prototype, "removeEvents", {
|
|
1064
|
-
value: function () {
|
|
1065
|
-
EventComponent.removeEventListeners(this);
|
|
1066
|
-
},
|
|
1067
|
-
writable: true,
|
|
1068
|
-
configurable: true,
|
|
1069
|
-
enumerable: true,
|
|
1070
|
-
});
|
|
1071
|
-
Object.defineProperty(Element.prototype, "emitEvent", {
|
|
1072
|
-
value: function (type, ...params) {
|
|
1073
|
-
return EventComponent.emitEvent(type, ...params);
|
|
1074
|
-
},
|
|
1075
|
-
writable: true,
|
|
1076
|
-
configurable: true,
|
|
1077
|
-
enumerable: true,
|
|
1078
|
-
});
|
|
1079
|
-
Object.defineProperty(Element.prototype, "deleteEvent", {
|
|
1080
|
-
value: function (type) {
|
|
1081
|
-
EventComponent.deleteEvent(type);
|
|
1082
|
-
},
|
|
1083
|
-
writable: true,
|
|
1084
|
-
configurable: true,
|
|
1085
|
-
enumerable: true,
|
|
1086
|
-
});
|
|
1087
|
-
const originalAppend = Element.prototype.append;
|
|
1088
|
-
// symb
|
|
1089
|
-
const REF_MUTATION = Symbol("RefMutation");
|
|
1090
|
-
class RefElementObserver {
|
|
1091
|
-
element;
|
|
1092
|
-
node;
|
|
1093
|
-
index = -1;
|
|
1094
|
-
head;
|
|
1095
|
-
elements = [];
|
|
1096
|
-
constructor(element, node) {
|
|
1097
|
-
this.element = element;
|
|
1098
|
-
this.node = node;
|
|
1099
|
-
}
|
|
1100
|
-
set value(val) {
|
|
1101
|
-
const oldElements = this.elements;
|
|
1102
|
-
const value = this.node.valueOf();
|
|
1103
|
-
if (Array.isArray(this.node))
|
|
1104
|
-
this.elements = value;
|
|
1105
|
-
else if (typeof value === "function") {
|
|
1106
|
-
const result = value();
|
|
1107
|
-
this.elements = Array.isArray(result) ? result : [result];
|
|
1108
|
-
}
|
|
1109
|
-
else
|
|
1110
|
-
this.elements = [value];
|
|
1111
|
-
if (this.index == -1) {
|
|
1112
|
-
this.index = this.element.children.length;
|
|
1113
|
-
this.element.append(...this.elements);
|
|
1114
|
-
}
|
|
1115
|
-
else {
|
|
1116
|
-
const childrens = Array.from(this.element.children);
|
|
1117
|
-
this.index = childrens.findIndex((child) => child === oldElements[0]);
|
|
1118
|
-
childrens.splice(this.index, oldElements.length, ...this.elements);
|
|
1119
|
-
this.syncComponentWithList(childrens, this.element);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
syncComponentWithList(list, element) {
|
|
1123
|
-
const currentChildren = Array.from(element.children);
|
|
1124
|
-
currentChildren.forEach((child) => {
|
|
1125
|
-
if (!list.includes(child)) {
|
|
1126
|
-
element.removeChild(child);
|
|
1127
|
-
}
|
|
1128
|
-
});
|
|
1129
|
-
list.forEach((el) => {
|
|
1130
|
-
// @ts-ignore
|
|
1131
|
-
if (el instanceof Node && !currentChildren.includes(el)) {
|
|
1132
|
-
element.appendChild(el);
|
|
1133
|
-
}
|
|
1134
|
-
});
|
|
1135
|
-
list.forEach((el, index) => {
|
|
1136
|
-
if (el instanceof Node && element.children[index] !== el) {
|
|
1137
|
-
element.insertBefore(el, element.children[index] || null);
|
|
1138
|
-
}
|
|
1139
|
-
});
|
|
1140
|
-
}
|
|
1141
|
-
disconnect() {
|
|
1142
|
-
this.node.unsubscribe(this, "value");
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
class RefMutationObserver extends MutationObserver {
|
|
1146
|
-
element;
|
|
1147
|
-
observers = new Map();
|
|
1148
|
-
data;
|
|
1149
|
-
constructor(element) {
|
|
1150
|
-
super((mutations) => {
|
|
1151
|
-
for (const m of mutations) {
|
|
1152
|
-
m.addedNodes.forEach((n) => {
|
|
1153
|
-
// console.log('Filho adicionado:', n);
|
|
1154
|
-
});
|
|
1155
|
-
m.removedNodes.forEach((n) => {
|
|
1156
|
-
// console.log('Filho removido:', n);
|
|
1157
|
-
});
|
|
1158
|
-
}
|
|
1159
|
-
});
|
|
1160
|
-
this.element = element;
|
|
1161
|
-
this.observe(this.element, { childList: true });
|
|
1162
|
-
this.element[REF_MUTATION] = this;
|
|
1163
|
-
}
|
|
1164
|
-
appendRef(node) {
|
|
1165
|
-
this.data = new RefElementObserver(this.element, node);
|
|
1166
|
-
this.observers.set(node, this.data);
|
|
1167
|
-
}
|
|
1168
|
-
disconnect() {
|
|
1169
|
-
super.disconnect();
|
|
1170
|
-
for (const [_node, data] of this.observers) {
|
|
1171
|
-
data.disconnect();
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
}
|
|
1175
|
-
function getIndexInKeepElements(element, keepElements) {
|
|
1176
|
-
if (element instanceof HTMLElement)
|
|
1177
|
-
return keepElements.length - keepElements.indexOf(element);
|
|
1178
|
-
return -1;
|
|
1179
|
-
}
|
|
1180
|
-
function replaceElements(parentNode, start, end, newElements) {
|
|
1181
|
-
const childNodes = Array.from(parentNode.childNodes);
|
|
1182
|
-
const startIndex = childNodes.indexOf(start);
|
|
1183
|
-
const endIndex = childNodes.indexOf(end);
|
|
1184
|
-
if (!Array.isArray(newElements))
|
|
1185
|
-
newElements = [newElements];
|
|
1186
|
-
// @ts-ignore
|
|
1187
|
-
newElements = newElements.filter(Boolean).map((e) => (e instanceof HTMLElement ? e : document.createTextNode(e?.toString() || e)));
|
|
1188
|
-
if (startIndex === -1 || endIndex === -1 || endIndex <= startIndex)
|
|
1189
|
-
return;
|
|
1190
|
-
const existingElements = childNodes.slice(startIndex + 1, endIndex);
|
|
1191
|
-
const removeElements = existingElements.filter((e) => !newElements.find((ne) => ne === e));
|
|
1192
|
-
const keepElements = existingElements.filter((e) => newElements.find((ne) => ne === e));
|
|
1193
|
-
const actions = [];
|
|
1194
|
-
for (const element of removeElements)
|
|
1195
|
-
element.remove();
|
|
1196
|
-
for (const [index, element] of newElements.entries()) {
|
|
1197
|
-
if (!element)
|
|
1198
|
-
continue;
|
|
1199
|
-
// const indexInKeep = getIndexInKeepElements(element, keepElements);
|
|
1200
|
-
// const indexInNew = newElements.length - newElements.indexOf(element);
|
|
1201
|
-
actions.unshift({
|
|
1202
|
-
element: element,
|
|
1203
|
-
action: keepElements[index] === element ? "keep" : "insert",
|
|
1204
|
-
before: newElements[index + 1] ? newElements[index + 1] : end,
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
for (const action of actions) {
|
|
1208
|
-
const { element, action: act, before } = action;
|
|
1209
|
-
if (act === "keep")
|
|
1210
|
-
continue;
|
|
1211
|
-
if (act === "insert")
|
|
1212
|
-
parentNode.insertBefore(element, before);
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
// append
|
|
1216
|
-
Element.prototype.append = function (...nodes) {
|
|
1217
|
-
const isRef = nodes.find((node) => node instanceof ref);
|
|
1218
|
-
if (isRef) {
|
|
1219
|
-
for (const n of nodes) {
|
|
1220
|
-
if (n instanceof ref) {
|
|
1221
|
-
const r = n;
|
|
1222
|
-
const start = new Comment(`ref:${r.id}:start`);
|
|
1223
|
-
const end = new Comment(`ref:${r.id}:end`);
|
|
1224
|
-
originalAppend.call(this, start, end);
|
|
1225
|
-
r.subscribe((value) => replaceElements(this, start, end, value));
|
|
1226
|
-
}
|
|
1227
|
-
else {
|
|
1228
|
-
originalAppend.call(this, n);
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
else
|
|
1233
|
-
originalAppend.call(this, ...nodes);
|
|
1234
|
-
};
|
|
1235
|
-
Window.prototype.getTheme = function () {
|
|
1236
|
-
return localStorage.getItem("theme") || "light";
|
|
1237
|
-
};
|
|
1238
|
-
Window.prototype.setTheme = function (theme) {
|
|
1239
|
-
const html = document.querySelector("html");
|
|
1240
|
-
html?.setAttribute("data-theme", theme);
|
|
1241
|
-
localStorage.setItem("theme", theme);
|
|
1242
|
-
};
|
|
1243
|
-
Array.prototype.clear = function () {
|
|
1244
|
-
this.length = 0;
|
|
1245
|
-
};
|
|
1246
|
-
{
|
|
1247
|
-
Object.defineProperty(SVGElement.prototype, "complete", {
|
|
1248
|
-
value: false,
|
|
1249
|
-
writable: true,
|
|
1250
|
-
configurable: true,
|
|
1251
|
-
enumerable: true,
|
|
1252
|
-
});
|
|
1253
|
-
Object.defineProperty(SVGElement.prototype, "src", {
|
|
1254
|
-
get: function () {
|
|
1255
|
-
return this.getAttribute("src") || "";
|
|
1256
|
-
},
|
|
1257
|
-
set: function (value) {
|
|
1258
|
-
if (value)
|
|
1259
|
-
this.setAttribute("src", value);
|
|
1260
|
-
else
|
|
1261
|
-
this.removeAttribute("src");
|
|
1262
|
-
},
|
|
1263
|
-
});
|
|
1264
|
-
}
|
|
1265
|
-
// const Fetch: {
|
|
1266
|
-
// defaultHeaders?: HeadersInit | (() => HeadersInit);
|
|
1267
|
-
// defaultCredentials?: RequestCredentials;
|
|
1268
|
-
// //interceptors?: {
|
|
1269
|
-
// // request?: (request: Request) => Request;
|
|
1270
|
-
// // response?: (response: Response) => Response;
|
|
1271
|
-
// //};
|
|
1272
|
-
// invalidateCache: (key: string) => void;
|
|
1273
|
-
// } = {
|
|
1274
|
-
// defaultHeaders: undefined,
|
|
1275
|
-
// invalidateCache(key: string) {
|
|
1276
|
-
// if (key) {
|
|
1277
|
-
// localStorage.removeItem(key);
|
|
1278
|
-
// }
|
|
1279
|
-
// }
|
|
1280
|
-
// };
|
|
1281
|
-
// (globalThis as any).Fetch = Fetch;
|
|
1282
|
-
// (window as any).Fetch = Fetch;
|
|
1283
|
-
// const orinalFetch = window.fetch;
|
|
1284
|
-
// // @ts-ignore
|
|
1285
|
-
// window.fetch = async (input: RequestInfo | ref<string>, init?: RequestInit): Promise<Response> => {
|
|
1286
|
-
// const cache: { type: RequestCache | "localstorage" } = {
|
|
1287
|
-
// type: init?.cache || "default",
|
|
1288
|
-
// }
|
|
1289
|
-
// if (input instanceof ref) {
|
|
1290
|
-
// const _ref = input as ref<string>;
|
|
1291
|
-
// _ref.subscribe((endpoint) => {
|
|
1292
|
-
// endpoint && fetch(endpoint, init);
|
|
1293
|
-
// })
|
|
1294
|
-
// return null;
|
|
1295
|
-
// }
|
|
1296
|
-
// if (cache.type === "localstorage")
|
|
1297
|
-
// delete init.cache;
|
|
1298
|
-
// if (init?.params) {
|
|
1299
|
-
// const params = new URLSearchParams();
|
|
1300
|
-
// for (const key in init.params) {
|
|
1301
|
-
// params.append(key, init.params[key]);
|
|
1302
|
-
// }
|
|
1303
|
-
// if (input instanceof Request) {
|
|
1304
|
-
// input = new Request(input, { ...init, params });
|
|
1305
|
-
// } else if (typeof input === "string") {
|
|
1306
|
-
// input = new Request(`${input}${params.size ? '?' : ''}${params.toString()}`, init);
|
|
1307
|
-
// }
|
|
1308
|
-
// }
|
|
1309
|
-
// const headers = Fetch?.defaultHeaders ? typeof Fetch.defaultHeaders === "function" ? Fetch?.defaultHeaders() : Fetch.defaultHeaders : {};
|
|
1310
|
-
// const response = await orinalFetch(input, { headers: headers, credentials: Fetch?.defaultCredentials, ...(init || {}) });
|
|
1311
|
-
// const { refKey } = init || {};
|
|
1312
|
-
// if (refKey && response.ok) {
|
|
1313
|
-
// const clone = response.clone();
|
|
1314
|
-
// const contentType = response.headers.get('content-type');
|
|
1315
|
-
// let data = "";
|
|
1316
|
-
// if (contentType && contentType.includes('application/json')) {
|
|
1317
|
-
// data = await clone.json();
|
|
1318
|
-
// } else {
|
|
1319
|
-
// data = await clone.text();
|
|
1320
|
-
// }
|
|
1321
|
-
// data = init.transform ? init.transform(data) : data;
|
|
1322
|
-
// if (cache.type === "localstorage") {
|
|
1323
|
-
// localStorage.setItem(input.toString(), data);
|
|
1324
|
-
// }
|
|
1325
|
-
// const _ref: ref = Ref.get(refKey);
|
|
1326
|
-
// if (!_ref) {
|
|
1327
|
-
// ref(data, refKey);
|
|
1328
|
-
// } else {
|
|
1329
|
-
// _ref.value = data;
|
|
1330
|
-
// }
|
|
1331
|
-
// // @ts-ignore
|
|
1332
|
-
// Ref.getStatus(refKey).value = clone.status.toString();
|
|
1333
|
-
// }
|
|
1334
|
-
// return response;
|
|
1335
|
-
// };
|
|
1336
|
-
String.prototype.toNumber = function () {
|
|
1337
|
-
// @ts-ignore
|
|
1338
|
-
return new Number(this).valueOf();
|
|
1339
|
-
};
|
|
1340
|
-
String.prototype.toInt = function (radix) {
|
|
1341
|
-
// @ts-ignore
|
|
1342
|
-
return parseInt(this, radix);
|
|
1343
|
-
};
|
|
1344
|
-
String.prototype.toDate = function () {
|
|
1345
|
-
// @ts-ignore
|
|
1346
|
-
return new Date(this);
|
|
1347
|
-
};
|
|
1348
|
-
import { __App__ } from "./app";
|
|
1349
|
-
export * from "../core/ref";
|
|
1350
|
-
export const App = new __App__();
|
|
1351
|
-
//# sourceMappingURL=index.js.map
|