typecomposer 0.1.47 → 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 -2
- package/core/components/AlertPanel.d.ts +6 -6
- package/core/components/AlertPanel.js +1 -75
- package/core/components/AlertPanel.js.map +1 -1
- package/core/components/AvatarPanel.d.ts +2 -2
- package/core/components/AvatarPanel.js +1 -62
- package/core/components/AvatarPanel.js.map +1 -1
- package/core/components/BorderPanel.d.ts +2 -2
- package/core/components/BorderPanel.js +1 -90
- package/core/components/BorderPanel.js.map +1 -1
- package/core/components/CardPanel.d.ts +2 -2
- package/core/components/CardPanel.js +1 -11
- package/core/components/CardPanel.js.map +1 -1
- package/core/components/CheckBox.d.ts +2 -2
- package/core/components/CheckBox.js +1 -109
- package/core/components/CheckBox.js.map +1 -1
- package/core/components/ColorPicker.d.ts +2 -2
- package/core/components/ColorPicker.js +1 -36
- package/core/components/ColorPicker.js.map +1 -1
- package/core/components/ContextMenu.d.ts +3 -3
- package/core/components/ContextMenu.js +1 -64
- package/core/components/ContextMenu.js.map +1 -1
- package/core/components/DialogPanel.d.ts +2 -2
- package/core/components/DialogPanel.js +1 -62
- package/core/components/DialogPanel.js.map +1 -1
- package/core/components/DropDown.d.ts +3 -3
- package/core/components/DropDown.js +1 -231
- package/core/components/DropDown.js.map +1 -1
- package/core/components/FlowPanel.d.ts +2 -2
- package/core/components/FlowPanel.js +1 -40
- package/core/components/FlowPanel.js.map +1 -1
- package/core/components/ForEach.d.ts +2 -2
- package/core/components/ForEach.js +1 -88
- package/core/components/ForEach.js.map +1 -1
- package/core/components/GridPanel.d.ts +4 -7
- package/core/components/GridPanel.js +1 -30
- package/core/components/GridPanel.js.map +1 -1
- package/core/components/HBox.d.ts +2 -2
- package/core/components/HBox.js +1 -10
- package/core/components/HBox.js.map +1 -1
- package/core/components/LazyLoading.d.ts +2 -2
- package/core/components/LazyLoading.js +1 -36
- package/core/components/LazyLoading.js.map +1 -1
- package/core/components/ListPanel.d.ts +2 -2
- package/core/components/ListPanel.js +1 -153
- package/core/components/ListPanel.js.map +1 -1
- package/core/components/PopUpButton.d.ts +2 -2
- package/core/components/PopUpButton.js +1 -57
- package/core/components/PopUpButton.js.map +1 -1
- package/core/components/ScrollPanel.d.ts +2 -2
- package/core/components/ScrollPanel.js +1 -35
- package/core/components/ScrollPanel.js.map +1 -1
- package/core/components/SliderPanel.d.ts +2 -2
- package/core/components/SliderPanel.js +1 -135
- package/core/components/SliderPanel.js.map +1 -1
- package/core/components/StackPanel.d.ts +2 -2
- package/core/components/StackPanel.js +1 -10
- package/core/components/StackPanel.js.map +1 -1
- package/core/components/TabItem.js +1 -84
- package/core/components/TabPanel.d.ts +2 -2
- package/core/components/TabPanel.js +1 -96
- package/core/components/TabPanel.js.map +1 -1
- package/core/components/TextEdit.js +1 -174
- package/core/components/TextField.d.ts +2 -2
- package/core/components/TextField.js +1 -140
- package/core/components/TextField.js.map +1 -1
- package/core/components/ToggleButton.d.ts +2 -2
- package/core/components/ToggleButton.js +1 -20
- package/core/components/ToggleButton.js.map +1 -1
- package/core/components/Tooltip.d.ts +4 -6
- package/core/components/Tooltip.js +1 -14
- package/core/components/Tooltip.js.map +1 -1
- package/core/components/VBox.d.ts +2 -2
- package/core/components/VBox.js +1 -10
- package/core/components/VBox.js.map +1 -1
- package/core/components/VirtualScroll.d.ts +2 -2
- package/core/components/VirtualScroll.js +1 -47
- package/core/components/index.d.ts +1 -2
- package/core/components/index.js +1 -30
- package/core/components/index.js.map +1 -1
- package/core/decorators/RegisterComponent.js +1 -20
- package/core/decorators/StyleLink.js +1 -13
- package/core/decorators/index.js +1 -6
- package/core/element/AbbreviationElement.d.ts +2 -4
- package/core/element/AbbreviationElement.js +1 -10
- package/core/element/AbbreviationElement.js.map +1 -1
- package/core/element/AnchorElement.d.ts +2 -18
- package/core/element/AnchorElement.js +1 -31
- package/core/element/AnchorElement.js.map +1 -1
- package/core/element/AreaElement.d.ts +2 -15
- package/core/element/AreaElement.js +1 -11
- package/core/element/AreaElement.js.map +1 -1
- package/core/element/ArticleElement.d.ts +2 -2
- package/core/element/ArticleElement.js +1 -12
- package/core/element/ArticleElement.js.map +1 -1
- package/core/element/AudioElement.d.ts +2 -9
- package/core/element/AudioElement.js +1 -10
- package/core/element/AudioElement.js.map +1 -1
- package/core/element/BaseElement.d.ts +2 -5
- package/core/element/BaseElement.js +1 -11
- package/core/element/BaseElement.js.map +1 -1
- package/core/element/BodyElement.d.ts +2 -2
- package/core/element/BodyElement.js +1 -11
- package/core/element/BodyElement.js.map +1 -1
- package/core/element/BoldElement.d.ts +2 -2
- package/core/element/BoldElement.js +1 -10
- package/core/element/BoldElement.js.map +1 -1
- package/core/element/BreakElement.d.ts +2 -2
- package/core/element/BreakElement.js +1 -10
- package/core/element/BreakElement.js.map +1 -1
- package/core/element/ButtonElement.d.ts +4 -21
- package/core/element/ButtonElement.js +1 -47
- package/core/element/ButtonElement.js.map +1 -1
- package/core/element/CanvasElement.d.ts +2 -2
- package/core/element/CanvasElement.js +1 -14
- package/core/element/CanvasElement.js.map +1 -1
- package/core/element/CaptionElement.d.ts +2 -2
- package/core/element/CaptionElement.js +1 -13
- package/core/element/CaptionElement.js.map +1 -1
- package/core/element/CiteElement.d.ts +2 -2
- package/core/element/CiteElement.js +1 -11
- package/core/element/CiteElement.js.map +1 -1
- package/core/element/CodeElement.d.ts +2 -2
- package/core/element/CodeElement.js +1 -13
- package/core/element/CodeElement.js.map +1 -1
- package/core/element/DataListElement.d.ts +2 -2
- package/core/element/DataListElement.js +1 -13
- package/core/element/DataListElement.js.map +1 -1
- package/core/element/DefinitionDescriptionElement.d.ts +2 -2
- package/core/element/DefinitionDescriptionElement.js +1 -13
- package/core/element/DefinitionDescriptionElement.js.map +1 -1
- package/core/element/DefinitionElement.d.ts +2 -2
- package/core/element/DefinitionElement.js +1 -13
- package/core/element/DefinitionElement.js.map +1 -1
- package/core/element/DeletedTextElement.d.ts +2 -4
- package/core/element/DeletedTextElement.js +1 -15
- package/core/element/DeletedTextElement.js.map +1 -1
- package/core/element/DetailsElement.d.ts +3 -6
- package/core/element/DetailsElement.js +1 -28
- package/core/element/DetailsElement.js.map +1 -1
- package/core/element/DialogElement.d.ts +2 -4
- package/core/element/DialogElement.js +1 -14
- package/core/element/DialogElement.js.map +1 -1
- package/core/element/DivElement.d.ts +2 -2
- package/core/element/DivElement.js +1 -10
- package/core/element/DivElement.js.map +1 -1
- package/core/element/EmElement.d.ts +2 -2
- package/core/element/EmElement.js +1 -10
- package/core/element/EmElement.js.map +1 -1
- package/core/element/EmbedElement.d.ts +2 -7
- package/core/element/EmbedElement.js +1 -19
- package/core/element/EmbedElement.js.map +1 -1
- package/core/element/FieldSetElement.d.ts +3 -6
- package/core/element/FieldSetElement.js +1 -34
- package/core/element/FieldSetElement.js.map +1 -1
- package/core/element/FooterElement.d.ts +2 -2
- package/core/element/FooterElement.js +1 -13
- package/core/element/FooterElement.js.map +1 -1
- package/core/element/FormElement.d.ts +2 -17
- package/core/element/FormElement.js +1 -36
- package/core/element/FormElement.js.map +1 -1
- package/core/element/Fragment.js +1 -103
- package/core/element/H1Element.d.ts +2 -2
- package/core/element/H1Element.js +1 -10
- package/core/element/H1Element.js.map +1 -1
- package/core/element/H2Element.d.ts +2 -2
- package/core/element/H2Element.js +1 -10
- package/core/element/H2Element.js.map +1 -1
- package/core/element/H3Element.d.ts +2 -2
- package/core/element/H3Element.js +1 -10
- package/core/element/H3Element.js.map +1 -1
- package/core/element/H4Element.d.ts +2 -2
- package/core/element/H4Element.js +1 -10
- package/core/element/H4Element.js.map +1 -1
- package/core/element/H5Element.d.ts +2 -2
- package/core/element/H5Element.js +1 -10
- package/core/element/H5Element.js.map +1 -1
- package/core/element/H6Element.d.ts +2 -2
- package/core/element/H6Element.js +1 -10
- package/core/element/H6Element.js.map +1 -1
- package/core/element/HeadElement.d.ts +2 -2
- package/core/element/HeadElement.js +1 -11
- package/core/element/HeadElement.js.map +1 -1
- package/core/element/HeaderElement.d.ts +2 -2
- package/core/element/HeaderElement.js +1 -13
- package/core/element/HeaderElement.js.map +1 -1
- package/core/element/HorizontalRuleElement.d.ts +2 -2
- package/core/element/HorizontalRuleElement.js +1 -13
- package/core/element/HorizontalRuleElement.js.map +1 -1
- package/core/element/HtmlElement.d.ts +2 -4
- package/core/element/HtmlElement.js +1 -19
- package/core/element/HtmlElement.js.map +1 -1
- package/core/element/IFrameElement.d.ts +2 -15
- package/core/element/IFrameElement.js +1 -67
- package/core/element/IFrameElement.js.map +1 -1
- package/core/element/ILayout.d.ts +2 -2
- package/core/element/ILayout.js +1 -9
- package/core/element/ILayout.js.map +1 -1
- package/core/element/IconElement.d.ts +2 -2
- package/core/element/IconElement.js +1 -32
- package/core/element/IconElement.js.map +1 -1
- package/core/element/IdiomaticElement.d.ts +2 -1
- package/core/element/IdiomaticElement.js +1 -6
- package/core/element/IdiomaticElement.js.map +1 -1
- package/core/element/ImageElement.d.ts +2 -2
- package/core/element/ImageElement.js +1 -17
- package/core/element/ImageElement.js.map +1 -1
- package/core/element/InputElement.d.ts +2 -16
- package/core/element/InputElement.js +1 -81
- package/core/element/InputElement.js.map +1 -1
- package/core/element/LabelElement.d.ts +2 -5
- package/core/element/LabelElement.js +1 -10
- package/core/element/LabelElement.js.map +1 -1
- package/core/element/LegendElement.d.ts +2 -4
- package/core/element/LegendElement.js +1 -15
- package/core/element/LegendElement.js.map +1 -1
- package/core/element/ListItemElement.d.ts +2 -4
- package/core/element/ListItemElement.js +1 -28
- package/core/element/ListItemElement.js.map +1 -1
- package/core/element/MainElement.d.ts +2 -2
- package/core/element/MainElement.js +1 -10
- package/core/element/MainElement.js.map +1 -1
- package/core/element/NavElement.d.ts +2 -2
- package/core/element/NavElement.js +1 -10
- package/core/element/NavElement.js.map +1 -1
- package/core/element/OrderedListElement.d.ts +2 -2
- package/core/element/OrderedListElement.js +1 -10
- package/core/element/OrderedListElement.js.map +1 -1
- package/core/element/ParagraphElement.d.ts +2 -2
- package/core/element/ParagraphElement.js +1 -10
- package/core/element/ParagraphElement.js.map +1 -1
- package/core/element/PreElement.d.ts +2 -2
- package/core/element/PreElement.js +1 -10
- package/core/element/PreElement.js.map +1 -1
- package/core/element/SectionElement.d.ts +2 -2
- package/core/element/SectionElement.js +1 -12
- package/core/element/SectionElement.js.map +1 -1
- package/core/element/SelectElement.d.ts +2 -2
- package/core/element/SelectElement.js +1 -12
- package/core/element/SelectElement.js.map +1 -1
- package/core/element/SourceElement.d.ts +2 -5
- package/core/element/SourceElement.js +1 -14
- package/core/element/SourceElement.js.map +1 -1
- package/core/element/SpanElement.d.ts +2 -2
- package/core/element/SpanElement.js +1 -10
- package/core/element/SpanElement.js.map +1 -1
- package/core/element/StrongElement.d.ts +2 -2
- package/core/element/StrongElement.js +1 -12
- package/core/element/StrongElement.js.map +1 -1
- package/core/element/StyleElement.d.ts +2 -2
- package/core/element/StyleElement.js +1 -10
- package/core/element/StyleElement.js.map +1 -1
- package/core/element/SummaryElement.d.ts +2 -2
- package/core/element/SummaryElement.js +1 -12
- package/core/element/SummaryElement.js.map +1 -1
- package/core/element/SvgElement.d.ts +3 -3
- package/core/element/SvgElement.js +1 -151
- package/core/element/SvgElement.js.map +1 -1
- package/core/element/TableBodyElement.d.ts +2 -2
- package/core/element/TableBodyElement.js +1 -10
- package/core/element/TableBodyElement.js.map +1 -1
- package/core/element/TableCellElement.d.ts +3 -6
- package/core/element/TableCellElement.js +1 -25
- package/core/element/TableCellElement.js.map +1 -1
- package/core/element/TableColElement.d.ts +2 -4
- package/core/element/TableColElement.js +1 -13
- package/core/element/TableColElement.js.map +1 -1
- package/core/element/TableColGroupElement.d.ts +2 -4
- package/core/element/TableColGroupElement.js +1 -15
- package/core/element/TableColGroupElement.js.map +1 -1
- package/core/element/TableElement.d.ts +2 -42
- package/core/element/TableElement.js +1 -228
- package/core/element/TableElement.js.map +1 -1
- package/core/element/TableFootElement.d.ts +2 -2
- package/core/element/TableFootElement.js +1 -10
- package/core/element/TableFootElement.js.map +1 -1
- package/core/element/TableFootRowElement.d.ts +2 -2
- package/core/element/TableFootRowElement.js +1 -23
- package/core/element/TableFootRowElement.js.map +1 -1
- package/core/element/TableHeadCellElement.d.ts +2 -2
- package/core/element/TableHeadCellElement.js +1 -24
- package/core/element/TableHeadCellElement.js.map +1 -1
- package/core/element/TableHeadElement.d.ts +2 -2
- package/core/element/TableHeadElement.js +1 -10
- package/core/element/TableHeadElement.js.map +1 -1
- package/core/element/TableHeadRowElement.d.ts +2 -2
- package/core/element/TableHeadRowElement.js +1 -29
- package/core/element/TableHeadRowElement.js.map +1 -1
- package/core/element/TableRowElement.d.ts +2 -2
- package/core/element/TableRowElement.js +1 -29
- package/core/element/TableRowElement.js.map +1 -1
- package/core/element/TextAreaElement.d.ts +2 -4
- package/core/element/TextAreaElement.js +1 -10
- package/core/element/TextAreaElement.js.map +1 -1
- package/core/element/UListElement.d.ts +2 -2
- package/core/element/UListElement.js +1 -10
- package/core/element/UListElement.js.map +1 -1
- package/core/element/VideoElement.d.ts +2 -10
- package/core/element/VideoElement.js +1 -16
- package/core/element/VideoElement.js.map +1 -1
- package/core/element/index.d.ts +3 -3
- package/core/element/index.js +1 -73
- package/core/element/index.js.map +1 -1
- package/core/event/index.js +1 -75
- package/core/index.d.ts +0 -3
- package/core/index.js +1 -10
- package/core/index.js.map +1 -1
- package/core/ref/Computed.js +1 -75
- package/core/ref/Computed.js.map +1 -1
- package/core/ref/RefBoolean.js +1 -119
- package/core/ref/RefContainer.js +1 -114
- package/core/ref/RefContainer.js.map +1 -1
- package/core/ref/RefList.js +1 -240
- package/core/ref/RefMap.js +1 -149
- package/core/ref/RefNumber.js +1 -157
- package/core/ref/RefObject.js +1 -265
- package/core/ref/RefObject.js.map +1 -1
- package/core/ref/RefProperty.js +1 -46
- package/core/ref/RefSet.js +1 -148
- package/core/ref/RefState.js +1 -89
- package/core/ref/RefString.js +1 -179
- package/core/ref/RefString.js.map +1 -1
- package/core/ref/index.js +1 -71
- package/core/router/RouteView.d.ts +2 -2
- package/core/router/RouteView.js +1 -84
- package/core/router/RouteView.js.map +1 -1
- package/core/router/Router.d.ts +8 -9
- package/core/router/Router.js +1 -307
- package/core/router/Router.js.map +1 -1
- package/core/router/RouterEvent.js +1 -43
- package/core/router/RouterGuard.js +1 -3
- package/core/router/index.js +1 -5
- package/core/styles/index.d.ts +3 -3
- package/core/styles/index.js +1 -36
- package/core/styles/index.js.map +1 -1
- package/{core/app/index.d.ts → global/app.d.ts} +5 -7
- package/global/app.js +1 -0
- package/global/app.js.map +1 -0
- package/global/index.d.ts +10 -4
- package/global/index.js +1 -1286
- package/global/index.js.map +1 -1
- package/global/safari-polyfill.js +1 -234
- package/index.d.ts +1 -0
- package/index.js +1 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/style.scss +2 -17
- package/typings/index.d.ts +58 -66
- package/LICENSE +0 -21
- package/README.md +0 -62
- package/core/app/Validate.d.ts +0 -61
- package/core/app/Validate.js +0 -2
- package/core/app/Validate.js.map +0 -1
- package/core/app/index.js +0 -181
- package/core/app/index.js.map +0 -1
- package/core/components/TablePanel.d.ts +0 -34
- package/core/components/TablePanel.js +0 -127
- package/core/components/TablePanel.js.map +0 -1
- package/core/components/VirtualScroll copy 2.d.ts +0 -24
- package/core/components/VirtualScroll copy 2.js +0 -92
- package/core/components/VirtualScroll copy 2.js.map +0 -1
- package/core/ref/RefObject copy.d.ts +0 -124
- package/core/ref/RefObject copy.js +0 -271
- package/core/ref/RefObject copy.js.map +0 -1
package/core/ref/RefString.js
CHANGED
|
@@ -1,179 +1 @@
|
|
|
1
|
-
import { Ref }
|
|
2
|
-
import { RefContainer } from "./RefContainer";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a reactive wrapper around a string.
|
|
5
|
-
*
|
|
6
|
-
* @param value - The initial string value.
|
|
7
|
-
* @returns A new instance of RefString.
|
|
8
|
-
*/
|
|
9
|
-
export function refString(value) {
|
|
10
|
-
return new RefString(value);
|
|
11
|
-
}
|
|
12
|
-
// Allows `instanceof refString` to work properly
|
|
13
|
-
Object.defineProperty(refString, Symbol.hasInstance, {
|
|
14
|
-
value: function (instance) {
|
|
15
|
-
return !!instance && instance instanceof RefString;
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* A reactive string wrapper that mimics the String API,
|
|
20
|
-
* supports subscriptions to changes, and acts like a primitive.
|
|
21
|
-
*/
|
|
22
|
-
export class RefString {
|
|
23
|
-
id;
|
|
24
|
-
/**
|
|
25
|
-
* Internal container for value management and subscriptions.
|
|
26
|
-
*/
|
|
27
|
-
container;
|
|
28
|
-
/**
|
|
29
|
-
* Constructs a new RefString instance.
|
|
30
|
-
*
|
|
31
|
-
* @param value - Initial string value.
|
|
32
|
-
* @param refKey - Optional reference key for global registry.
|
|
33
|
-
*/
|
|
34
|
-
constructor(value) {
|
|
35
|
-
this.container = new RefContainer(value);
|
|
36
|
-
this.id = this.container.id;
|
|
37
|
-
Ref.set(this.id, this);
|
|
38
|
-
}
|
|
39
|
-
subscribe(target, propertyName, onUnsubscribe) {
|
|
40
|
-
return this.container.emit(this.container.subscribe(target, propertyName, onUnsubscribe), this.value, this.valueOf());
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Subscribes to future changes without emitting the current value.
|
|
44
|
-
*/
|
|
45
|
-
listen(target, onUnsubscribe) {
|
|
46
|
-
return this.container.subscribe(target, onUnsubscribe) !== undefined;
|
|
47
|
-
}
|
|
48
|
-
unsubscribe(targe, propertyName = "") {
|
|
49
|
-
return this.container.unsubscribe(targe, propertyName);
|
|
50
|
-
}
|
|
51
|
-
/** Reactive value access **/
|
|
52
|
-
/**
|
|
53
|
-
* Gets the current string value.
|
|
54
|
-
*/
|
|
55
|
-
get value() {
|
|
56
|
-
return this.container.value.valueOf();
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Sets a new value and notifies subscribers if it changed.
|
|
60
|
-
*
|
|
61
|
-
* @param value - The new string value.
|
|
62
|
-
*/
|
|
63
|
-
set value(value) {
|
|
64
|
-
this.emit("value", value);
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Emits a change notification if the value changed.
|
|
68
|
-
*/
|
|
69
|
-
// @ts-ignore
|
|
70
|
-
emit(propertyName, value) {
|
|
71
|
-
if (this.container.value === value.valueOf())
|
|
72
|
-
return;
|
|
73
|
-
const oldValue = this.container.valueOf();
|
|
74
|
-
this.container.emitAll(propertyName, (this.container.value = value.valueOf()), oldValue);
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Returns the string value as a primitive.
|
|
78
|
-
*/
|
|
79
|
-
[Symbol.toPrimitive](_hint) {
|
|
80
|
-
return this.container.toString();
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Ensures String is returned for string operations like concat/slice.
|
|
84
|
-
*/
|
|
85
|
-
static get [Symbol.species]() {
|
|
86
|
-
return String;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Returns the primitive string value.
|
|
90
|
-
*/
|
|
91
|
-
valueOf() {
|
|
92
|
-
return this.container.value.toString();
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Returns the string representation of the value.
|
|
96
|
-
*/
|
|
97
|
-
toString() {
|
|
98
|
-
return this.container.toString();
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Returns a JSON-serializable representation of the string.
|
|
102
|
-
*/
|
|
103
|
-
toJSON() {
|
|
104
|
-
return this.container.root ? this.value : { value: this.value };
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Returns the length of the string.
|
|
108
|
-
*/
|
|
109
|
-
get length() {
|
|
110
|
-
return this.container.value.length;
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Compares this string to another string.
|
|
114
|
-
*
|
|
115
|
-
* @param value - The value to compare with.
|
|
116
|
-
*/
|
|
117
|
-
equals(value) {
|
|
118
|
-
return this.container.valueOf() === value.valueOf();
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Allows iteration over each character in the string.
|
|
122
|
-
*/
|
|
123
|
-
[Symbol.iterator]() {
|
|
124
|
-
return this.container.value[Symbol.iterator]();
|
|
125
|
-
}
|
|
126
|
-
/** String method wrappers **/
|
|
127
|
-
charAt(pos) { return this.container.value.charAt(pos); }
|
|
128
|
-
charCodeAt(index) { return this.container.value.charCodeAt(index); }
|
|
129
|
-
codePointAt(pos) { return this.container.value.codePointAt(pos); }
|
|
130
|
-
concat(...strings) { return this.container.value.concat(...strings); }
|
|
131
|
-
indexOf(searchString, position) { return this.container.value.indexOf(searchString, position); }
|
|
132
|
-
lastIndexOf(searchString, position) { return this.container.value.lastIndexOf(searchString, position); }
|
|
133
|
-
includes(searchString, position) { return this.container.value.includes(searchString, position); }
|
|
134
|
-
startsWith(searchString, position) { return this.container.value.startsWith(searchString, position); }
|
|
135
|
-
endsWith(searchString, endPosition) { return this.container.value.endsWith(searchString, endPosition); }
|
|
136
|
-
slice(start, end) { return this.container.value.slice(start, end); }
|
|
137
|
-
substring(start, end) { return this.container.value.substring(start, end); }
|
|
138
|
-
substr(from, length) { return this.container.value.substr(from, length); }
|
|
139
|
-
match(regexp) { return this.container.value.match(regexp); }
|
|
140
|
-
matchAll(regexp) { return this.container.value.matchAll(regexp); }
|
|
141
|
-
replace(searchValue, replacer) { return this.container.value.replace(searchValue, replacer); }
|
|
142
|
-
replaceAll(searchValue, replacer) {
|
|
143
|
-
// @ts-ignore
|
|
144
|
-
return this.container.value.replaceAll(searchValue, replacer);
|
|
145
|
-
}
|
|
146
|
-
search(searcher) { return this.container.value.search(searcher); }
|
|
147
|
-
split(separator, limit) { return this.container.value.split(separator, limit); }
|
|
148
|
-
repeat(count) { return this.container.value.repeat(count); }
|
|
149
|
-
padStart(maxLength, fillString) { return this.container.value.padStart(maxLength, fillString); }
|
|
150
|
-
padEnd(maxLength, fillString) { return this.container.value.padEnd(maxLength, fillString); }
|
|
151
|
-
trim() { return this.container.value.trim(); }
|
|
152
|
-
trimStart() { return this.container.value.trimStart(); }
|
|
153
|
-
trimEnd() { return this.container.value.trimEnd(); }
|
|
154
|
-
trimLeft() { return this.container.value.trimLeft(); }
|
|
155
|
-
trimRight() { return this.container.value.trimRight(); }
|
|
156
|
-
toLowerCase() { return this.container.value.toLowerCase(); }
|
|
157
|
-
toUpperCase() { return this.container.value.toUpperCase(); }
|
|
158
|
-
toLocaleLowerCase(locales) { return this.container.value.toLocaleLowerCase(locales); }
|
|
159
|
-
toLocaleUpperCase(locales) { return this.container.value.toLocaleUpperCase(locales); }
|
|
160
|
-
normalize(form) { return this.container.value.normalize(form); }
|
|
161
|
-
localeCompare(that, locales, options) {
|
|
162
|
-
return this.container.value.localeCompare(that, locales, options);
|
|
163
|
-
}
|
|
164
|
-
/** Deprecated HTML string methods (still supported in JS) **/
|
|
165
|
-
anchor(name) { return this.container.value.anchor(name); }
|
|
166
|
-
big() { return this.container.value.big(); }
|
|
167
|
-
blink() { return this.container.value.blink(); }
|
|
168
|
-
bold() { return this.container.value.bold(); }
|
|
169
|
-
fixed() { return this.container.value.fixed(); }
|
|
170
|
-
fontcolor(color) { return this.container.value.fontcolor(color); }
|
|
171
|
-
fontsize(size) { return this.container.value.fontsize(size.toString()); }
|
|
172
|
-
italics() { return this.container.value.italics(); }
|
|
173
|
-
link(url) { return this.container.value.link(url); }
|
|
174
|
-
small() { return this.container.value.small(); }
|
|
175
|
-
strike() { return this.container.value.strike(); }
|
|
176
|
-
sub() { return this.container.value.sub(); }
|
|
177
|
-
sup() { return this.container.value.sup(); }
|
|
178
|
-
}
|
|
179
|
-
//# sourceMappingURL=RefString.js.map
|
|
1
|
+
import{Ref}from".";import{RefContainer}from"./RefContainer";export function refString(t){return new RefString(t)}Object.defineProperty(refString,Symbol.hasInstance,{value:function(t){return!!t&&t instanceof RefString}});export class RefString{id;container;constructor(t){this.container=new RefContainer(t),this.id=this.container.id,Ref.set(this.id,this)}subscribe(t,e,r){return this.container.emit(this.container.subscribe(t,e,r),this.value,this.valueOf())}listen(t,e){return void 0!==this.container.subscribe(t,e)}unsubscribe(t,e=""){return this.container.unsubscribe(t,e)}get value(){return this.container.value.valueOf()}set value(t){this.emit("value",t)}emit(t,e){if(this.container.value===e.valueOf())return;const r=this.value;this.container.emitAll(t,this.container.value=e.valueOf(),r)}[Symbol.toPrimitive](t){return this.container.toString()}static get[Symbol.species](){return String}valueOf(){return this.container.value.toString()}toString(){return this.container.toString()}toJSON(){return this.container.root?this.value:{value:this.value}}get length(){return this.container.value.length}equals(t){return this.container.valueOf()===t.valueOf()}[Symbol.iterator](){return this.container.value[Symbol.iterator]()}charAt(t){return this.container.value.charAt(t)}charCodeAt(t){return this.container.value.charCodeAt(t)}codePointAt(t){return this.container.value.codePointAt(t)}concat(...t){return this.container.value.concat(...t)}indexOf(t,e){return this.container.value.indexOf(t,e)}lastIndexOf(t,e){return this.container.value.lastIndexOf(t,e)}includes(t,e){return this.container.value.includes(t,e)}startsWith(t,e){return this.container.value.startsWith(t,e)}endsWith(t,e){return this.container.value.endsWith(t,e)}slice(t,e){return this.container.value.slice(t,e)}substring(t,e){return this.container.value.substring(t,e)}substr(t,e){return this.container.value.substr(t,e)}match(t){return this.container.value.match(t)}matchAll(t){return this.container.value.matchAll(t)}replace(t,e){return this.container.value.replace(t,e)}replaceAll(t,e){return this.container.value.replaceAll(t,e)}search(t){return this.container.value.search(t)}split(t,e){return this.container.value.split(t,e)}repeat(t){return this.container.value.repeat(t)}padStart(t,e){return this.container.value.padStart(t,e)}padEnd(t,e){return this.container.value.padEnd(t,e)}trim(){return this.container.value.trim()}trimStart(){return this.container.value.trimStart()}trimEnd(){return this.container.value.trimEnd()}trimLeft(){return this.container.value.trimLeft()}trimRight(){return this.container.value.trimRight()}toLowerCase(){return this.container.value.toLowerCase()}toUpperCase(){return this.container.value.toUpperCase()}toLocaleLowerCase(t){return this.container.value.toLocaleLowerCase(t)}toLocaleUpperCase(t){return this.container.value.toLocaleUpperCase(t)}normalize(t){return this.container.value.normalize(t)}localeCompare(t,e,r){return this.container.value.localeCompare(t,e,r)}anchor(t){return this.container.value.anchor(t)}big(){return this.container.value.big()}blink(){return this.container.value.blink()}bold(){return this.container.value.bold()}fixed(){return this.container.value.fixed()}fontcolor(t){return this.container.value.fontcolor(t)}fontsize(t){return this.container.value.fontsize(t.toString())}italics(){return this.container.value.italics()}link(t){return this.container.value.link(t)}small(){return this.container.value.small()}strike(){return this.container.value.strike()}sub(){return this.container.value.sub()}sup(){return this.container.value.sup()}}
|
|
@@ -1 +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;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,iDAAiD;AACjD,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;AAOH;;;GAGG;AACH,MAAM,OAAO,SAAS;IACX,EAAE,CAAS;IACpB;;OAEG;IACM,SAAS,CAAe;
|
|
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;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED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IAAI,CAAC,GAAW;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;IACD,KAAK;QACH,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;IACtC,CAAC;IACD,MAAM;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;IACvC,CAAC;IACD,GAAG;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACpC,CAAC;IACD,GAAG;QACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;IACpC,CAAC;CACF"}
|
package/core/ref/index.js
CHANGED
|
@@ -1,71 +1 @@
|
|
|
1
|
-
import {
|
|
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 * from "./Computed";
|
|
12
|
-
const subscribers = new WeakMap();
|
|
13
|
-
export class Ref {
|
|
14
|
-
static refs = new Map();
|
|
15
|
-
static onCreatedCallbacks = new Map();
|
|
16
|
-
static refsStatus = new Map();
|
|
17
|
-
static onCreated(refKey, action) {
|
|
18
|
-
Ref.onCreatedCallbacks.set(refKey, [...(Ref.onCreatedCallbacks.get(refKey) || []), action]);
|
|
19
|
-
}
|
|
20
|
-
static get(refKey) {
|
|
21
|
-
const _ref = Ref.refs.get(refKey);
|
|
22
|
-
return _ref?.deref();
|
|
23
|
-
}
|
|
24
|
-
static getStatus(refKey) {
|
|
25
|
-
if (!Ref.refsStatus.has(refKey)) {
|
|
26
|
-
Ref.refsStatus.set(refKey, ref("0"));
|
|
27
|
-
}
|
|
28
|
-
return Ref.refsStatus.get(refKey);
|
|
29
|
-
}
|
|
30
|
-
static set(refKey, value) {
|
|
31
|
-
Ref.refs.set(refKey, new WeakRef(value));
|
|
32
|
-
for (const callback of Ref.onCreatedCallbacks.get(refKey) || []) {
|
|
33
|
-
callback(value);
|
|
34
|
-
}
|
|
35
|
-
Ref.onCreatedCallbacks.delete(refKey);
|
|
36
|
-
}
|
|
37
|
-
static unsubscribe(target, propertyName) {
|
|
38
|
-
if (!subscribers.has(target))
|
|
39
|
-
return;
|
|
40
|
-
const propertyMap = subscribers.get(target);
|
|
41
|
-
const containerOld = propertyMap.get(propertyName);
|
|
42
|
-
if (containerOld)
|
|
43
|
-
containerOld.deref()?.unsubscribe(target, propertyName);
|
|
44
|
-
if (!propertyMap.has(propertyName))
|
|
45
|
-
return;
|
|
46
|
-
propertyMap.delete(propertyName);
|
|
47
|
-
}
|
|
48
|
-
static unsubscribeAll(target) {
|
|
49
|
-
if (!subscribers.has(target))
|
|
50
|
-
return;
|
|
51
|
-
const propertyMap = subscribers.get(target);
|
|
52
|
-
subscribers.delete(target);
|
|
53
|
-
for (const [key, value] of propertyMap) {
|
|
54
|
-
value.deref()?.unsubscribe(target, key);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
// in use
|
|
58
|
-
static subscribe(target, propertyName, container) {
|
|
59
|
-
if (!subscribers.has(target))
|
|
60
|
-
subscribers.set(target, new Map());
|
|
61
|
-
const propertyMap = subscribers.get(target);
|
|
62
|
-
if (propertyMap.has(propertyName)) {
|
|
63
|
-
const containerOld = propertyMap.get(propertyName);
|
|
64
|
-
if (containerOld)
|
|
65
|
-
containerOld.deref()?.unsubscribe(target, propertyName);
|
|
66
|
-
}
|
|
67
|
-
propertyMap.set(propertyName, new WeakRef(container));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
globalThis.Ref = Ref;
|
|
71
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import{ref}from"./RefObject";export*from"./RefBoolean";export*from"./RefNumber";export*from"./RefString";export*from"./RefMap";export*from"./RefList";export*from"./RefSet";export*from"./RefObject";export*from"./RefProperty";export*from"./RefState";export*from"./Computed";const subscribers=new WeakMap;export class Ref{static refs=new Map;static onCreatedCallbacks=new Map;static refsStatus=new Map;static onCreated(e,s){Ref.onCreatedCallbacks.set(e,[...Ref.onCreatedCallbacks.get(e)||[],s])}static get(e){const s=Ref.refs.get(e);return s?.deref()}static getStatus(e){return Ref.refsStatus.has(e)||Ref.refsStatus.set(e,ref("0")),Ref.refsStatus.get(e)}static set(e,s){Ref.refs.set(e,new WeakRef(s));for(const t of Ref.onCreatedCallbacks.get(e)||[])t(s);Ref.onCreatedCallbacks.delete(e)}static unsubscribe(e,s){if(!subscribers.has(e))return;const t=subscribers.get(e),r=t.get(s);r&&r.deref()?.unsubscribe(e,s),t.has(s)&&t.delete(s)}static unsubscribeAll(e){if(!subscribers.has(e))return;const s=subscribers.get(e);subscribers.delete(e);for(const[t,r]of s)r.deref()?.unsubscribe(e,t)}static subscribe(e,s,t){subscribers.has(e)||subscribers.set(e,new Map);const r=subscribers.get(e);if(r.has(s)){const t=r.get(s);t&&t.deref()?.unsubscribe(e,s)}r.set(s,new WeakRef(t))}}globalThis.Ref=Ref;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Component,
|
|
1
|
+
import { Component, ElementType } from "../..";
|
|
2
2
|
export declare class RouteView extends Component {
|
|
3
3
|
#private;
|
|
4
4
|
static readonly TAG: string;
|
|
5
5
|
private _view;
|
|
6
6
|
private _url;
|
|
7
7
|
private routePage;
|
|
8
|
-
constructor(props?:
|
|
8
|
+
constructor(props?: ElementType & {
|
|
9
9
|
defaultView?: ComponentType;
|
|
10
10
|
onUpdateView?: (view?: IComponent) => void;
|
|
11
11
|
});
|
package/core/router/RouteView.js
CHANGED
|
@@ -1,84 +1 @@
|
|
|
1
|
-
import { Component, Router }
|
|
2
|
-
export class RouteView extends Component {
|
|
3
|
-
static TAG = "tc-route-view";
|
|
4
|
-
_view = undefined;
|
|
5
|
-
_url = "";
|
|
6
|
-
routePage = undefined;
|
|
7
|
-
#defaultView = undefined;
|
|
8
|
-
#defaultComponent = undefined;
|
|
9
|
-
constructor(props) {
|
|
10
|
-
super();
|
|
11
|
-
this.#defaultView = props?.defaultView;
|
|
12
|
-
delete props?.defaultView;
|
|
13
|
-
delete props?.children;
|
|
14
|
-
Component.applyProps(this, props);
|
|
15
|
-
this.onEvent("router:watch", () => {
|
|
16
|
-
this.updateView();
|
|
17
|
-
props?.onUpdateView?.(this.view);
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
get url() {
|
|
21
|
-
return this._url;
|
|
22
|
-
}
|
|
23
|
-
connectedCallback() {
|
|
24
|
-
this.updateView();
|
|
25
|
-
}
|
|
26
|
-
append(...nodes) {
|
|
27
|
-
throw new Error("Method not implemented.");
|
|
28
|
-
}
|
|
29
|
-
appendChild(node) {
|
|
30
|
-
throw new Error("Method not implemented.");
|
|
31
|
-
}
|
|
32
|
-
async updateView() {
|
|
33
|
-
// @ts-ignore
|
|
34
|
-
const routePage = Router.getRouteViewFree(this);
|
|
35
|
-
if (routePage == undefined) {
|
|
36
|
-
if (this.routePage)
|
|
37
|
-
this.routePage.routeView = undefined;
|
|
38
|
-
this.view = undefined;
|
|
39
|
-
this.routePage = undefined;
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (routePage === this.routePage)
|
|
43
|
-
return;
|
|
44
|
-
if (routePage.build && routePage.build === this.routePage?.build) {
|
|
45
|
-
routePage.routeView = this;
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (routePage.component instanceof Function && routePage.component.prototype instanceof Element) {
|
|
49
|
-
// @ts-ignore
|
|
50
|
-
routePage.build = routePage.build || new routePage.component();
|
|
51
|
-
}
|
|
52
|
-
else if (!routePage.build) {
|
|
53
|
-
// @ts-ignore
|
|
54
|
-
const mod = await routePage.component();
|
|
55
|
-
routePage.build = new mod.default;
|
|
56
|
-
}
|
|
57
|
-
this.routePage = routePage;
|
|
58
|
-
this.view = routePage.build;
|
|
59
|
-
}
|
|
60
|
-
disconnectedCallback() {
|
|
61
|
-
if (this.routePage)
|
|
62
|
-
this.routePage.routeView = undefined;
|
|
63
|
-
this.routePage = undefined;
|
|
64
|
-
this.removeEvent("router:watch");
|
|
65
|
-
}
|
|
66
|
-
get view() {
|
|
67
|
-
return this._view;
|
|
68
|
-
}
|
|
69
|
-
set view(value) {
|
|
70
|
-
if (!value && this.#defaultView) {
|
|
71
|
-
value = this.#defaultComponent || new this.#defaultView;
|
|
72
|
-
this.#defaultComponent = value;
|
|
73
|
-
}
|
|
74
|
-
if (this._view == value)
|
|
75
|
-
return;
|
|
76
|
-
if (this._view)
|
|
77
|
-
this._view.remove();
|
|
78
|
-
this._view = value;
|
|
79
|
-
if (value)
|
|
80
|
-
super.append(value);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
TypeComposer.defineElement(RouteView.TAG, RouteView);
|
|
84
|
-
//# sourceMappingURL=RouteView.js.map
|
|
1
|
+
import{Component,Router}from"../..";export class RouteView extends Component{static TAG="tc-route-view";_view=void 0;_url="";routePage=void 0;#e=void 0;#t=void 0;constructor(e){super(),this.#e=e?.defaultView,delete e?.defaultView,delete e?.children,Component.applyProps(this,e),this.onEvent("router:watch",()=>{this.updateView(),e?.onUpdateView?.(this.view)})}get url(){return this._url}connectedCallback(){this.updateView()}append(...e){throw new Error("Method not implemented.")}appendChild(e){throw new Error("Method not implemented.")}async updateView(){const e=Router.getRouteViewFree(this);if(null==e)return this.routePage&&(this.routePage.routeView=void 0),this.view=void 0,void(this.routePage=void 0);if(e!==this.routePage)if(e.build&&e.build===this.routePage?.build)e.routeView=this;else{if(e.component instanceof Function&&e.component.prototype instanceof Element)e.build=e.build||new e.component;else if(!e.build){const t=await e.component();e.build=new t.default}this.routePage=e,this.view=e.build}}disconnectedCallback(){this.routePage&&(this.routePage.routeView=void 0),this.routePage=void 0,this.removeEvent("router:watch")}get view(){return this._view}set view(e){!e&&this.#e&&(e=this.#t||new this.#e,this.#t=e),this._view!=e&&(this._view&&this._view.remove(),this._view=e,e&&super.append(e))}}TypeComposer.defineElement(RouteView.TAG,RouteView);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouteView.js","sourceRoot":"","sources":["../../../src/core/router/RouteView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"RouteView.js","sourceRoot":"","sources":["../../../src/core/router/RouteView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAe,MAAM,OAAO,CAAC;AAUvD,MAAM,OAAO,SAAU,SAAQ,SAAS;IACtC,MAAM,CAAU,GAAG,GAAW,eAAe,CAAC;IACtC,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,cAAc,EAAE,GAAG,EAAE;YAChC,IAAI,CAAC,UAAU,EAAE,CAAA;YACjB,KAAK,EAAE,YAAY,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,UAAU,EAAE,CAAC;IACpB,CAAC;IAED,MAA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CAAC;IAC9B,CAAC;IAED,oBAAoB;QAClB,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;;AAEH,YAAY,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC"}
|
package/core/router/Router.d.ts
CHANGED
|
@@ -36,12 +36,11 @@ export declare class Router {
|
|
|
36
36
|
* @param data - An array of route objects.
|
|
37
37
|
* @param history - The type of history to use. Can be either "hash" or "history".
|
|
38
38
|
* @returns {void}
|
|
39
|
-
|
|
39
|
+
*/
|
|
40
40
|
static readonly PATH_WILDCARD = "**";
|
|
41
41
|
beforeEach: (to: RouteMatch) => void;
|
|
42
42
|
private constructor();
|
|
43
43
|
private createAutoId;
|
|
44
|
-
private getQueryParams;
|
|
45
44
|
private handleRoute;
|
|
46
45
|
private buildRoutePage;
|
|
47
46
|
private checkGuard;
|
|
@@ -65,14 +64,14 @@ export declare class Router {
|
|
|
65
64
|
static go(url: string, props?: {}): Promise<void>;
|
|
66
65
|
static back(): void;
|
|
67
66
|
static forward(): void;
|
|
68
|
-
|
|
67
|
+
protected static getRouteViewFree(routeView: RouteView): RoutePageBuild | undefined;
|
|
69
68
|
/**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
69
|
+
* Returns the Location object's URL's path.
|
|
70
|
+
*
|
|
71
|
+
* Can be set, to navigate to the same URL with a changed path.
|
|
72
|
+
*
|
|
73
|
+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/Location/pathname)
|
|
74
|
+
*/
|
|
76
75
|
static get pathname(): string;
|
|
77
76
|
}
|
|
78
77
|
export {};
|