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,211 @@
|
|
|
1
|
+
import { RefNumber, RefString, RefBoolean, RefMap, RefList, Ref, RefState } from ".";
|
|
2
|
+
import { RefContainer } from "./RefContainer";
|
|
3
|
+
import { RefSet } from "./RefSet";
|
|
4
|
+
class RefObjectContainer extends RefContainer {
|
|
5
|
+
refKey;
|
|
6
|
+
root;
|
|
7
|
+
instance = { value: null };
|
|
8
|
+
constructor(value, refKey, root) {
|
|
9
|
+
super(value, root);
|
|
10
|
+
this.refKey = refKey;
|
|
11
|
+
this.root = root;
|
|
12
|
+
RefObjectContainer.createObject.bind(this)(this.value, value, this);
|
|
13
|
+
}
|
|
14
|
+
valueOf() {
|
|
15
|
+
return this.instance.value;
|
|
16
|
+
}
|
|
17
|
+
static createObject(proxy, value, container) {
|
|
18
|
+
for (const key in value) {
|
|
19
|
+
const refKey = container.refKey && `${container.refKey}:${key}`;
|
|
20
|
+
if (value[key] instanceof Array) {
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
proxy[key] = new RefList(...value[key], refKey);
|
|
23
|
+
}
|
|
24
|
+
else if (value[key] instanceof Set) {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
proxy[key] = new RefSet(value[key], refKey);
|
|
27
|
+
}
|
|
28
|
+
else if (value[key] instanceof Map) {
|
|
29
|
+
// @ts-ignore
|
|
30
|
+
proxy[key] = new RefMap(value[key], refKey);
|
|
31
|
+
}
|
|
32
|
+
else if (typeof value[key] === "string" || value[key] instanceof String) {
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
proxy[key] = new RefString(value[key].valueOf(), refKey);
|
|
35
|
+
}
|
|
36
|
+
else if (typeof value[key] === "number" || value[key] instanceof Number) {
|
|
37
|
+
// @ts-ignore
|
|
38
|
+
proxy[key] = new RefNumber(value[key].valueOf(), refKey);
|
|
39
|
+
}
|
|
40
|
+
else if (typeof value[key] === "boolean" || value[key] instanceof Boolean) {
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
proxy[key] = new RefBoolean(value[key].valueOf(), refKey);
|
|
43
|
+
}
|
|
44
|
+
else if (value[key] instanceof Element) {
|
|
45
|
+
//proxy[key] =
|
|
46
|
+
}
|
|
47
|
+
else if (value[key] instanceof Object) {
|
|
48
|
+
proxy[key] = creatObservador(value[key], new RefObjectContainer(value[key], refKey, (container["root"] || this)));
|
|
49
|
+
}
|
|
50
|
+
if (proxy[key] instanceof ref) {
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
proxy[key]["container"].root = container.root || this;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static applyObject(proxy, value, container) {
|
|
57
|
+
const keysOld = Object.keys(proxy);
|
|
58
|
+
const keys = Object.keys(value);
|
|
59
|
+
const keysRemove = keysOld.filter((k) => !keys.includes(k));
|
|
60
|
+
const keysUpdate = keys.filter((k) => keysOld.includes(k));
|
|
61
|
+
const keysNew = keys.filter((k) => !keysOld.includes(k));
|
|
62
|
+
for (const key of keysRemove) {
|
|
63
|
+
if (!keys.includes(key)) {
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
delete proxy[key];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
for (const key of keysUpdate) {
|
|
69
|
+
// @ts-ignore
|
|
70
|
+
if (proxy[key] instanceof ref) {
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
proxy[key].emit(key, value[key]);
|
|
73
|
+
}
|
|
74
|
+
// @ts-ignore
|
|
75
|
+
else if (!(proxy[key] instanceof Element) && proxy[key] instanceof Object) {
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
RefObjectContainer.applyObject(proxy[key], value[key], container);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (keysNew.length === 0)
|
|
81
|
+
return;
|
|
82
|
+
const newObject = {};
|
|
83
|
+
for (const key of keysNew) {
|
|
84
|
+
// @ts-ignore
|
|
85
|
+
newObject[key] = value[key];
|
|
86
|
+
}
|
|
87
|
+
RefObjectContainer.createObject.bind(this)(proxy, newObject, container);
|
|
88
|
+
}
|
|
89
|
+
emitAll(propertyName, value) {
|
|
90
|
+
super.emitAll(propertyName, value);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
function applyProxy(target, key, value, receiver, container) {
|
|
95
|
+
if (target[key] instanceof ref) {
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
target[key].emit(key, value);
|
|
98
|
+
}
|
|
99
|
+
else if (!(target[key] instanceof Element) && target[key] instanceof Object) {
|
|
100
|
+
RefObjectContainer.applyObject(target[key], value, container);
|
|
101
|
+
}
|
|
102
|
+
else if (value !== undefined && value !== null) {
|
|
103
|
+
console.log("applyProxy", key, value);
|
|
104
|
+
RefObjectContainer.createObject(target, { [key]: value }, container);
|
|
105
|
+
}
|
|
106
|
+
else
|
|
107
|
+
Reflect.set(target, key, value, receiver);
|
|
108
|
+
return receiver;
|
|
109
|
+
}
|
|
110
|
+
function creatObservador(obj, container) {
|
|
111
|
+
const refObject = new Proxy(obj, {
|
|
112
|
+
// @ts-ignore
|
|
113
|
+
get(target, key, receiver) {
|
|
114
|
+
return Reflect.get(target, key, receiver);
|
|
115
|
+
},
|
|
116
|
+
// @ts-ignore
|
|
117
|
+
set(target, key, value, receiver) {
|
|
118
|
+
receiver = applyProxy(target, key, value, receiver, container);
|
|
119
|
+
console.log("set", key, value);
|
|
120
|
+
container.emitAll(key, value);
|
|
121
|
+
return receiver;
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
container.value = refObject;
|
|
125
|
+
return refObject;
|
|
126
|
+
}
|
|
127
|
+
export function ref(value, refKey) {
|
|
128
|
+
if (value === undefined || value === null)
|
|
129
|
+
throw new Error("ref: value cannot be null or undefined");
|
|
130
|
+
value = deepCopy(value);
|
|
131
|
+
if (typeof value === "string" || value instanceof String) {
|
|
132
|
+
return new RefString(value.valueOf(), refKey);
|
|
133
|
+
}
|
|
134
|
+
else if (typeof value === "number" || value instanceof Number) {
|
|
135
|
+
return new RefNumber(value.valueOf(), refKey);
|
|
136
|
+
}
|
|
137
|
+
else if (typeof value === "boolean" || value instanceof Boolean) {
|
|
138
|
+
return new RefBoolean(value.valueOf(), refKey);
|
|
139
|
+
}
|
|
140
|
+
else if (value instanceof Array) {
|
|
141
|
+
return new RefList(value, refKey);
|
|
142
|
+
}
|
|
143
|
+
else if (value instanceof Set) {
|
|
144
|
+
return new RefSet(value, refKey);
|
|
145
|
+
}
|
|
146
|
+
else if (value instanceof Map) {
|
|
147
|
+
return new RefMap(value, refKey);
|
|
148
|
+
}
|
|
149
|
+
const container = new RefObjectContainer(value, refKey || "");
|
|
150
|
+
const proxy = creatObservador(value, container);
|
|
151
|
+
const instance = {
|
|
152
|
+
value: proxy,
|
|
153
|
+
subscribe: container.subscribe.bind(container),
|
|
154
|
+
unsubscribe: container.unsubscribe.bind(container),
|
|
155
|
+
toString: container.toString.bind(container),
|
|
156
|
+
toJSON: container.toJSON.bind(container),
|
|
157
|
+
valueOf: container.valueOf.bind(container),
|
|
158
|
+
};
|
|
159
|
+
container["instance"] = instance;
|
|
160
|
+
Object.defineProperty(instance, Symbol.iterator, {
|
|
161
|
+
value: function* () {
|
|
162
|
+
for (const key in instance.value) {
|
|
163
|
+
yield instance.value[key]?.valueOf() || instance.value[key];
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
});
|
|
167
|
+
Object.defineProperty(instance, "value", {
|
|
168
|
+
get() {
|
|
169
|
+
return proxy;
|
|
170
|
+
},
|
|
171
|
+
set(value) {
|
|
172
|
+
RefObjectContainer.applyObject(proxy, value, container);
|
|
173
|
+
container.emitAll("value", value);
|
|
174
|
+
},
|
|
175
|
+
});
|
|
176
|
+
Object.setPrototypeOf(instance, ref.prototype);
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
if (refKey)
|
|
179
|
+
Ref.set(refKey, instance);
|
|
180
|
+
return instance;
|
|
181
|
+
}
|
|
182
|
+
Object.defineProperty(ref, Symbol.hasInstance, {
|
|
183
|
+
value: function (instance) {
|
|
184
|
+
return (!!instance && typeof instance === "object" &&
|
|
185
|
+
(instance === ref ||
|
|
186
|
+
Object.getPrototypeOf(instance) === ref.prototype ||
|
|
187
|
+
instance instanceof RefString ||
|
|
188
|
+
instance instanceof RefNumber ||
|
|
189
|
+
instance instanceof RefBoolean ||
|
|
190
|
+
instance instanceof RefList ||
|
|
191
|
+
instance instanceof RefSet ||
|
|
192
|
+
instance instanceof RefMap ||
|
|
193
|
+
instance instanceof RefState));
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
export function computed(fn, observers) {
|
|
197
|
+
const r = ref(fn());
|
|
198
|
+
// @ts-ignore
|
|
199
|
+
const func = () => r.value = fn();
|
|
200
|
+
if (observers) {
|
|
201
|
+
for (const item of observers) {
|
|
202
|
+
if (item instanceof ref) {
|
|
203
|
+
// @ts-ignore
|
|
204
|
+
item.subscribe(func);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// @ts-ignore
|
|
209
|
+
return r;
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=RefObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefObject.js","sourceRoot":"","sources":["../../../src/core/ref/RefObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SA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,CAAC,WAAW,EAAE;IAC7C,KAAK,EAAE,UAAU,QAAa;QAC5B,OAAO,CACL,CAAC,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ;YAC1C,CAAC,QAAQ,KAAK,GAAG;gBACf,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,GAAG,CAAC,SAAS;gBACjD,QAAQ,YAAY,SAAS;gBAC7B,QAAQ,YAAY,SAAS;gBAC7B,QAAQ,YAAY,UAAU;gBAC9B,QAAQ,YAAY,OAAO;gBAC3B,QAAQ,YAAY,MAAM;gBAC1B,QAAQ,YAAY,MAAM;gBAC1B,QAAQ,YAAY,QAAQ,CAAC,CAChC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAIH,MAAM,UAAU,QAAQ,CAAI,EAA0B,EAAE,SAAqB;IAC3E,MAAM,CAAC,GAAG,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IACpB,aAAa;IACb,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,EAAE,CAAC;IAClC,IAAI,SAAS,EAAE,CAAC;QACd,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;YAC7B,IAAI,IAAI,YAAY,GAAG,EAAE,CAAC;gBACxB,aAAa;gBACb,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC;IACD,aAAa;IACb,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { RefString } from ".";
|
|
2
|
+
export function refProperty(value, propertyName, target) {
|
|
3
|
+
if (!target)
|
|
4
|
+
throw new Error("refProperty: needs to be inside a component");
|
|
5
|
+
const ref = new RefString(value || target?.getAttribute(propertyName) || "");
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
ref.propertyName = propertyName;
|
|
8
|
+
ref.subscribe((value) => {
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
if (target?.getAttribute(ref.propertyName) === value)
|
|
11
|
+
return;
|
|
12
|
+
// @ts-ignore
|
|
13
|
+
target.setAttribute(ref.propertyName, value || "");
|
|
14
|
+
});
|
|
15
|
+
createObserver(target, ref);
|
|
16
|
+
return ref;
|
|
17
|
+
}
|
|
18
|
+
Object.defineProperty(refProperty, Symbol.hasInstance, {
|
|
19
|
+
value: function (instance) {
|
|
20
|
+
return !!instance && (instance instanceof RefString);
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
function createObserver(target, ref) {
|
|
24
|
+
if (target["___observer___"]) {
|
|
25
|
+
const ___refs___ = target["___observer___"]["___refs___"];
|
|
26
|
+
___refs___.push(ref);
|
|
27
|
+
return target["___observer___"];
|
|
28
|
+
}
|
|
29
|
+
const observer = new MutationObserver((mutations) => {
|
|
30
|
+
mutations.forEach((mutation) => {
|
|
31
|
+
const items = observer["___refs___"];
|
|
32
|
+
if (mutation.attributeName) {
|
|
33
|
+
for (const ref of items) {
|
|
34
|
+
if (mutation.attributeName === ref.propertyName) {
|
|
35
|
+
ref.value = target.getAttribute(ref.propertyName) || "";
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
observer["___refs___"] = [ref];
|
|
42
|
+
observer.observe(target, { attributes: true });
|
|
43
|
+
target["___observer___"] = observer;
|
|
44
|
+
return observer;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=RefProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefProperty.js","sourceRoot":"","sources":["../../../src/core/ref/RefProperty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAG9B,MAAM,UAAU,WAAW,CAAC,KAAc,EAAE,YAAqB,EAAE,MAAoB;IACrF,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IAC5E,MAAM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AG,IAAI,KAAK,EAAE,CAAC;oBACxB,IAAI,QAAQ,CAAC,aAAa,KAAK,GAAG,CAAC,YAAY,EAAE,CAAC;wBAChD,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;oBAC1D,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC/B,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,MAAM,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC;IACpC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ref } from ".";
|
|
2
|
+
import { RefContainer } from "./RefContainer";
|
|
3
|
+
export declare function refSet<U>(values?: readonly U[] | null): RefSet<U>;
|
|
4
|
+
export type refSet<U> = Set<U> | RefSet<U>;
|
|
5
|
+
export declare class RefSet<U> extends Set<U> implements ref<Set<U>> {
|
|
6
|
+
readonly container: RefContainer;
|
|
7
|
+
readonly refKey: string;
|
|
8
|
+
constructor(values?: readonly U[] | null, refKey?: string);
|
|
9
|
+
private emit;
|
|
10
|
+
subscribe(target: (arg: Set<U>) => void): boolean;
|
|
11
|
+
subscribe(target: (arg: Set<U>) => void, onUnsubscribe: Function): boolean;
|
|
12
|
+
subscribe(target: object, propertyName: string | symbol): boolean;
|
|
13
|
+
subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
|
|
14
|
+
subscribe(target: object | ((arg: Set<U>) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
|
|
15
|
+
unsubscribe(target: (arg: Set<U>) => void): boolean;
|
|
16
|
+
unsubscribe(targe: object, propertyName: string | symbol): boolean;
|
|
17
|
+
add(value: U): this;
|
|
18
|
+
delete(value: U): boolean;
|
|
19
|
+
clear(): void;
|
|
20
|
+
valueOf(): Set<U>;
|
|
21
|
+
static get [Symbol.species](): SetConstructor;
|
|
22
|
+
get value(): Set<U>;
|
|
23
|
+
set value(value: Set<U>);
|
|
24
|
+
toJSON(): any;
|
|
25
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Ref } from ".";
|
|
2
|
+
import { RefContainer } from "./RefContainer";
|
|
3
|
+
export function refSet(values) {
|
|
4
|
+
return new RefSet(values);
|
|
5
|
+
}
|
|
6
|
+
Object.defineProperty(refSet, Symbol.hasInstance, {
|
|
7
|
+
value: function (instance) {
|
|
8
|
+
return !!instance && instance instanceof RefSet;
|
|
9
|
+
},
|
|
10
|
+
});
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
export class RefSet extends Set {
|
|
13
|
+
container = new RefContainer(this);
|
|
14
|
+
refKey;
|
|
15
|
+
constructor(values, refKey) {
|
|
16
|
+
super();
|
|
17
|
+
this.refKey = refKey;
|
|
18
|
+
this.value = new Set(values);
|
|
19
|
+
refKey && Ref.set(refKey, this);
|
|
20
|
+
}
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
emit(propertyName, value) {
|
|
23
|
+
this.container.emitAll(propertyName, value);
|
|
24
|
+
}
|
|
25
|
+
subscribe(target, propertyName, onUnsubscribe) {
|
|
26
|
+
return this.container.emit(this.container.subscribe(target, propertyName, onUnsubscribe), this);
|
|
27
|
+
}
|
|
28
|
+
unsubscribe(targe, propertyName = "") {
|
|
29
|
+
return this.container.unsubscribe(targe, propertyName);
|
|
30
|
+
}
|
|
31
|
+
add(value) {
|
|
32
|
+
const result = super.add(value);
|
|
33
|
+
this.container.emitAll("add", this);
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
delete(value) {
|
|
37
|
+
const result = super.delete(value);
|
|
38
|
+
this.container.emitAll("delete", this);
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
clear() {
|
|
42
|
+
super.clear();
|
|
43
|
+
this.container.emitAll("clear", this);
|
|
44
|
+
}
|
|
45
|
+
valueOf() {
|
|
46
|
+
return new Set(Array.from(this));
|
|
47
|
+
}
|
|
48
|
+
static get [Symbol.species]() {
|
|
49
|
+
return Set;
|
|
50
|
+
}
|
|
51
|
+
get value() {
|
|
52
|
+
return this.container.value.valueOf();
|
|
53
|
+
}
|
|
54
|
+
set value(value) {
|
|
55
|
+
if (this === value)
|
|
56
|
+
return;
|
|
57
|
+
super.clear();
|
|
58
|
+
for (const val of value) {
|
|
59
|
+
super.add(val);
|
|
60
|
+
}
|
|
61
|
+
this.emit("value", value);
|
|
62
|
+
}
|
|
63
|
+
toJSON() {
|
|
64
|
+
const obj = {};
|
|
65
|
+
let i = 0;
|
|
66
|
+
for (const v of this.value) {
|
|
67
|
+
obj[i++] = v;
|
|
68
|
+
}
|
|
69
|
+
return obj;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=RefSet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefSet.js","sourceRoot":"","sources":["../../../src/core/ref/RefSet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAO,MAAM,GAAG,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,UAAU,MAAM,CAAI,MAA4B;IACpD,OAAO,IAAI,MAAM,CAAI,MAAM,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE;IAChD,KAAK,EAAE,UAAU,QAAa;QAC5B,OAAO,CAAC,CAAC,QAAQ,IAAI,QAAQ,YAAY,MAAM,CAAC;IAClD,CAAC;CACF,CAAC,CAAC;AAGH,aAAa;AACb,MAAM,OAAO,MAAU,SAAQ,GAAM;IAC1B,SAAS,GAAiB,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;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IAAI,CAAC,CAAC;IACxC,CAAC;IAED,OAAO;QACL,OAAO,IAAI,GAAG,CAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACxC,CAAC;IAED,IAAI,KAAK,CAAC,KAAa;QACrB,IAAI,IAAI,KAAK,KAAK;YAAE,OAAO;QAC3B,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;YACxB,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM;QACJ,MAAM,GAAG,GAAQ,EAAE,CAAC;QACpB,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAC3B,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ref } from ".";
|
|
2
|
+
export declare function refState<T>(refKey: string): RefState<T>;
|
|
3
|
+
export type refState<T> = RefState<T>;
|
|
4
|
+
export declare class RefState<T> implements ref<T> {
|
|
5
|
+
#private;
|
|
6
|
+
readonly refKey: string;
|
|
7
|
+
constructor(refKey: string);
|
|
8
|
+
get active(): boolean;
|
|
9
|
+
get ref(): ref<T>;
|
|
10
|
+
private emit;
|
|
11
|
+
subscribe(target: (arg: T) => void): boolean;
|
|
12
|
+
subscribe(target: (arg: T) => void, onUnsubscribe: Function): boolean;
|
|
13
|
+
subscribe(target: object, propertyName: string | symbol): boolean;
|
|
14
|
+
subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
|
|
15
|
+
subscribe(target: object | ((arg: boolean) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
|
|
16
|
+
unsubscribe(target: (arg: T) => void): boolean;
|
|
17
|
+
unsubscribe(target: object, propertyName: string | symbol): boolean;
|
|
18
|
+
get value(): T;
|
|
19
|
+
set value(value: T);
|
|
20
|
+
valueOf(): T;
|
|
21
|
+
toJSON(): {};
|
|
22
|
+
toString(): string;
|
|
23
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { Ref } from ".";
|
|
2
|
+
export function refState(refKey) {
|
|
3
|
+
return new RefState(refKey);
|
|
4
|
+
}
|
|
5
|
+
Object.defineProperty(refState, Symbol.hasInstance, {
|
|
6
|
+
value: function (instance) {
|
|
7
|
+
return !!instance && instance instanceof RefState;
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export class RefState {
|
|
11
|
+
refKey;
|
|
12
|
+
#ref;
|
|
13
|
+
#subscribers = [];
|
|
14
|
+
constructor(refKey) {
|
|
15
|
+
this.refKey = refKey;
|
|
16
|
+
this.#ref = Ref.get(refKey);
|
|
17
|
+
if (!this.#ref) {
|
|
18
|
+
Ref.onCreated(refKey, (ref) => {
|
|
19
|
+
this.#ref = ref;
|
|
20
|
+
for (const subscriber of this.#subscribers) {
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
this.#ref?.subscribe(subscriber.target, subscriber.propertyName, subscriber.onUnsubscribe);
|
|
23
|
+
}
|
|
24
|
+
this.#subscribers = undefined;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
get active() {
|
|
29
|
+
return !!this.#ref;
|
|
30
|
+
}
|
|
31
|
+
get ref() {
|
|
32
|
+
return this.#ref;
|
|
33
|
+
}
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
emit(propertyName, value) {
|
|
36
|
+
if (this.ref) {
|
|
37
|
+
this.ref.value = value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
subscribe(target, propertyName, onUnsubscribe) {
|
|
41
|
+
if (this.ref) {
|
|
42
|
+
// @ts-ignore
|
|
43
|
+
return this.ref.subscribe(target, propertyName, onUnsubscribe);
|
|
44
|
+
}
|
|
45
|
+
this.#subscribers.push({ target, propertyName, onUnsubscribe });
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
48
|
+
unsubscribe(targe, propertyName = "") {
|
|
49
|
+
if (this.ref) {
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
return this.ref.unsubscribe(targe, propertyName);
|
|
52
|
+
}
|
|
53
|
+
this.#subscribers = this.#subscribers.filter(subscriber => subscriber.target !== targe && subscriber.propertyName !== propertyName);
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
get value() {
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
return this.ref?.value;
|
|
60
|
+
}
|
|
61
|
+
// @ts-ignore
|
|
62
|
+
set value(value) {
|
|
63
|
+
if (this.ref) {
|
|
64
|
+
// @ts-ignore
|
|
65
|
+
this.ref.value = value;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
valueOf() {
|
|
69
|
+
return this.ref?.valueOf();
|
|
70
|
+
}
|
|
71
|
+
// @ts-ignore
|
|
72
|
+
toJSON() {
|
|
73
|
+
return this.ref?.toJSON() || {};
|
|
74
|
+
}
|
|
75
|
+
toString() {
|
|
76
|
+
return "this.ref?.toString() || ";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=RefState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RefState.js","sourceRoot":"","sources":["../../../src/core/ref/RefState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAO,MAAM,GAAG,CAAC;AAE7B,MAAM,UAAU,QAAQ,CAAI,M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AAC;CACF"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { ref } from ".";
|
|
2
|
+
import { RefContainer } from "./RefContainer";
|
|
3
|
+
export declare function refString(value: string): RefString;
|
|
4
|
+
export type refString = string | RefString;
|
|
5
|
+
export declare class RefString implements ref<string> {
|
|
6
|
+
readonly container: RefContainer;
|
|
7
|
+
readonly [index: number]: string;
|
|
8
|
+
readonly refKey: string;
|
|
9
|
+
constructor(value: string, refKey?: string);
|
|
10
|
+
charAt(pos: number): string;
|
|
11
|
+
charCodeAt(index: number): number;
|
|
12
|
+
concat(...strings: string[]): string;
|
|
13
|
+
indexOf(searchString: string, position?: number): number;
|
|
14
|
+
lastIndexOf(searchString: string, position?: number): number;
|
|
15
|
+
localeCompare(that: string, locales?: Intl.LocalesArgument, options?: Intl.CollatorOptions): number;
|
|
16
|
+
match(regexp: string | RegExp): RegExpMatchArray | null;
|
|
17
|
+
replace(searchValue: string | RegExp, replacer: string): string;
|
|
18
|
+
search(searcher: string | RegExp): number;
|
|
19
|
+
slice(start?: number, end?: number): string;
|
|
20
|
+
split(separator: string | RegExp, limit?: number): string[];
|
|
21
|
+
substring(start: number, end?: number): string;
|
|
22
|
+
toLowerCase(): string;
|
|
23
|
+
toLocaleLowerCase(locales?: string): string;
|
|
24
|
+
toUpperCase(): string;
|
|
25
|
+
toLocaleUpperCase(locales?: string): string;
|
|
26
|
+
trim(): string;
|
|
27
|
+
substr(from: number, length?: number): string;
|
|
28
|
+
codePointAt(pos: number): number | undefined;
|
|
29
|
+
includes(searchString: string, position?: number): boolean;
|
|
30
|
+
endsWith(searchString: string, endPosition?: number): boolean;
|
|
31
|
+
normalize(form?: string): string;
|
|
32
|
+
repeat(count: number): string;
|
|
33
|
+
startsWith(searchString: string, position?: number): boolean;
|
|
34
|
+
anchor(name: string): string;
|
|
35
|
+
big(): string;
|
|
36
|
+
blink(): string;
|
|
37
|
+
bold(): string;
|
|
38
|
+
fixed(): string;
|
|
39
|
+
fontcolor(color: string): string;
|
|
40
|
+
fontsize(size: number | string): string;
|
|
41
|
+
italics(): string;
|
|
42
|
+
link(url: string): string;
|
|
43
|
+
small(): string;
|
|
44
|
+
strike(): string;
|
|
45
|
+
sub(): string;
|
|
46
|
+
sup(): string;
|
|
47
|
+
padStart(maxLength: number, fillString?: string): string;
|
|
48
|
+
padEnd(maxLength: number, fillString?: string): string;
|
|
49
|
+
trimEnd(): string;
|
|
50
|
+
trimStart(): string;
|
|
51
|
+
trimLeft(): string;
|
|
52
|
+
trimRight(): string;
|
|
53
|
+
matchAll(regexp: RegExp): RegExpStringIterator<RegExpExecArray>;
|
|
54
|
+
replaceAll(searchValue: string, replacer: string | ((substring: string, ...args: any[]) => string)): string;
|
|
55
|
+
[Symbol.iterator](): StringIterator<string>;
|
|
56
|
+
equals(value: string): boolean;
|
|
57
|
+
valueOf(): string;
|
|
58
|
+
get length(): number;
|
|
59
|
+
protected emit(propertyName: string | symbol, value: any): void;
|
|
60
|
+
subscribe(target: (arg: string) => void): boolean;
|
|
61
|
+
subscribe(target: (arg: string) => void, onUnsubscribe: Function): boolean;
|
|
62
|
+
subscribe(target: object, propertyName: string | symbol): boolean;
|
|
63
|
+
subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
|
|
64
|
+
subscribe(target: object | ((arg: string) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
|
|
65
|
+
unsubscribe(target: (arg: string) => void): boolean;
|
|
66
|
+
unsubscribe(targe: object, propertyName: string | symbol): boolean;
|
|
67
|
+
[Symbol.toPrimitive](_hint: string): string;
|
|
68
|
+
static get [Symbol.species](): StringConstructor;
|
|
69
|
+
get value(): string;
|
|
70
|
+
set value(value: string);
|
|
71
|
+
toJSON(): string | {
|
|
72
|
+
value: string;
|
|
73
|
+
};
|
|
74
|
+
toString(): string;
|
|
75
|
+
}
|