typecomposer 0.1.47 → 0.1.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{core → dist/core}/index.d.ts +0 -3
- package/{core → dist/core}/index.js +0 -3
- package/dist/core/index.js.map +1 -0
- package/{core → dist/core}/styles/index.d.ts +3 -3
- package/{core → dist/core}/styles/index.js +0 -8
- package/{core → dist/core}/styles/index.js.map +1 -1
- package/{global → dist/global}/index.d.ts +10 -4
- package/{global → dist/global}/index.js +387 -322
- package/dist/global/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/{index.d.ts → dist/index.js} +1 -0
- package/dist/index.js.map +1 -0
- package/package.json +31 -6
- package/styles/style.scss +2 -17
- package/typings/index.d.ts +58 -66
- 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.d.ts +0 -40
- package/core/app/index.js +0 -181
- package/core/app/index.js.map +0 -1
- package/core/components/AlertPanel.d.ts +0 -32
- package/core/components/AlertPanel.js +0 -75
- package/core/components/AlertPanel.js.map +0 -1
- package/core/components/AvatarPanel.d.ts +0 -21
- package/core/components/AvatarPanel.js +0 -62
- package/core/components/AvatarPanel.js.map +0 -1
- package/core/components/BorderPanel.d.ts +0 -28
- package/core/components/BorderPanel.js +0 -90
- package/core/components/BorderPanel.js.map +0 -1
- package/core/components/CardPanel.d.ts +0 -5
- package/core/components/CardPanel.js +0 -11
- package/core/components/CardPanel.js.map +0 -1
- package/core/components/CheckBox.d.ts +0 -36
- package/core/components/CheckBox.js +0 -109
- package/core/components/CheckBox.js.map +0 -1
- package/core/components/ColorPicker.d.ts +0 -10
- package/core/components/ColorPicker.js +0 -36
- package/core/components/ColorPicker.js.map +0 -1
- package/core/components/ContextMenu.d.ts +0 -16
- package/core/components/ContextMenu.js +0 -64
- package/core/components/ContextMenu.js.map +0 -1
- package/core/components/DialogPanel.d.ts +0 -15
- package/core/components/DialogPanel.js +0 -62
- package/core/components/DialogPanel.js.map +0 -1
- package/core/components/DropDown.d.ts +0 -54
- package/core/components/DropDown.js +0 -231
- package/core/components/DropDown.js.map +0 -1
- package/core/components/FlowPanel.d.ts +0 -11
- package/core/components/FlowPanel.js +0 -40
- package/core/components/FlowPanel.js.map +0 -1
- package/core/components/ForEach.d.ts +0 -11
- package/core/components/ForEach.js +0 -88
- package/core/components/ForEach.js.map +0 -1
- package/core/components/GridPanel.d.ts +0 -10
- package/core/components/GridPanel.js +0 -30
- package/core/components/GridPanel.js.map +0 -1
- package/core/components/HBox.d.ts +0 -5
- package/core/components/HBox.js +0 -10
- package/core/components/HBox.js.map +0 -1
- package/core/components/LazyLoading.d.ts +0 -19
- package/core/components/LazyLoading.js +0 -36
- package/core/components/LazyLoading.js.map +0 -1
- package/core/components/ListPanel.d.ts +0 -27
- package/core/components/ListPanel.js +0 -153
- package/core/components/ListPanel.js.map +0 -1
- package/core/components/PopUpButton.d.ts +0 -18
- package/core/components/PopUpButton.js +0 -57
- package/core/components/PopUpButton.js.map +0 -1
- package/core/components/ScrollPanel.d.ts +0 -14
- package/core/components/ScrollPanel.js +0 -35
- package/core/components/ScrollPanel.js.map +0 -1
- package/core/components/SliderPanel.d.ts +0 -7
- package/core/components/SliderPanel.js +0 -135
- package/core/components/SliderPanel.js.map +0 -1
- package/core/components/StackPanel.d.ts +0 -5
- package/core/components/StackPanel.js +0 -10
- package/core/components/StackPanel.js.map +0 -1
- package/core/components/TabItem.d.ts +0 -19
- package/core/components/TabItem.js +0 -84
- package/core/components/TabItem.js.map +0 -1
- package/core/components/TabPanel.d.ts +0 -25
- package/core/components/TabPanel.js +0 -96
- package/core/components/TabPanel.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/TextEdit.d.ts +0 -32
- package/core/components/TextEdit.js +0 -174
- package/core/components/TextEdit.js.map +0 -1
- package/core/components/TextField.d.ts +0 -34
- package/core/components/TextField.js +0 -140
- package/core/components/TextField.js.map +0 -1
- package/core/components/ToggleButton.d.ts +0 -7
- package/core/components/ToggleButton.js +0 -20
- package/core/components/ToggleButton.js.map +0 -1
- package/core/components/Tooltip.d.ts +0 -10
- package/core/components/Tooltip.js +0 -14
- package/core/components/Tooltip.js.map +0 -1
- package/core/components/VBox.d.ts +0 -5
- package/core/components/VBox.js +0 -10
- package/core/components/VBox.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/components/VirtualScroll.d.ts +0 -20
- package/core/components/VirtualScroll.js +0 -47
- package/core/components/VirtualScroll.js.map +0 -1
- package/core/components/index.d.ts +0 -28
- package/core/components/index.js +0 -30
- package/core/components/index.js.map +0 -1
- package/core/decorators/RegisterComponent.d.ts +0 -8
- package/core/decorators/RegisterComponent.js +0 -20
- package/core/decorators/RegisterComponent.js.map +0 -1
- package/core/decorators/StyleLink.d.ts +0 -1
- package/core/decorators/StyleLink.js +0 -13
- package/core/decorators/StyleLink.js.map +0 -1
- package/core/decorators/index.d.ts +0 -4
- package/core/decorators/index.js +0 -6
- package/core/decorators/index.js.map +0 -1
- package/core/element/AbbreviationElement.d.ts +0 -7
- package/core/element/AbbreviationElement.js +0 -10
- package/core/element/AbbreviationElement.js.map +0 -1
- package/core/element/AnchorElement.d.ts +0 -24
- package/core/element/AnchorElement.js +0 -31
- package/core/element/AnchorElement.js.map +0 -1
- package/core/element/AreaElement.d.ts +0 -18
- package/core/element/AreaElement.js +0 -11
- package/core/element/AreaElement.js.map +0 -1
- package/core/element/ArticleElement.d.ts +0 -5
- package/core/element/ArticleElement.js +0 -12
- package/core/element/ArticleElement.js.map +0 -1
- package/core/element/AudioElement.d.ts +0 -12
- package/core/element/AudioElement.js +0 -10
- package/core/element/AudioElement.js.map +0 -1
- package/core/element/BaseElement.d.ts +0 -8
- package/core/element/BaseElement.js +0 -11
- package/core/element/BaseElement.js.map +0 -1
- package/core/element/BodyElement.d.ts +0 -5
- package/core/element/BodyElement.js +0 -11
- package/core/element/BodyElement.js.map +0 -1
- package/core/element/BoldElement.d.ts +0 -5
- package/core/element/BoldElement.js +0 -10
- package/core/element/BoldElement.js.map +0 -1
- package/core/element/BreakElement.d.ts +0 -5
- package/core/element/BreakElement.js +0 -10
- package/core/element/BreakElement.js.map +0 -1
- package/core/element/ButtonElement.d.ts +0 -26
- package/core/element/ButtonElement.js +0 -47
- package/core/element/ButtonElement.js.map +0 -1
- package/core/element/CanvasElement.d.ts +0 -5
- package/core/element/CanvasElement.js +0 -14
- package/core/element/CanvasElement.js.map +0 -1
- package/core/element/CaptionElement.d.ts +0 -5
- package/core/element/CaptionElement.js +0 -13
- package/core/element/CaptionElement.js.map +0 -1
- package/core/element/CiteElement.d.ts +0 -5
- package/core/element/CiteElement.js +0 -11
- package/core/element/CiteElement.js.map +0 -1
- package/core/element/CodeElement.d.ts +0 -7
- package/core/element/CodeElement.js +0 -13
- package/core/element/CodeElement.js.map +0 -1
- package/core/element/DataListElement.d.ts +0 -5
- package/core/element/DataListElement.js +0 -13
- package/core/element/DataListElement.js.map +0 -1
- package/core/element/DefinitionDescriptionElement.d.ts +0 -5
- package/core/element/DefinitionDescriptionElement.js +0 -13
- package/core/element/DefinitionDescriptionElement.js.map +0 -1
- package/core/element/DefinitionElement.d.ts +0 -5
- package/core/element/DefinitionElement.js +0 -13
- package/core/element/DefinitionElement.js.map +0 -1
- package/core/element/DeletedTextElement.d.ts +0 -7
- package/core/element/DeletedTextElement.js +0 -15
- package/core/element/DeletedTextElement.js.map +0 -1
- package/core/element/DetailsElement.d.ts +0 -9
- package/core/element/DetailsElement.js +0 -28
- package/core/element/DetailsElement.js.map +0 -1
- package/core/element/DialogElement.d.ts +0 -7
- package/core/element/DialogElement.js +0 -14
- package/core/element/DialogElement.js.map +0 -1
- package/core/element/DivElement.d.ts +0 -5
- package/core/element/DivElement.js +0 -10
- package/core/element/DivElement.js.map +0 -1
- package/core/element/EmElement.d.ts +0 -5
- package/core/element/EmElement.js +0 -10
- package/core/element/EmElement.js.map +0 -1
- package/core/element/EmbedElement.d.ts +0 -10
- package/core/element/EmbedElement.js +0 -19
- package/core/element/EmbedElement.js.map +0 -1
- package/core/element/FieldSetElement.d.ts +0 -9
- package/core/element/FieldSetElement.js +0 -34
- package/core/element/FieldSetElement.js.map +0 -1
- package/core/element/FooterElement.d.ts +0 -5
- package/core/element/FooterElement.js +0 -13
- package/core/element/FooterElement.js.map +0 -1
- package/core/element/FormElement.d.ts +0 -20
- package/core/element/FormElement.js +0 -36
- package/core/element/FormElement.js.map +0 -1
- package/core/element/Fragment.d.ts +0 -32
- package/core/element/Fragment.js +0 -103
- package/core/element/Fragment.js.map +0 -1
- package/core/element/H1Element.d.ts +0 -5
- package/core/element/H1Element.js +0 -10
- package/core/element/H1Element.js.map +0 -1
- package/core/element/H2Element.d.ts +0 -5
- package/core/element/H2Element.js +0 -10
- package/core/element/H2Element.js.map +0 -1
- package/core/element/H3Element.d.ts +0 -5
- package/core/element/H3Element.js +0 -10
- package/core/element/H3Element.js.map +0 -1
- package/core/element/H4Element.d.ts +0 -5
- package/core/element/H4Element.js +0 -10
- package/core/element/H4Element.js.map +0 -1
- package/core/element/H5Element.d.ts +0 -5
- package/core/element/H5Element.js +0 -10
- package/core/element/H5Element.js.map +0 -1
- package/core/element/H6Element.d.ts +0 -5
- package/core/element/H6Element.js +0 -10
- package/core/element/H6Element.js.map +0 -1
- package/core/element/HeadElement.d.ts +0 -5
- package/core/element/HeadElement.js +0 -11
- package/core/element/HeadElement.js.map +0 -1
- package/core/element/HeaderElement.d.ts +0 -5
- package/core/element/HeaderElement.js +0 -13
- package/core/element/HeaderElement.js.map +0 -1
- package/core/element/HorizontalRuleElement.d.ts +0 -5
- package/core/element/HorizontalRuleElement.js +0 -13
- package/core/element/HorizontalRuleElement.js.map +0 -1
- package/core/element/HtmlElement.d.ts +0 -9
- package/core/element/HtmlElement.js +0 -19
- package/core/element/HtmlElement.js.map +0 -1
- package/core/element/IFrameElement.d.ts +0 -28
- package/core/element/IFrameElement.js +0 -67
- package/core/element/IFrameElement.js.map +0 -1
- package/core/element/ILayout.d.ts +0 -5
- package/core/element/ILayout.js +0 -9
- package/core/element/ILayout.js.map +0 -1
- package/core/element/IconElement.d.ts +0 -14
- package/core/element/IconElement.js +0 -32
- package/core/element/IconElement.js.map +0 -1
- package/core/element/IdiomaticElement.d.ts +0 -4
- package/core/element/IdiomaticElement.js +0 -6
- package/core/element/IdiomaticElement.js.map +0 -1
- package/core/element/ImageElement.d.ts +0 -19
- package/core/element/ImageElement.js +0 -17
- package/core/element/ImageElement.js.map +0 -1
- package/core/element/InputElement.d.ts +0 -19
- package/core/element/InputElement.js +0 -81
- package/core/element/InputElement.js.map +0 -1
- package/core/element/LabelElement.d.ts +0 -8
- package/core/element/LabelElement.js +0 -10
- package/core/element/LabelElement.js.map +0 -1
- package/core/element/LegendElement.d.ts +0 -7
- package/core/element/LegendElement.js +0 -15
- package/core/element/LegendElement.js.map +0 -1
- package/core/element/ListItemElement.d.ts +0 -12
- package/core/element/ListItemElement.js +0 -28
- package/core/element/ListItemElement.js.map +0 -1
- package/core/element/MainElement.d.ts +0 -5
- package/core/element/MainElement.js +0 -10
- package/core/element/MainElement.js.map +0 -1
- package/core/element/NavElement.d.ts +0 -5
- package/core/element/NavElement.js +0 -10
- package/core/element/NavElement.js.map +0 -1
- package/core/element/OrderedListElement.d.ts +0 -5
- package/core/element/OrderedListElement.js +0 -10
- package/core/element/OrderedListElement.js.map +0 -1
- package/core/element/ParagraphElement.d.ts +0 -5
- package/core/element/ParagraphElement.js +0 -10
- package/core/element/ParagraphElement.js.map +0 -1
- package/core/element/PreElement.d.ts +0 -5
- package/core/element/PreElement.js +0 -10
- package/core/element/PreElement.js.map +0 -1
- package/core/element/SectionElement.d.ts +0 -5
- package/core/element/SectionElement.js +0 -12
- package/core/element/SectionElement.js.map +0 -1
- package/core/element/SelectElement.d.ts +0 -5
- package/core/element/SelectElement.js +0 -12
- package/core/element/SelectElement.js.map +0 -1
- package/core/element/SourceElement.d.ts +0 -8
- package/core/element/SourceElement.js +0 -14
- package/core/element/SourceElement.js.map +0 -1
- package/core/element/SpanElement.d.ts +0 -5
- package/core/element/SpanElement.js +0 -10
- package/core/element/SpanElement.js.map +0 -1
- package/core/element/StrongElement.d.ts +0 -5
- package/core/element/StrongElement.js +0 -12
- package/core/element/StrongElement.js.map +0 -1
- package/core/element/StyleElement.d.ts +0 -5
- package/core/element/StyleElement.js +0 -10
- package/core/element/StyleElement.js.map +0 -1
- package/core/element/SummaryElement.d.ts +0 -5
- package/core/element/SummaryElement.js +0 -12
- package/core/element/SummaryElement.js.map +0 -1
- package/core/element/SvgElement.d.ts +0 -18
- package/core/element/SvgElement.js +0 -151
- package/core/element/SvgElement.js.map +0 -1
- package/core/element/TableBodyElement.d.ts +0 -5
- package/core/element/TableBodyElement.js +0 -10
- package/core/element/TableBodyElement.js.map +0 -1
- package/core/element/TableCellElement.d.ts +0 -10
- package/core/element/TableCellElement.js +0 -25
- package/core/element/TableCellElement.js.map +0 -1
- package/core/element/TableColElement.d.ts +0 -7
- package/core/element/TableColElement.js +0 -13
- package/core/element/TableColElement.js.map +0 -1
- package/core/element/TableColGroupElement.d.ts +0 -7
- package/core/element/TableColGroupElement.js +0 -15
- package/core/element/TableColGroupElement.js.map +0 -1
- package/core/element/TableElement.d.ts +0 -45
- package/core/element/TableElement.js +0 -228
- package/core/element/TableElement.js.map +0 -1
- package/core/element/TableFootElement.d.ts +0 -5
- package/core/element/TableFootElement.js +0 -10
- package/core/element/TableFootElement.js.map +0 -1
- package/core/element/TableFootRowElement.d.ts +0 -9
- package/core/element/TableFootRowElement.js +0 -23
- package/core/element/TableFootRowElement.js.map +0 -1
- package/core/element/TableHeadCellElement.d.ts +0 -10
- package/core/element/TableHeadCellElement.js +0 -24
- package/core/element/TableHeadCellElement.js.map +0 -1
- package/core/element/TableHeadElement.d.ts +0 -5
- package/core/element/TableHeadElement.js +0 -10
- package/core/element/TableHeadElement.js.map +0 -1
- package/core/element/TableHeadRowElement.d.ts +0 -11
- package/core/element/TableHeadRowElement.js +0 -29
- package/core/element/TableHeadRowElement.js.map +0 -1
- package/core/element/TableRowElement.d.ts +0 -11
- package/core/element/TableRowElement.js +0 -29
- package/core/element/TableRowElement.js.map +0 -1
- package/core/element/TextAreaElement.d.ts +0 -7
- package/core/element/TextAreaElement.js +0 -10
- package/core/element/TextAreaElement.js.map +0 -1
- package/core/element/UListElement.d.ts +0 -5
- package/core/element/UListElement.js +0 -10
- package/core/element/UListElement.js.map +0 -1
- package/core/element/VideoElement.d.ts +0 -13
- package/core/element/VideoElement.js +0 -16
- package/core/element/VideoElement.js.map +0 -1
- package/core/element/index.d.ts +0 -72
- package/core/element/index.js +0 -73
- package/core/element/index.js.map +0 -1
- package/core/event/index.d.ts +0 -16
- package/core/event/index.js +0 -75
- package/core/event/index.js.map +0 -1
- package/core/index.js.map +0 -1
- package/core/ref/Computed.d.ts +0 -3
- package/core/ref/Computed.js +0 -75
- package/core/ref/Computed.js.map +0 -1
- package/core/ref/RefBoolean.d.ts +0 -91
- package/core/ref/RefBoolean.js +0 -119
- package/core/ref/RefBoolean.js.map +0 -1
- package/core/ref/RefContainer.d.ts +0 -28
- package/core/ref/RefContainer.js +0 -114
- package/core/ref/RefContainer.js.map +0 -1
- package/core/ref/RefList.d.ts +0 -120
- package/core/ref/RefList.js +0 -240
- package/core/ref/RefList.js.map +0 -1
- package/core/ref/RefMap.d.ts +0 -100
- package/core/ref/RefMap.js +0 -149
- package/core/ref/RefMap.js.map +0 -1
- package/core/ref/RefNumber.d.ts +0 -118
- package/core/ref/RefNumber.js +0 -157
- package/core/ref/RefNumber.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/RefObject.d.ts +0 -120
- package/core/ref/RefObject.js +0 -265
- package/core/ref/RefObject.js.map +0 -1
- package/core/ref/RefProperty.d.ts +0 -3
- package/core/ref/RefProperty.js +0 -46
- package/core/ref/RefProperty.js.map +0 -1
- package/core/ref/RefSet.d.ts +0 -99
- package/core/ref/RefSet.js +0 -148
- package/core/ref/RefSet.js.map +0 -1
- package/core/ref/RefState.d.ts +0 -25
- package/core/ref/RefState.js +0 -89
- package/core/ref/RefState.js.map +0 -1
- package/core/ref/RefString.d.ts +0 -148
- package/core/ref/RefString.js +0 -179
- package/core/ref/RefString.js.map +0 -1
- package/core/ref/index.d.ts +0 -23
- package/core/ref/index.js +0 -71
- package/core/ref/index.js.map +0 -1
- package/core/router/RouteView.d.ts +0 -20
- package/core/router/RouteView.js +0 -84
- package/core/router/RouteView.js.map +0 -1
- package/core/router/Router.d.ts +0 -78
- package/core/router/Router.js +0 -307
- package/core/router/Router.js.map +0 -1
- package/core/router/RouterEvent.d.ts +0 -36
- package/core/router/RouterEvent.js +0 -43
- package/core/router/RouterEvent.js.map +0 -1
- package/core/router/RouterGuard.d.ts +0 -12
- package/core/router/RouterGuard.js +0 -3
- package/core/router/RouterGuard.js.map +0 -1
- package/core/router/index.d.ts +0 -4
- package/core/router/index.js +0 -5
- package/core/router/index.js.map +0 -1
- package/global/index.js.map +0 -1
- package/global/safari-polyfill.d.ts +0 -0
- package/global/safari-polyfill.js +0 -234
- package/global/safari-polyfill.js.map +0 -1
- package/index.js +0 -4
- package/index.js.map +0 -1
- package/translation/index.d.ts +0 -0
- /package/{assets → dist/assets}/index.d.ts +0 -0
- /package/{assets → dist/assets}/index.js +0 -0
- /package/{assets → dist/assets}/index.js.map +0 -0
package/core/ref/RefMap.js
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { Ref } from ".";
|
|
2
|
-
import { RefContainer } from "./RefContainer";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a new reactive map from the given entries.
|
|
5
|
-
*
|
|
6
|
-
* @param entries - Optional initial key-value pairs.
|
|
7
|
-
* @returns A reactive RefMap instance.
|
|
8
|
-
*/
|
|
9
|
-
export function refMap(entries) {
|
|
10
|
-
return new RefMap(entries);
|
|
11
|
-
}
|
|
12
|
-
// Enables `instanceof refMap` to work correctly
|
|
13
|
-
Object.defineProperty(refMap, Symbol.hasInstance, {
|
|
14
|
-
value: function (instance) {
|
|
15
|
-
return !!instance && instance instanceof RefMap;
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* A reactive wrapper around the native Map object.
|
|
20
|
-
* Supports automatic reactivity and subscription to changes.
|
|
21
|
-
*/
|
|
22
|
-
export class RefMap extends Map {
|
|
23
|
-
/**
|
|
24
|
-
* Internal container managing subscribers and value propagation.
|
|
25
|
-
*/
|
|
26
|
-
container = new RefContainer(this);
|
|
27
|
-
id;
|
|
28
|
-
/**
|
|
29
|
-
* Constructs a new reactive map instance.
|
|
30
|
-
*
|
|
31
|
-
* @param entries - Optional initial entries to populate the map.
|
|
32
|
-
* @param refKey - Optional registration key for the Ref registry.
|
|
33
|
-
*/
|
|
34
|
-
constructor(entries) {
|
|
35
|
-
super();
|
|
36
|
-
this.id = this.container.id;
|
|
37
|
-
Ref.set(this.id, this);
|
|
38
|
-
this.value = new Map(entries);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Emits a change event to all subscribers for a given mutation type.
|
|
42
|
-
*
|
|
43
|
-
* @param propertyName - The kind of mutation (e.g., "set", "clear").
|
|
44
|
-
* @param value - The current state of the map.
|
|
45
|
-
*/
|
|
46
|
-
// @ts-ignore
|
|
47
|
-
emit(propertyName, value) {
|
|
48
|
-
const oldValue = this.valueOf();
|
|
49
|
-
this.container.emitAll(propertyName, value, oldValue);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Subscribes to changes and immediately emits the current map value.
|
|
53
|
-
*/
|
|
54
|
-
subscribe(target, propertyName, onUnsubscribe) {
|
|
55
|
-
return this.container.emit(this.container.subscribe(target, propertyName, onUnsubscribe), this, this.valueOf());
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Subscribes to future changes without emitting the current value.
|
|
59
|
-
*
|
|
60
|
-
* @param target - Function to call on change.
|
|
61
|
-
* @param onUnsubscribe - Optional callback to invoke on unsubscription.
|
|
62
|
-
*/
|
|
63
|
-
listen(target, onUnsubscribe) {
|
|
64
|
-
return this.container.subscribe(target, onUnsubscribe) !== undefined;
|
|
65
|
-
}
|
|
66
|
-
unsubscribe(targe, propertyName = "") {
|
|
67
|
-
return this.container.unsubscribe(targe, propertyName);
|
|
68
|
-
}
|
|
69
|
-
/** Reactive mutation overrides **/
|
|
70
|
-
/**
|
|
71
|
-
* Sets a value for a given key and notifies subscribers.
|
|
72
|
-
*
|
|
73
|
-
* @param key - The key to insert or update.
|
|
74
|
-
* @param value - The value to associate with the key.
|
|
75
|
-
* @returns The map itself.
|
|
76
|
-
*/
|
|
77
|
-
set(key, value) {
|
|
78
|
-
const oldValue = this.valueOf();
|
|
79
|
-
const result = super.set(key, value);
|
|
80
|
-
this.container.emitAll("set", this, oldValue);
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Deletes a key-value pair and notifies subscribers.
|
|
85
|
-
*
|
|
86
|
-
* @param key - The key to delete.
|
|
87
|
-
* @returns True if the key existed and was removed.
|
|
88
|
-
*/
|
|
89
|
-
delete(key) {
|
|
90
|
-
const oldValue = this.valueOf();
|
|
91
|
-
const result = super.delete(key);
|
|
92
|
-
this.container.emitAll("delete", this, oldValue);
|
|
93
|
-
return result;
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Clears all entries from the map and notifies subscribers.
|
|
97
|
-
*/
|
|
98
|
-
clear() {
|
|
99
|
-
const oldValue = this.valueOf();
|
|
100
|
-
super.clear();
|
|
101
|
-
this.container.emitAll("clear", this, oldValue);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Returns a shallow copy of the current map state.
|
|
105
|
-
*/
|
|
106
|
-
valueOf() {
|
|
107
|
-
return new Map(Array.from(this));
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Ensures native `Map` is returned when using `Map` methods that create new instances.
|
|
111
|
-
*/
|
|
112
|
-
static get [Symbol.species]() {
|
|
113
|
-
return Map;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Gets the current value of the reactive map.
|
|
117
|
-
* Returns a shallow copy to prevent unintended mutation.
|
|
118
|
-
*/
|
|
119
|
-
get value() {
|
|
120
|
-
return this.container.value.valueOf();
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Sets the entire contents of the map to match the given Map instance.
|
|
124
|
-
* If the same reference is passed, no update is triggered.
|
|
125
|
-
*
|
|
126
|
-
* @param value - A new Map to replace the current contents.
|
|
127
|
-
*/
|
|
128
|
-
set value(value) {
|
|
129
|
-
if (this === value)
|
|
130
|
-
return;
|
|
131
|
-
super.clear();
|
|
132
|
-
for (const [key, val] of value) {
|
|
133
|
-
super.set(key, val);
|
|
134
|
-
}
|
|
135
|
-
this.emit("value", value);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Serializes the map to a plain JavaScript object for JSON output.
|
|
139
|
-
* Note: keys are converted to string.
|
|
140
|
-
*/
|
|
141
|
-
toJSON() {
|
|
142
|
-
const obj = {};
|
|
143
|
-
for (const [k, v] of this.value) {
|
|
144
|
-
obj[k] = v;
|
|
145
|
-
}
|
|
146
|
-
return obj;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
//# sourceMappingURL=RefMap.js.map
|
package/core/ref/RefMap.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RefMap.js","sourceRoot":"","sources":["../../../src/core/ref/RefMap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAO,MAAM,GAAG,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE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AC;QACzB,OAAO,GAAG,CAAC;IACb,CAAC;IAED;;;OAGG;IACH,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IACxC,CAAC;IAED;;;;;OAKG;IACH,IAAI,KAAK,CAAC,KAAgB;QACxB,IAAI,IAAI,KAAK,KAAK;YAAE,OAAO;QAC3B,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,KAAK,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,KAAK,EAAE,CAAC;YAC/B,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACtB,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACH,MAAM;QACJ,MAAM,GAAG,GAAQ,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YAChC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACb,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
package/core/ref/RefNumber.d.ts
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { ref } from ".";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a reactive wrapper for a numeric value.
|
|
4
|
-
*
|
|
5
|
-
* @param value - The initial number value.
|
|
6
|
-
* @returns A new instance of RefNumber.
|
|
7
|
-
*/
|
|
8
|
-
export declare function refNumber(value: number): RefNumber;
|
|
9
|
-
/**
|
|
10
|
-
* A union type representing either a primitive number or a reactive RefNumber.
|
|
11
|
-
*/
|
|
12
|
-
export type refNumber = number | RefNumber;
|
|
13
|
-
/**
|
|
14
|
-
* A reactive wrapper for numbers that behaves like a Number object.
|
|
15
|
-
* Allows subscriptions to value changes and integrates with primitive operations.
|
|
16
|
-
*/
|
|
17
|
-
export declare class RefNumber implements Number, ref<number> {
|
|
18
|
-
/**
|
|
19
|
-
* The container holding the internal value and managing subscriptions.
|
|
20
|
-
*/
|
|
21
|
-
private readonly container;
|
|
22
|
-
readonly id: string;
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new reactive number wrapper.
|
|
25
|
-
*
|
|
26
|
-
* @param value - The initial number value.
|
|
27
|
-
*/
|
|
28
|
-
constructor(value: number);
|
|
29
|
-
/**
|
|
30
|
-
* Emits a change notification if the value has changed.
|
|
31
|
-
*
|
|
32
|
-
* @param propertyName - The name of the property being updated (usually "value").
|
|
33
|
-
* @param value - The new number value to assign.
|
|
34
|
-
*/
|
|
35
|
-
private emit;
|
|
36
|
-
/** Reactive subscription methods **/
|
|
37
|
-
subscribe(target: (value: number, oldValue: number) => void): boolean;
|
|
38
|
-
subscribe(target: (value: number, oldValue: number) => void, onUnsubscribe: Function): boolean;
|
|
39
|
-
subscribe(target: object, propertyName: string | symbol): boolean;
|
|
40
|
-
subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
|
|
41
|
-
subscribe(target: object | ((value: number, oldValue: number) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Subscribes to future value changes without emitting the current number.
|
|
44
|
-
*
|
|
45
|
-
* @param target - A function to be called on future updates.
|
|
46
|
-
* @param onUnsubscribe - Optional callback to be called upon unsubscription.
|
|
47
|
-
* @returns true if successfully subscribed.
|
|
48
|
-
*/
|
|
49
|
-
listen(target: (value: number, oldValue: number) => void, onUnsubscribe?: Function): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Unsubscribes a function or object property from receiving value updates.
|
|
52
|
-
*/
|
|
53
|
-
unsubscribe(target: (arg: number) => void): boolean;
|
|
54
|
-
unsubscribe(targe: object, propertyName: string | symbol): boolean;
|
|
55
|
-
/** Value access and primitives **/
|
|
56
|
-
/**
|
|
57
|
-
* Gets the current number value.
|
|
58
|
-
*/
|
|
59
|
-
get value(): number;
|
|
60
|
-
/**
|
|
61
|
-
* Sets a new number value and notifies subscribers if it changed.
|
|
62
|
-
*
|
|
63
|
-
* @param value - The new number to set.
|
|
64
|
-
*/
|
|
65
|
-
set value(value: number);
|
|
66
|
-
/**
|
|
67
|
-
* Returns the primitive number value.
|
|
68
|
-
*/
|
|
69
|
-
valueOf(): number;
|
|
70
|
-
/**
|
|
71
|
-
* Converts the value to a string using an optional radix.
|
|
72
|
-
*
|
|
73
|
-
* @param radix - An integer between 2 and 36 specifying the base.
|
|
74
|
-
*/
|
|
75
|
-
toString(radix?: number): string;
|
|
76
|
-
/**
|
|
77
|
-
* Converts the value to fixed-point notation.
|
|
78
|
-
*
|
|
79
|
-
* @param fractionDigits - Number of digits after the decimal point.
|
|
80
|
-
*/
|
|
81
|
-
toFixed(fractionDigits?: number): string;
|
|
82
|
-
/**
|
|
83
|
-
* Converts the value to exponential notation.
|
|
84
|
-
*
|
|
85
|
-
* @param fractionDigits - Number of digits after the decimal point.
|
|
86
|
-
*/
|
|
87
|
-
toExponential(fractionDigits?: number): string;
|
|
88
|
-
/**
|
|
89
|
-
* Formats the number to a specified precision.
|
|
90
|
-
*
|
|
91
|
-
* @param precision - Total number of significant digits.
|
|
92
|
-
*/
|
|
93
|
-
toPrecision(precision?: number): string;
|
|
94
|
-
/**
|
|
95
|
-
* Formats the number according to locale-specific rules.
|
|
96
|
-
*
|
|
97
|
-
* @param locales - A locale string or array of locale strings.
|
|
98
|
-
* @param options - Formatting options.
|
|
99
|
-
*/
|
|
100
|
-
toLocaleString(locales?: string, options?: Intl.NumberFormatOptions): string;
|
|
101
|
-
/**
|
|
102
|
-
* Supports automatic type coercion to a number in JS expressions.
|
|
103
|
-
*
|
|
104
|
-
* @param hint - Either "number", "string", or "default".
|
|
105
|
-
*/
|
|
106
|
-
[Symbol.toPrimitive](hint: string): number;
|
|
107
|
-
/**
|
|
108
|
-
* Identifies this class as a subtype of `Number`.
|
|
109
|
-
*/
|
|
110
|
-
static get [Symbol.species](): NumberConstructor;
|
|
111
|
-
/**
|
|
112
|
-
* Serializes the current value for JSON output.
|
|
113
|
-
* If this instance is the root ref, emits the raw value, otherwise wraps it.
|
|
114
|
-
*/
|
|
115
|
-
toJSON(): number | {
|
|
116
|
-
value: number;
|
|
117
|
-
};
|
|
118
|
-
}
|
package/core/ref/RefNumber.js
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { Ref } from ".";
|
|
2
|
-
import { RefContainer } from "./RefContainer";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a reactive wrapper for a numeric value.
|
|
5
|
-
*
|
|
6
|
-
* @param value - The initial number value.
|
|
7
|
-
* @returns A new instance of RefNumber.
|
|
8
|
-
*/
|
|
9
|
-
export function refNumber(value) {
|
|
10
|
-
return new RefNumber(value);
|
|
11
|
-
}
|
|
12
|
-
// Enables `instanceof refNumber` to return true for RefNumber instances
|
|
13
|
-
Object.defineProperty(refNumber, Symbol.hasInstance, {
|
|
14
|
-
value: function (instance) {
|
|
15
|
-
return !!instance && instance instanceof RefNumber;
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* A reactive wrapper for numbers that behaves like a Number object.
|
|
20
|
-
* Allows subscriptions to value changes and integrates with primitive operations.
|
|
21
|
-
*/
|
|
22
|
-
export class RefNumber {
|
|
23
|
-
/**
|
|
24
|
-
* The container holding the internal value and managing subscriptions.
|
|
25
|
-
*/
|
|
26
|
-
container;
|
|
27
|
-
id;
|
|
28
|
-
/**
|
|
29
|
-
* Constructs a new reactive number wrapper.
|
|
30
|
-
*
|
|
31
|
-
* @param value - The initial number value.
|
|
32
|
-
*/
|
|
33
|
-
constructor(value) {
|
|
34
|
-
this.container = new RefContainer(value);
|
|
35
|
-
this.id = this.container.id;
|
|
36
|
-
Ref.set(this.id, this);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Emits a change notification if the value has changed.
|
|
40
|
-
*
|
|
41
|
-
* @param propertyName - The name of the property being updated (usually "value").
|
|
42
|
-
* @param value - The new number value to assign.
|
|
43
|
-
*/
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
emit(propertyName, value) {
|
|
46
|
-
if (this.value === value.valueOf())
|
|
47
|
-
return;
|
|
48
|
-
const oldValue = this.valueOf();
|
|
49
|
-
this.container.emitAll(propertyName, (this.container.value = value.valueOf()), oldValue);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Subscribes to value changes and immediately emits the current number.
|
|
53
|
-
*/
|
|
54
|
-
subscribe(target, propertyName, onUnsubscribe) {
|
|
55
|
-
return this.container.emit(this.container.subscribe(target, propertyName, onUnsubscribe), this.value, this.valueOf());
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Subscribes to future value changes without emitting the current number.
|
|
59
|
-
*
|
|
60
|
-
* @param target - A function to be called on future updates.
|
|
61
|
-
* @param onUnsubscribe - Optional callback to be called upon unsubscription.
|
|
62
|
-
* @returns true if successfully subscribed.
|
|
63
|
-
*/
|
|
64
|
-
listen(target, onUnsubscribe) {
|
|
65
|
-
return this.container.subscribe(target, onUnsubscribe) !== undefined;
|
|
66
|
-
}
|
|
67
|
-
unsubscribe(targe, propertyName = "") {
|
|
68
|
-
return this.container.unsubscribe(targe, propertyName);
|
|
69
|
-
}
|
|
70
|
-
/** Value access and primitives **/
|
|
71
|
-
/**
|
|
72
|
-
* Gets the current number value.
|
|
73
|
-
*/
|
|
74
|
-
get value() {
|
|
75
|
-
return this.container.value;
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Sets a new number value and notifies subscribers if it changed.
|
|
79
|
-
*
|
|
80
|
-
* @param value - The new number to set.
|
|
81
|
-
*/
|
|
82
|
-
set value(value) {
|
|
83
|
-
this.emit("value", value);
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* Returns the primitive number value.
|
|
87
|
-
*/
|
|
88
|
-
valueOf() {
|
|
89
|
-
return this.value.valueOf();
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Converts the value to a string using an optional radix.
|
|
93
|
-
*
|
|
94
|
-
* @param radix - An integer between 2 and 36 specifying the base.
|
|
95
|
-
*/
|
|
96
|
-
toString(radix) {
|
|
97
|
-
return this.value.toString(radix);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Converts the value to fixed-point notation.
|
|
101
|
-
*
|
|
102
|
-
* @param fractionDigits - Number of digits after the decimal point.
|
|
103
|
-
*/
|
|
104
|
-
toFixed(fractionDigits) {
|
|
105
|
-
return this.value.toFixed(fractionDigits);
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Converts the value to exponential notation.
|
|
109
|
-
*
|
|
110
|
-
* @param fractionDigits - Number of digits after the decimal point.
|
|
111
|
-
*/
|
|
112
|
-
toExponential(fractionDigits) {
|
|
113
|
-
return this.value.toExponential(fractionDigits);
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Formats the number to a specified precision.
|
|
117
|
-
*
|
|
118
|
-
* @param precision - Total number of significant digits.
|
|
119
|
-
*/
|
|
120
|
-
toPrecision(precision) {
|
|
121
|
-
return this.value.toPrecision(precision);
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Formats the number according to locale-specific rules.
|
|
125
|
-
*
|
|
126
|
-
* @param locales - A locale string or array of locale strings.
|
|
127
|
-
* @param options - Formatting options.
|
|
128
|
-
*/
|
|
129
|
-
toLocaleString(locales, options) {
|
|
130
|
-
return this.value.toLocaleString(locales, options);
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Supports automatic type coercion to a number in JS expressions.
|
|
134
|
-
*
|
|
135
|
-
* @param hint - Either "number", "string", or "default".
|
|
136
|
-
*/
|
|
137
|
-
[Symbol.toPrimitive](hint) {
|
|
138
|
-
if (hint === "number" || hint === "default") {
|
|
139
|
-
return this.value;
|
|
140
|
-
}
|
|
141
|
-
return this.valueOf();
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Identifies this class as a subtype of `Number`.
|
|
145
|
-
*/
|
|
146
|
-
static get [Symbol.species]() {
|
|
147
|
-
return Number;
|
|
148
|
-
}
|
|
149
|
-
/**
|
|
150
|
-
* Serializes the current value for JSON output.
|
|
151
|
-
* If this instance is the root ref, emits the raw value, otherwise wraps it.
|
|
152
|
-
*/
|
|
153
|
-
toJSON() {
|
|
154
|
-
return this.container.root ? this.value : { value: this.value };
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
//# sourceMappingURL=RefNumber.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RefNumber.js","sourceRoot":"","sources":["../../../src/core/ref/RefNumber.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,wEAAwE;AACxE,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;IACpB;;OAEG;IACc,SAAS,CAAe;IAChC,EAAE,CAAS;IAGpB;;;;OAIG;IACH,YAAY,KAAa;QACvB,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAW,CAAC,CAAC;IAChC,CAAC;IAED;;;;;OAKG;IACH,aAAa;IACL,IAAI,CAAC,YAA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C,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED;;;;OAIG;IACH,OAAO,CAAC,cAAuB;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,cAAuB;QACnC,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAClD,CAAC;IAED;;;;OAIG;IACH,WAAW,CAAC,SAAkB;QAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,OAAgB,EAAE,OAAkC;QACjE,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED;;;;OAIG;IACH,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAY;QAC/B,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YAC5C,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,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;CACF"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { refBoolean, RefNumber, refNumber, refString, RefString, RefBoolean, RefMap, RefList, refMap, refList, RefState } from ".";
|
|
2
|
-
import { RefSet, refSet } from "./RefSet";
|
|
3
|
-
type refObject<T> = {
|
|
4
|
-
[K in keyof T]: T[K] extends string | String ? refString : T[K] extends number | Number ? refNumber : T[K] extends boolean | Boolean ? refBoolean : T[K] extends Array<infer U> ? refList<U> : T[K] extends Map<infer MK, infer MV> ? refMap<MK, MV> : T[K] extends Set<infer SU> ? refSet<SU> : T[K] extends object ? refObject<T[K]> : T[K];
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Represents a reactive reference object that holds a value of type T,
|
|
8
|
-
* allowing observers to subscribe to changes in that value.
|
|
9
|
-
*/
|
|
10
|
-
interface RefObject<T> {
|
|
11
|
-
readonly id: string;
|
|
12
|
-
/**
|
|
13
|
-
* The internal reference to another RefObject instance (if applicable).
|
|
14
|
-
*/
|
|
15
|
-
value: refObject<T>;
|
|
16
|
-
/**
|
|
17
|
-
* Subscribes a function to be notified whenever the value changes.
|
|
18
|
-
* The subscriber will immediately receive the current value.
|
|
19
|
-
*
|
|
20
|
-
* @param target - A function that will be called with the new value.
|
|
21
|
-
* @returns true if the subscription was successful, false otherwise.
|
|
22
|
-
*/
|
|
23
|
-
subscribe(target: (value: T, oldValue: T) => void): boolean;
|
|
24
|
-
/**
|
|
25
|
-
* Subscribes a function to be notified on value change, with an optional unsubscribe callback.
|
|
26
|
-
*
|
|
27
|
-
* @param target - A function that will be called with the new value.
|
|
28
|
-
* @param onUnsubscribe - A callback that will be called when unsubscribed.
|
|
29
|
-
* @returns true if the subscription was successful, false otherwise.
|
|
30
|
-
*/
|
|
31
|
-
subscribe(target: (value: T, oldValue: T) => void, onUnsubscribe: Function): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Subscribes a property of an object to receive updates when the value changes.
|
|
34
|
-
* The property will immediately be set to the current value.
|
|
35
|
-
*
|
|
36
|
-
* @param target - The target object to bind the value to.
|
|
37
|
-
* @param propertyName - The name of the property to update on value change.
|
|
38
|
-
* @returns true if the subscription was successful, false otherwise.
|
|
39
|
-
*/
|
|
40
|
-
subscribe(target: object, propertyName: string | symbol): boolean;
|
|
41
|
-
/**
|
|
42
|
-
* Subscribes a property of an object with an optional unsubscribe callback.
|
|
43
|
-
* The property will immediately be set to the current value.
|
|
44
|
-
*
|
|
45
|
-
* @param target - The target object to bind the value to.
|
|
46
|
-
* @param propertyName - The name of the property to update.
|
|
47
|
-
* @param onUnsubscribe - A callback that will be called when unsubscribed.
|
|
48
|
-
* @returns true if the subscription was successful, false otherwise.
|
|
49
|
-
*/
|
|
50
|
-
subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Overloaded generic subscribe method that supports both function and object property subscriptions.
|
|
53
|
-
* In all cases, the current value will be emitted immediately upon subscription.
|
|
54
|
-
*/
|
|
55
|
-
subscribe(target: object | ((args: T) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Subscribes to value changes without immediately emitting the current value.
|
|
58
|
-
* Use this to listen only for future changes.
|
|
59
|
-
*
|
|
60
|
-
* @param target - A function to be called on future value changes.
|
|
61
|
-
* @returns true if the listener was successfully registered, false otherwise.
|
|
62
|
-
*/
|
|
63
|
-
listen(target: (value: T, oldValue: T) => void): boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Subscribes to value changes without emitting the current value,
|
|
66
|
-
* with an optional unsubscribe callback.
|
|
67
|
-
*
|
|
68
|
-
* @param target - A function to be called on future value changes.
|
|
69
|
-
* @param onUnsubscribe - A callback that will be triggered on unsubscription.
|
|
70
|
-
* @returns true if the listener was successfully registered, false otherwise.
|
|
71
|
-
*/
|
|
72
|
-
listen(target: (arg: T, oldValue: T) => void, onUnsubscribe?: Function): boolean;
|
|
73
|
-
/**
|
|
74
|
-
* Unsubscribes a previously registered function subscriber.
|
|
75
|
-
*
|
|
76
|
-
* @param target - The function that was subscribed.
|
|
77
|
-
* @returns true if unsubscribed successfully, false otherwise.
|
|
78
|
-
*/
|
|
79
|
-
unsubscribe(target: (args: T) => void): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* Unsubscribes a previously registered object property subscriber.
|
|
82
|
-
*
|
|
83
|
-
* @param target - The target object.
|
|
84
|
-
* @param propertyName - The name of the property that was bound to value changes.
|
|
85
|
-
* @returns true if unsubscribed successfully, false otherwise.
|
|
86
|
-
*/
|
|
87
|
-
unsubscribe(target: object, propertyName: string | symbol): boolean;
|
|
88
|
-
/**
|
|
89
|
-
* General unsubscribe method supporting both function and object property unsubscriptions.
|
|
90
|
-
*/
|
|
91
|
-
unsubscribe(target: object | ((args: T) => void), propertyName: string | symbol): boolean;
|
|
92
|
-
/**
|
|
93
|
-
* Returns a string representation of the current value.
|
|
94
|
-
*/
|
|
95
|
-
toString(): string;
|
|
96
|
-
/**
|
|
97
|
-
* Serializes the current value to JSON.
|
|
98
|
-
*/
|
|
99
|
-
toJSON(): DynamicJSON<T>;
|
|
100
|
-
/**
|
|
101
|
-
* Returns the raw value of the RefObject.
|
|
102
|
-
*/
|
|
103
|
-
valueOf(): T;
|
|
104
|
-
/**
|
|
105
|
-
* A unique key identifying this reference object.
|
|
106
|
-
*/
|
|
107
|
-
readonly refKey: string;
|
|
108
|
-
/**
|
|
109
|
-
* Allows iteration over the reference value.
|
|
110
|
-
*/
|
|
111
|
-
[Symbol.iterator](): Iterator<T>;
|
|
112
|
-
}
|
|
113
|
-
type DynamicJSON<T> = T extends object ? T : {
|
|
114
|
-
value: T;
|
|
115
|
-
};
|
|
116
|
-
export type DynamicRef<T> = T extends string | String ? RefString : T extends number | Number ? RefNumber : T extends boolean | Boolean ? RefBoolean : T extends Array<infer U> ? RefList<U> : T extends Set<infer U> ? RefSet<U> : T extends Map<infer K, infer V> ? RefMap<K, V> : T extends object ? RefObject<T> : never;
|
|
117
|
-
export declare function ref<T = any>(value?: T, refKey?: string): DynamicRef<T>;
|
|
118
|
-
export type ref<T = any> = DynamicRef<T>;
|
|
119
|
-
export type refType = RefString | RefNumber | RefBoolean | RefList<any> | RefSet<any> | RefMap<any, any> | RefObject<any> | RefState<any>;
|
|
120
|
-
export declare const Interface: {
|
|
121
|
-
empty: <T extends Record<string, any>>() => T;
|
|
122
|
-
};
|
|
123
|
-
export type Interface = typeof Interface;
|
|
124
|
-
export {};
|