typecomposer 0.1.26 → 0.1.28
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.d.ts +12 -0
- package/assets/index.js +13 -0
- package/assets/index.js.map +1 -0
- 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 +34 -0
- package/core/components/TextField.js +148 -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 +923 -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 +2 -18
- package/typings/index.d.ts +4 -3
- package/README.md +0 -62
- package/public/Ic_my_location_48px.svg.png +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Ref } from ".";
|
|
2
|
+
import { RefContainer } from "./RefContainer";
|
|
3
|
+
export function refString(value) {
|
|
4
|
+
return new RefString(value);
|
|
5
|
+
}
|
|
6
|
+
Object.defineProperty(refString, Symbol.hasInstance, {
|
|
7
|
+
value: function (instance) {
|
|
8
|
+
return !!instance && instance instanceof RefString;
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
export class RefString {
|
|
12
|
+
container;
|
|
13
|
+
refKey;
|
|
14
|
+
constructor(value, refKey) {
|
|
15
|
+
this.container = new RefContainer(value);
|
|
16
|
+
this.refKey = refKey;
|
|
17
|
+
refKey && Ref.set(refKey, this);
|
|
18
|
+
}
|
|
19
|
+
charAt(pos) {
|
|
20
|
+
return this.container.value.charAt(pos);
|
|
21
|
+
}
|
|
22
|
+
charCodeAt(index) {
|
|
23
|
+
return this.container.value.charCodeAt(index);
|
|
24
|
+
}
|
|
25
|
+
concat(...strings) {
|
|
26
|
+
return this.container.value.concat(...strings);
|
|
27
|
+
}
|
|
28
|
+
indexOf(searchString, position) {
|
|
29
|
+
return this.container.value.indexOf(searchString, position);
|
|
30
|
+
}
|
|
31
|
+
lastIndexOf(searchString, position) {
|
|
32
|
+
return this.container.value.lastIndexOf(searchString, position);
|
|
33
|
+
}
|
|
34
|
+
localeCompare(that, locales, options) {
|
|
35
|
+
return this.container.value.localeCompare(that, locales, options);
|
|
36
|
+
}
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
match(regexp) {
|
|
39
|
+
return this.container.value.match(regexp);
|
|
40
|
+
}
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
replace(searchValue, replacer) {
|
|
43
|
+
return this.container.value.replace(searchValue, replacer);
|
|
44
|
+
}
|
|
45
|
+
// @ts-ignore
|
|
46
|
+
search(searcher) {
|
|
47
|
+
return this.container.value.search(searcher);
|
|
48
|
+
}
|
|
49
|
+
slice(start, end) {
|
|
50
|
+
return this.container.value.slice(start, end);
|
|
51
|
+
}
|
|
52
|
+
// @ts-ignore
|
|
53
|
+
split(separator, limit) {
|
|
54
|
+
return this.container.value.split(separator, limit);
|
|
55
|
+
}
|
|
56
|
+
substring(start, end) {
|
|
57
|
+
return this.container.value.substring(start, end);
|
|
58
|
+
}
|
|
59
|
+
toLowerCase() {
|
|
60
|
+
return this.container.value.toLowerCase();
|
|
61
|
+
}
|
|
62
|
+
toLocaleLowerCase(locales) {
|
|
63
|
+
return this.container.value.toLocaleLowerCase(locales);
|
|
64
|
+
}
|
|
65
|
+
toUpperCase() {
|
|
66
|
+
return this.container.value.toUpperCase();
|
|
67
|
+
}
|
|
68
|
+
toLocaleUpperCase(locales) {
|
|
69
|
+
return this.container.value.toLocaleUpperCase(locales);
|
|
70
|
+
}
|
|
71
|
+
trim() {
|
|
72
|
+
return this.container.value.trim();
|
|
73
|
+
}
|
|
74
|
+
substr(from, length) {
|
|
75
|
+
return this.container.value.substr(from, length);
|
|
76
|
+
}
|
|
77
|
+
codePointAt(pos) {
|
|
78
|
+
return this.container.value.codePointAt(pos);
|
|
79
|
+
}
|
|
80
|
+
includes(searchString, position) {
|
|
81
|
+
return this.container.value.includes(searchString, position);
|
|
82
|
+
}
|
|
83
|
+
endsWith(searchString, endPosition) {
|
|
84
|
+
return this.container.value.endsWith(searchString, endPosition);
|
|
85
|
+
}
|
|
86
|
+
normalize(form) {
|
|
87
|
+
return this.container.value.normalize(form);
|
|
88
|
+
}
|
|
89
|
+
repeat(count) {
|
|
90
|
+
return this.container.value.repeat(count);
|
|
91
|
+
}
|
|
92
|
+
startsWith(searchString, position) {
|
|
93
|
+
return this.container.value.startsWith(searchString, position);
|
|
94
|
+
}
|
|
95
|
+
anchor(name) {
|
|
96
|
+
return this.container.value.anchor(name);
|
|
97
|
+
}
|
|
98
|
+
big() {
|
|
99
|
+
return this.container.value.big();
|
|
100
|
+
}
|
|
101
|
+
blink() {
|
|
102
|
+
return this.container.value.blink();
|
|
103
|
+
}
|
|
104
|
+
bold() {
|
|
105
|
+
return this.container.value.bold();
|
|
106
|
+
}
|
|
107
|
+
fixed() {
|
|
108
|
+
return this.container.value.fixed();
|
|
109
|
+
}
|
|
110
|
+
fontcolor(color) {
|
|
111
|
+
return this.container.value.fontcolor(color);
|
|
112
|
+
}
|
|
113
|
+
fontsize(size) {
|
|
114
|
+
return this.container.value.fontsize(size.toString());
|
|
115
|
+
}
|
|
116
|
+
italics() {
|
|
117
|
+
return this.container.value.italics();
|
|
118
|
+
}
|
|
119
|
+
link(url) {
|
|
120
|
+
return this.container.value.link(url);
|
|
121
|
+
}
|
|
122
|
+
small() {
|
|
123
|
+
return this.container.value.small();
|
|
124
|
+
}
|
|
125
|
+
strike() {
|
|
126
|
+
return this.container.value.strike();
|
|
127
|
+
}
|
|
128
|
+
sub() {
|
|
129
|
+
return this.container.value.sub();
|
|
130
|
+
}
|
|
131
|
+
sup() {
|
|
132
|
+
return this.container.value.sup();
|
|
133
|
+
}
|
|
134
|
+
padStart(maxLength, fillString) {
|
|
135
|
+
return this.container.value.padStart(maxLength, fillString);
|
|
136
|
+
}
|
|
137
|
+
padEnd(maxLength, fillString) {
|
|
138
|
+
return this.container.value.padEnd(maxLength, fillString);
|
|
139
|
+
}
|
|
140
|
+
trimEnd() {
|
|
141
|
+
return this.container.value.trimEnd();
|
|
142
|
+
}
|
|
143
|
+
trimStart() {
|
|
144
|
+
return this.container.value.trimStart();
|
|
145
|
+
}
|
|
146
|
+
trimLeft() {
|
|
147
|
+
return this.container.value.trimLeft();
|
|
148
|
+
}
|
|
149
|
+
trimRight() {
|
|
150
|
+
return this.container.value.trimRight();
|
|
151
|
+
}
|
|
152
|
+
matchAll(regexp) {
|
|
153
|
+
return this.container.value.matchAll(regexp);
|
|
154
|
+
}
|
|
155
|
+
replaceAll(searchValue, replacer) {
|
|
156
|
+
// @ts-ignore
|
|
157
|
+
return this.container.value.replaceAll(searchValue, replacer);
|
|
158
|
+
}
|
|
159
|
+
[Symbol.iterator]() {
|
|
160
|
+
return this.container.value[Symbol.iterator]();
|
|
161
|
+
}
|
|
162
|
+
equals(value) {
|
|
163
|
+
return this.container.valueOf() === value.valueOf();
|
|
164
|
+
}
|
|
165
|
+
valueOf() {
|
|
166
|
+
return this.container.value.toString();
|
|
167
|
+
}
|
|
168
|
+
get length() {
|
|
169
|
+
return this.container.value.length;
|
|
170
|
+
}
|
|
171
|
+
// @ts-ignore
|
|
172
|
+
emit(propertyName, value) {
|
|
173
|
+
if (this.container.value === value.valueOf())
|
|
174
|
+
return;
|
|
175
|
+
this.container.emitAll(propertyName, (this.container.value = value.valueOf()));
|
|
176
|
+
}
|
|
177
|
+
subscribe(target, propertyName, onUnsubscribe) {
|
|
178
|
+
return this.container.emit(this.container.subscribe(target, propertyName, onUnsubscribe), this.value);
|
|
179
|
+
}
|
|
180
|
+
unsubscribe(targe, propertyName = "") {
|
|
181
|
+
return this.container.unsubscribe(targe, propertyName);
|
|
182
|
+
}
|
|
183
|
+
[Symbol.toPrimitive](_hint) {
|
|
184
|
+
return this.container.toString();
|
|
185
|
+
}
|
|
186
|
+
static get [Symbol.species]() {
|
|
187
|
+
return String;
|
|
188
|
+
}
|
|
189
|
+
get value() {
|
|
190
|
+
return this.container.value.valueOf();
|
|
191
|
+
}
|
|
192
|
+
set value(value) {
|
|
193
|
+
this.emit("value", value);
|
|
194
|
+
}
|
|
195
|
+
toJSON() {
|
|
196
|
+
return this.container.root ? this.value : { value: this.value };
|
|
197
|
+
}
|
|
198
|
+
toString() {
|
|
199
|
+
return this.container.toString();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
//# sourceMappingURL=RefString.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefString.js","sourceRoot":"","sources":["../../../src/core/ref/RefString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAO,MAAM,GAAG,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,CAAC,cAAc,CAAC,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE;IACnD,KAAK,EAAE,UAAU,QAAa;QAC5B,OAAO,CAAC,CAAC,QAAQ,IAAI,QAAQ,YAAY,SAAS,CAAC;IACrD,CAAC;CACF,CAAC,CAAC;AAIH,MAAM,OAAO,SAAS;IACX,SAAS,CAAe;IAExB,MAAM,CAAS;IAExB,YAAY,KAAa,EAAE,MAAe;QACxC,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,MAAM,IAAI,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,IAAW,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1C,CAAC;IACD,UAAU,CAAC,KAAa;QACtB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IACD,MAAM,CAAC,GAAG,OAAiB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AAK,CAAC,MAAM,CAAC,OAAO,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IAClE,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ref } from "./RefObject";
|
|
2
|
+
export * from "./RefBoolean";
|
|
3
|
+
export * from "./RefNumber";
|
|
4
|
+
export * from "./RefString";
|
|
5
|
+
export * from "./RefMap";
|
|
6
|
+
export * from "./RefList";
|
|
7
|
+
export * from "./RefSet";
|
|
8
|
+
export * from "./RefObject";
|
|
9
|
+
export * from "./RefProperty";
|
|
10
|
+
export * from "./RefState";
|
|
11
|
+
export declare class Ref {
|
|
12
|
+
private static refs;
|
|
13
|
+
private static onCreatedCallbacks;
|
|
14
|
+
static onCreated(refKey: string, action: (ref: ref) => void): void;
|
|
15
|
+
static get<T>(refKey: string): ref<T> | undefined;
|
|
16
|
+
static set<T>(refKey: string, value: ref<T>): void;
|
|
17
|
+
static unsubscribe(target: object, propertyName: string | symbol): void;
|
|
18
|
+
static unsubscribeAll(target: object): void;
|
|
19
|
+
private static subscribe;
|
|
20
|
+
static computed(v: () => any): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export * from "./RefBoolean";
|
|
2
|
+
export * from "./RefNumber";
|
|
3
|
+
export * from "./RefString";
|
|
4
|
+
export * from "./RefMap";
|
|
5
|
+
export * from "./RefList";
|
|
6
|
+
export * from "./RefSet";
|
|
7
|
+
export * from "./RefObject";
|
|
8
|
+
export * from "./RefProperty";
|
|
9
|
+
export * from "./RefState";
|
|
10
|
+
const subscribers = new WeakMap();
|
|
11
|
+
export class Ref {
|
|
12
|
+
static refs = new Map();
|
|
13
|
+
static onCreatedCallbacks = new Map();
|
|
14
|
+
static onCreated(refKey, action) {
|
|
15
|
+
Ref.onCreatedCallbacks.set(refKey, [...(Ref.onCreatedCallbacks.get(refKey) || []), action]);
|
|
16
|
+
}
|
|
17
|
+
static get(refKey) {
|
|
18
|
+
const ref = Ref.refs.get(refKey);
|
|
19
|
+
return ref?.deref();
|
|
20
|
+
}
|
|
21
|
+
static set(refKey, value) {
|
|
22
|
+
Ref.refs.set(refKey, new WeakRef(value));
|
|
23
|
+
for (const callback of Ref.onCreatedCallbacks.get(refKey) || []) {
|
|
24
|
+
callback(value);
|
|
25
|
+
}
|
|
26
|
+
Ref.onCreatedCallbacks.delete(refKey);
|
|
27
|
+
}
|
|
28
|
+
static unsubscribe(target, propertyName) {
|
|
29
|
+
if (!subscribers.has(target))
|
|
30
|
+
return;
|
|
31
|
+
const propertyMap = subscribers.get(target);
|
|
32
|
+
const containerOld = propertyMap.get(propertyName);
|
|
33
|
+
if (containerOld)
|
|
34
|
+
containerOld.deref()?.unsubscribe(target, propertyName);
|
|
35
|
+
if (!propertyMap.has(propertyName))
|
|
36
|
+
return;
|
|
37
|
+
propertyMap.delete(propertyName);
|
|
38
|
+
}
|
|
39
|
+
static unsubscribeAll(target) {
|
|
40
|
+
if (!subscribers.has(target))
|
|
41
|
+
return;
|
|
42
|
+
const propertyMap = subscribers.get(target);
|
|
43
|
+
subscribers.delete(target);
|
|
44
|
+
for (const [key, value] of propertyMap) {
|
|
45
|
+
value.deref()?.unsubscribe(target, key);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// in use
|
|
49
|
+
static subscribe(target, propertyName, container) {
|
|
50
|
+
if (!subscribers.has(target))
|
|
51
|
+
subscribers.set(target, new Map());
|
|
52
|
+
const propertyMap = subscribers.get(target);
|
|
53
|
+
if (propertyMap.has(propertyName)) {
|
|
54
|
+
const containerOld = propertyMap.get(propertyName);
|
|
55
|
+
if (containerOld)
|
|
56
|
+
containerOld.deref()?.unsubscribe(target, propertyName);
|
|
57
|
+
}
|
|
58
|
+
propertyMap.set(propertyName, new WeakRef(container));
|
|
59
|
+
}
|
|
60
|
+
static computed(v) {
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
globalThis.Ref = Ref;
|
|
64
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/ref/index.ts"],"names":[],"mappings":"AAEA,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAG3B,MAAM,WAAW,GAAG,IAAI,OAAO,EAAuB,CAAC;AAEvD,MAAM,OAAO,GAAG;IACN,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,EAAwB,CAAC;IAC9C,MAAM,CAAC,kBAAkB,GAAG,IAAI,GAAG,EAAsB,CAAC;IAE3D,MAAM,CAAC,SAAS,CAAC,MAAc,EAAE,MAA0B;QAChE,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9F,CAAC;IAEM,MAAM,CAAC,GAAG,CAAI,MAAc;QACjC,MAAM,GAAG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AI,WAAW,EAAE,CAAC;YACvC,KAAK,CAAC,KAAK,EAAE,EAAE,WAAW,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,SAAS;IACD,MAAM,CAAC,SAAS,CAAC,MAAc,EAAE,YAA6B,EAAE,SAAuB;QAC7F,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC;YAAE,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;QACjE,MAAM,WAAW,GAAG,WAAW,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC;QAC7C,IAAI,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YAClC,MAAM,YAAY,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YACnD,IAAI,YAAY;gBAAE,YAAY,CAAC,KAAK,EAAE,EAAE,WAAW,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;QAC5E,CAAC;QACD,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,CAAY;IACnC,CAAC;;AAIF,UAAkB,CAAC,GAAG,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, ComponentProps } from "../..";
|
|
2
|
+
export declare class RouteView extends Component {
|
|
3
|
+
#private;
|
|
4
|
+
private _view;
|
|
5
|
+
private _url;
|
|
6
|
+
private routePage;
|
|
7
|
+
constructor(props?: ComponentProps & {
|
|
8
|
+
defaultView?: ComponentType;
|
|
9
|
+
onUpdateView?: (view?: IComponent) => void;
|
|
10
|
+
});
|
|
11
|
+
get url(): string;
|
|
12
|
+
connectedCallback(): void;
|
|
13
|
+
append(...nodes: (Node | string)[]): void;
|
|
14
|
+
appendChild<T extends Node>(node: T): T;
|
|
15
|
+
private updateView;
|
|
16
|
+
disconnectedCallback(): void;
|
|
17
|
+
get view(): IComponent | undefined;
|
|
18
|
+
set view(value: IComponent | undefined);
|
|
19
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Component, Router } from "../..";
|
|
2
|
+
export class RouteView extends Component {
|
|
3
|
+
_view = undefined;
|
|
4
|
+
_url = "";
|
|
5
|
+
routePage = undefined;
|
|
6
|
+
#defaultView = undefined;
|
|
7
|
+
#defaultComponent = undefined;
|
|
8
|
+
constructor(props) {
|
|
9
|
+
super();
|
|
10
|
+
this.#defaultView = props?.defaultView;
|
|
11
|
+
delete props?.defaultView;
|
|
12
|
+
delete props?.children;
|
|
13
|
+
Component.applyProps(this, props);
|
|
14
|
+
this.onEvent("router:watch", () => {
|
|
15
|
+
this.updateView();
|
|
16
|
+
props?.onUpdateView?.(this.view);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
get url() {
|
|
20
|
+
return this._url;
|
|
21
|
+
}
|
|
22
|
+
connectedCallback() {
|
|
23
|
+
this.updateView();
|
|
24
|
+
}
|
|
25
|
+
append(...nodes) {
|
|
26
|
+
throw new Error("Method not implemented.");
|
|
27
|
+
}
|
|
28
|
+
appendChild(node) {
|
|
29
|
+
throw new Error("Method not implemented.");
|
|
30
|
+
}
|
|
31
|
+
updateView() {
|
|
32
|
+
// @ts-ignore
|
|
33
|
+
const routePage = Router.getRouteViewFree(this);
|
|
34
|
+
if (routePage == undefined) {
|
|
35
|
+
if (this.routePage)
|
|
36
|
+
this.routePage.routeView = undefined;
|
|
37
|
+
this.view = undefined;
|
|
38
|
+
this.routePage = undefined;
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (routePage === this.routePage)
|
|
42
|
+
return;
|
|
43
|
+
if (routePage.build && routePage.build === this.routePage?.build) {
|
|
44
|
+
routePage.routeView = this;
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
routePage.build = routePage.build || new routePage.component();
|
|
48
|
+
this.routePage = routePage;
|
|
49
|
+
this.view = routePage.build;
|
|
50
|
+
}
|
|
51
|
+
disconnectedCallback() {
|
|
52
|
+
if (this.routePage)
|
|
53
|
+
this.routePage.routeView = undefined;
|
|
54
|
+
this.routePage = undefined;
|
|
55
|
+
this.removeEvent("router:watch");
|
|
56
|
+
}
|
|
57
|
+
get view() {
|
|
58
|
+
return this._view;
|
|
59
|
+
}
|
|
60
|
+
set view(value) {
|
|
61
|
+
if (!value && this.#defaultView) {
|
|
62
|
+
value = this.#defaultComponent || new this.#defaultView;
|
|
63
|
+
this.#defaultComponent = value;
|
|
64
|
+
}
|
|
65
|
+
if (this._view == value)
|
|
66
|
+
return;
|
|
67
|
+
if (this._view)
|
|
68
|
+
this._view.remove();
|
|
69
|
+
this._view = value;
|
|
70
|
+
if (value)
|
|
71
|
+
super.append(value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
customElements.define("route-view", RouteView);
|
|
75
|
+
//# sourceMappingURL=RouteView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RouteView.js","sourceRoot":"","sources":["../../../src/core/router/RouteView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AAU1D,MAAM,OAAO,SAAU,SAAQ,SAAS;IAC9B,KAAK,GAA2B,SAAS,CAAC;IAC1C,IAAI,GAAW,EAAE,CAAC;IAClB,SAAS,GAA+B,SAAS,CAAC;IAC1D,YAAY,GAA8B,SAAS,CAAC;IACpD,iBAAiB,GAA2B,SAAS,CAAC;IAGtD,YACE,KAGC;QAED,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,GAAG,KAAK,EAAE,WAAW,CAAC;QACvC,OAAO,KAAK,EAAE,WAAW,CAAC;QAC1B,OAAO,KAAK,EAAE,QAAQ,CAAC;QACvB,SAAS,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,OAAO,CAAC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AClB,IAAI,IAAI,CAAC,SAAS;YAAE,IAAI,CAAC,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC;QACzD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAI,IAAI,CAAC,KAA6B;QACpC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YAChC,KAAK,GAAG,IAAI,CAAC,iBAAiB,IAAI,IAAI,IAAI,CAAC,YAAY,CAAC;YACxD,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;QACjC,CAAC;QACD,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK;YAAE,OAAO;QAChC,IAAI,IAAI,CAAC,KAAK;YAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,KAAK;YAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CACF;AACD,cAAc,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { RouteView } from "../../";
|
|
2
|
+
import { RouterGuard } from "./RouterGuard";
|
|
3
|
+
export interface RoutePage {
|
|
4
|
+
path: string;
|
|
5
|
+
component?: ComponentType;
|
|
6
|
+
children?: RoutePage[];
|
|
7
|
+
redirect?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
guard?: RouterGuard;
|
|
10
|
+
}
|
|
11
|
+
interface RoutePageBuild extends RoutePage {
|
|
12
|
+
parent: RoutePageBuild;
|
|
13
|
+
build: IComponent;
|
|
14
|
+
routeView: RouteView | undefined;
|
|
15
|
+
id?: string;
|
|
16
|
+
}
|
|
17
|
+
interface RouteMatch {
|
|
18
|
+
url: string;
|
|
19
|
+
path: string;
|
|
20
|
+
routers: RoutePageBuild[];
|
|
21
|
+
params: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
export declare class Router {
|
|
24
|
+
#private;
|
|
25
|
+
private routes;
|
|
26
|
+
private url;
|
|
27
|
+
private urlValid;
|
|
28
|
+
private pageNotFound;
|
|
29
|
+
private match;
|
|
30
|
+
/**
|
|
31
|
+
* @param data - An array of route objects.
|
|
32
|
+
* @param history - The type of history to use. Can be either "hash" or "history".
|
|
33
|
+
*/
|
|
34
|
+
static readonly SEGMENT_WILDCARD = "*";
|
|
35
|
+
/**
|
|
36
|
+
* @param data - An array of route objects.
|
|
37
|
+
* @param history - The type of history to use. Can be either "hash" or "history".
|
|
38
|
+
* @returns {void}
|
|
39
|
+
*/
|
|
40
|
+
static readonly PATH_WILDCARD = "**";
|
|
41
|
+
beforeEach: (to: RouteMatch) => void;
|
|
42
|
+
private constructor();
|
|
43
|
+
private createAutoId;
|
|
44
|
+
private getQueryParams;
|
|
45
|
+
private handleRoute;
|
|
46
|
+
private buildRoutePage;
|
|
47
|
+
private checkGuard;
|
|
48
|
+
static create(data: {
|
|
49
|
+
routes: RoutePage[];
|
|
50
|
+
pageNotFound?: ComponentType;
|
|
51
|
+
history?: "hash" | "history";
|
|
52
|
+
sitemaps?: {
|
|
53
|
+
baseUrl: string;
|
|
54
|
+
};
|
|
55
|
+
robots?: "auto" | {
|
|
56
|
+
[key: string]: any;
|
|
57
|
+
};
|
|
58
|
+
}): void;
|
|
59
|
+
static reload(): void;
|
|
60
|
+
static get props(): {
|
|
61
|
+
[key: string]: any;
|
|
62
|
+
};
|
|
63
|
+
static get history(): "hash" | "history";
|
|
64
|
+
private static buildURL;
|
|
65
|
+
static go(url: string, props?: {}): Promise<void>;
|
|
66
|
+
static back(): void;
|
|
67
|
+
static forward(): void;
|
|
68
|
+
private static getRouteViewFree;
|
|
69
|
+
}
|
|
70
|
+
export {};
|