typecomposer 0.1.46 → 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 +35 -10
- package/styles/style.scss +2 -23
- 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/RefContainer.js
DELETED
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { Ref } from ".";
|
|
2
|
-
const refSubscriber = Symbol("refSubscriber");
|
|
3
|
-
export class RefContainer {
|
|
4
|
-
value;
|
|
5
|
-
root;
|
|
6
|
-
static #index = 0;
|
|
7
|
-
#subscribers = [];
|
|
8
|
-
id = `${Math.random().toString(36).substring(2, 4)}${RefContainer.#index++}`;
|
|
9
|
-
constructor(value, root) {
|
|
10
|
-
this.value = value;
|
|
11
|
-
this.root = root;
|
|
12
|
-
}
|
|
13
|
-
emit(subscriber, value, oldValue) {
|
|
14
|
-
if (subscriber.target instanceof Function) {
|
|
15
|
-
subscriber.target(value, oldValue);
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
const target = subscriber.target.deref();
|
|
19
|
-
if (target === undefined) {
|
|
20
|
-
this.#subscribers = this.#subscribers.filter((s) => s !== subscriber);
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
if (typeof target[subscriber.propertyName] === "function")
|
|
24
|
-
target[subscriber.propertyName](value, oldValue);
|
|
25
|
-
else if (target[subscriber.propertyName] !== value) {
|
|
26
|
-
target[subscriber.propertyName] = value;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
info() {
|
|
32
|
-
console.log("RefContainer info: ", this.value, "subscribers: ", this.#subscribers);
|
|
33
|
-
}
|
|
34
|
-
// @ts-ignore
|
|
35
|
-
emitAll(propertyName, value, oldValue) {
|
|
36
|
-
this.#subscribers.forEach((s) => this.emit(s, value, oldValue));
|
|
37
|
-
if (this.root && this.root.emitAll)
|
|
38
|
-
this.root.emitAll("value", this.root["instance"] ? this.root["instance"]["value"] : this.root.value, oldValue);
|
|
39
|
-
return value;
|
|
40
|
-
}
|
|
41
|
-
getSubscriber(target, propertyName) {
|
|
42
|
-
const resutl = { subscriber: undefined, index: -1 };
|
|
43
|
-
if (typeof target === "function") {
|
|
44
|
-
const index = this.#subscribers.findIndex((s) => s.target === target);
|
|
45
|
-
resutl.index = index;
|
|
46
|
-
if (index !== -1)
|
|
47
|
-
resutl.subscriber = this.#subscribers[index];
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
// @ts-ignore
|
|
51
|
-
const index = this.#subscribers.findIndex((s) => typeof s.target !== "function" && s.target.deref() === target && s.propertyName === propertyName);
|
|
52
|
-
resutl.index = index;
|
|
53
|
-
if (index !== -1)
|
|
54
|
-
resutl.subscriber = this.#subscribers[index];
|
|
55
|
-
}
|
|
56
|
-
return resutl;
|
|
57
|
-
}
|
|
58
|
-
subscribe(target, propertyName, onUnsubscribe) {
|
|
59
|
-
const resutl = this.getSubscriber(target, propertyName);
|
|
60
|
-
if (propertyName instanceof Function)
|
|
61
|
-
onUnsubscribe = propertyName;
|
|
62
|
-
if (resutl.subscriber)
|
|
63
|
-
return resutl.subscriber;
|
|
64
|
-
const subscriber = {
|
|
65
|
-
target: target instanceof Function ? target : new WeakRef(target),
|
|
66
|
-
propertyName: typeof propertyName === "string" ? propertyName : "",
|
|
67
|
-
onUnsubscribe,
|
|
68
|
-
refSubscriber
|
|
69
|
-
};
|
|
70
|
-
this.#subscribers.push(subscriber);
|
|
71
|
-
// @ts-ignore
|
|
72
|
-
if (typeof target !== "function")
|
|
73
|
-
Ref.subscribe(target, typeof propertyName === "string" ? propertyName : "", this);
|
|
74
|
-
return subscriber;
|
|
75
|
-
}
|
|
76
|
-
listen(target, onUnsubscribe) {
|
|
77
|
-
return this.subscribe(target, onUnsubscribe);
|
|
78
|
-
}
|
|
79
|
-
unsubscribe(target, propertyName) {
|
|
80
|
-
const resutl = this.getSubscriber(target, propertyName);
|
|
81
|
-
if (resutl.subscriber === undefined)
|
|
82
|
-
return false;
|
|
83
|
-
resutl.subscriber.onUnsubscribe?.();
|
|
84
|
-
this.#subscribers = this.#subscribers.filter((_, i) => i !== resutl.index);
|
|
85
|
-
if (typeof target !== "function")
|
|
86
|
-
Ref.unsubscribe(target, propertyName);
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
[Symbol.toPrimitive](hint) {
|
|
90
|
-
if (hint === "string" || hint === "default") {
|
|
91
|
-
return this.value;
|
|
92
|
-
}
|
|
93
|
-
return this.value.valueOf();
|
|
94
|
-
}
|
|
95
|
-
toString() {
|
|
96
|
-
if (typeof this.value === "object") {
|
|
97
|
-
return JSON.stringify(this.value);
|
|
98
|
-
}
|
|
99
|
-
else if (this.value instanceof Object) {
|
|
100
|
-
return "[object Object]";
|
|
101
|
-
}
|
|
102
|
-
return this.value.toString();
|
|
103
|
-
}
|
|
104
|
-
toJSON() {
|
|
105
|
-
try {
|
|
106
|
-
return JSON.parse(JSON.stringify(this.value));
|
|
107
|
-
}
|
|
108
|
-
catch (e) {
|
|
109
|
-
console.error(e);
|
|
110
|
-
return {};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
//# sourceMappingURL=RefContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RefContainer.js","sourceRoot":"","sources":["../../../src/core/ref/RefContainer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC;AAExB,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAS9C,MAAM,OAAO,YAAY;IAOd;IACS;IAPlB,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAElB,YAAY,GAAqB,EAAE,CAAC;IAC3B,EAAE,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,EAAE,CAAC;IAEtF,YACS,KAAW,EACF,IAAmB;QAD5B,UAAK,GAAL,KAAK,CAAM;QACF,SAAI,GAAJ,IAAI,CAAe;IACjC,CAAC;IAEL,IAAI,CAAC,UAA0B,EAAE,KAAU,EAAE,QAAa;QACxD,IAAI,UAAU,CAAC,MAAM,YAAY,QAAQ,EAAE,CAAC;YAC1C,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,MAAM,MAAM,GAAG,UAAU,CAAC,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I,KAAK,SAAS,EAAE,CAAC;YAC5C,OAAO,IAAI,CAAC,KAAK,CAAC;QACpB,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;IAC9B,CAAC;IAED,QAAQ;QACN,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACpC,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,YAAY,MAAM,EAAE,CAAC;YACxC,OAAO,iBAAiB,CAAC;QAC3B,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAED,MAAM;QACJ,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjB,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC"}
|
package/core/ref/RefList.d.ts
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
import { ref } from ".";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a new reactive list wrapper around a standard array.
|
|
4
|
-
*
|
|
5
|
-
* @param items - The initial array of items.
|
|
6
|
-
* @returns A new instance of RefList.
|
|
7
|
-
*/
|
|
8
|
-
export declare function refList<T>(items: T[]): RefList<T>;
|
|
9
|
-
/**
|
|
10
|
-
* Type alias representing a reactive list of items of type T.
|
|
11
|
-
*/
|
|
12
|
-
export type refList<T> = RefList<T>;
|
|
13
|
-
/**
|
|
14
|
-
* A reactive wrapper for arrays that notifies subscribers on mutation.
|
|
15
|
-
* Inherits from Array and intercepts mutations like push, pop, splice, etc.
|
|
16
|
-
*/
|
|
17
|
-
export declare class RefList<T = any> extends Array<T> implements ref<T[]> {
|
|
18
|
-
/**
|
|
19
|
-
* Internal container that manages the reactive value and its subscribers.
|
|
20
|
-
*/
|
|
21
|
-
private readonly container;
|
|
22
|
-
readonly id: string;
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new RefList instance with the given items.
|
|
25
|
-
*
|
|
26
|
-
* @param items - The initial items for the list.
|
|
27
|
-
* @param refKey - Optional key used for registration in a central Ref registry.
|
|
28
|
-
*/
|
|
29
|
-
constructor(items: T[]);
|
|
30
|
-
/**
|
|
31
|
-
* Emits a change event to all subscribers for a specific mutation.
|
|
32
|
-
*
|
|
33
|
-
* @param propertyName - The type of mutation (e.g., "push", "splice", "value").
|
|
34
|
-
* @param value - The new list value.
|
|
35
|
-
*/
|
|
36
|
-
private emit;
|
|
37
|
-
/** Reactive subscription methods **/
|
|
38
|
-
subscribe(target: (value: T[], oldValue: T[]) => void): boolean;
|
|
39
|
-
subscribe(target: (value: T[], oldValue: T[]) => void, onUnsubscribe: Function): boolean;
|
|
40
|
-
subscribe(target: object, propertyName: string | symbol): boolean;
|
|
41
|
-
subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
|
|
42
|
-
subscribe(target: object | ((value: T[], oldValue: T[]) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Subscribes to future changes without emitting the current value.
|
|
45
|
-
*/
|
|
46
|
-
listen(target: (value: T[], oldValue: T[]) => void, onUnsubscribe?: Function): boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Unsubscribes a function or object-property pair from list updates.
|
|
49
|
-
*/
|
|
50
|
-
unsubscribe(target: (arg: T[]) => void): boolean;
|
|
51
|
-
unsubscribe(target: object, propertyName: string | symbol): boolean;
|
|
52
|
-
/** Reactive mutation overrides **/
|
|
53
|
-
push(...items: T[]): number;
|
|
54
|
-
pop(): T | undefined;
|
|
55
|
-
shift(): T | undefined;
|
|
56
|
-
unshift(...items: T[]): number;
|
|
57
|
-
splice(start: number, deleteCount?: number): T[];
|
|
58
|
-
splice(start: number, deleteCount: number, ...items: T[]): T[];
|
|
59
|
-
sort(compareFn?: (a: T, b: T) => number): this;
|
|
60
|
-
reverse(): T[];
|
|
61
|
-
fill(value: T, start?: number, end?: number): this;
|
|
62
|
-
copyWithin(target: number, start: number, end?: number): this;
|
|
63
|
-
/**
|
|
64
|
-
* Changes the length of the array and emits a change.
|
|
65
|
-
*/
|
|
66
|
-
set length(value: number);
|
|
67
|
-
/**
|
|
68
|
-
* Clears all elements in the list.
|
|
69
|
-
*/
|
|
70
|
-
clear(): void;
|
|
71
|
-
/**
|
|
72
|
-
* Inserts items at a specific index.
|
|
73
|
-
*/
|
|
74
|
-
insert(index: number, ...items: T[]): number;
|
|
75
|
-
/**
|
|
76
|
-
* Removes a specific item from the list.
|
|
77
|
-
*/
|
|
78
|
-
removeItem(value: T): T;
|
|
79
|
-
/**
|
|
80
|
-
* Removes elements starting from an index.
|
|
81
|
-
*/
|
|
82
|
-
remove(index: number, count?: number): number;
|
|
83
|
-
/**
|
|
84
|
-
* Returns a shallow copy of the current list.
|
|
85
|
-
*/
|
|
86
|
-
valueOf(): T[];
|
|
87
|
-
get length(): number;
|
|
88
|
-
/**
|
|
89
|
-
* Synchronizes the children of an HTML element with a list of HTMLElements.
|
|
90
|
-
*
|
|
91
|
-
* @param list - The list of elements to reflect in the container.
|
|
92
|
-
* @param element - The container element whose children will be updated.
|
|
93
|
-
*/
|
|
94
|
-
static syncComponentWithList(list: Element[], element: HTMLElement): void;
|
|
95
|
-
/**
|
|
96
|
-
* Identifies this object as a custom reactive list in `Object.prototype.toString`.
|
|
97
|
-
*/
|
|
98
|
-
get [Symbol.toStringTag](): string;
|
|
99
|
-
/**
|
|
100
|
-
* Ensures Array is returned when using methods like `slice()` or `map()`.
|
|
101
|
-
*/
|
|
102
|
-
static get [Symbol.species](): ArrayConstructor;
|
|
103
|
-
/**
|
|
104
|
-
* Gets the current value of the reactive list.
|
|
105
|
-
* Returns a shallow copy of the internal array to prevent direct mutation.
|
|
106
|
-
*/
|
|
107
|
-
get value(): T[];
|
|
108
|
-
/**
|
|
109
|
-
* Replaces the entire contents of the list with a new array of items.
|
|
110
|
-
* If the same array reference is passed, no update or notification occurs.
|
|
111
|
-
*
|
|
112
|
-
* @param value - The new array of items to assign.
|
|
113
|
-
*/
|
|
114
|
-
set value(value: T[]);
|
|
115
|
-
/**
|
|
116
|
-
* Serializes the current list value for JSON output.
|
|
117
|
-
* This ensures only the raw array contents are emitted.
|
|
118
|
-
*/
|
|
119
|
-
toJSON(): T[];
|
|
120
|
-
}
|
package/core/ref/RefList.js
DELETED
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { Ref } from ".";
|
|
2
|
-
import { RefContainer } from "./RefContainer";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a new reactive list wrapper around a standard array.
|
|
5
|
-
*
|
|
6
|
-
* @param items - The initial array of items.
|
|
7
|
-
* @returns A new instance of RefList.
|
|
8
|
-
*/
|
|
9
|
-
export function refList(items) {
|
|
10
|
-
return new RefList(items);
|
|
11
|
-
}
|
|
12
|
-
// Enables `instanceof refList` to work correctly
|
|
13
|
-
Object.defineProperty(refList, Symbol.hasInstance, {
|
|
14
|
-
value: function (instance) {
|
|
15
|
-
return !!instance && instance instanceof RefList;
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* A reactive wrapper for arrays that notifies subscribers on mutation.
|
|
20
|
-
* Inherits from Array and intercepts mutations like push, pop, splice, etc.
|
|
21
|
-
*/
|
|
22
|
-
export class RefList extends Array {
|
|
23
|
-
/**
|
|
24
|
-
* Internal container that manages the reactive value and its subscribers.
|
|
25
|
-
*/
|
|
26
|
-
container;
|
|
27
|
-
id;
|
|
28
|
-
/**
|
|
29
|
-
* Constructs a new RefList instance with the given items.
|
|
30
|
-
*
|
|
31
|
-
* @param items - The initial items for the list.
|
|
32
|
-
* @param refKey - Optional key used for registration in a central Ref registry.
|
|
33
|
-
*/
|
|
34
|
-
constructor(items) {
|
|
35
|
-
super(...items);
|
|
36
|
-
this.container = new RefContainer(this);
|
|
37
|
-
this.id = this.container.id;
|
|
38
|
-
Ref.set(this.id, this);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Emits a change event to all subscribers for a specific mutation.
|
|
42
|
-
*
|
|
43
|
-
* @param propertyName - The type of mutation (e.g., "push", "splice", "value").
|
|
44
|
-
* @param value - The new list value.
|
|
45
|
-
*/
|
|
46
|
-
emit(propertyName, value) {
|
|
47
|
-
const oldValue = this.valueOf();
|
|
48
|
-
this.container.emitAll(propertyName, value, oldValue);
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* Subscribes to list changes and immediately emits the current value.
|
|
52
|
-
*/
|
|
53
|
-
subscribe(target, propertyName, onUnsubscribe) {
|
|
54
|
-
return this.container.emit(this.container.subscribe(target, propertyName, onUnsubscribe), this, this.valueOf());
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Subscribes to future changes without emitting the current value.
|
|
58
|
-
*/
|
|
59
|
-
listen(target, onUnsubscribe) {
|
|
60
|
-
return this.container.subscribe(target, onUnsubscribe) !== undefined;
|
|
61
|
-
}
|
|
62
|
-
unsubscribe(targe, propertyName = "") {
|
|
63
|
-
return this.container.unsubscribe(targe, propertyName);
|
|
64
|
-
}
|
|
65
|
-
/** Reactive mutation overrides **/
|
|
66
|
-
push(...items) {
|
|
67
|
-
const oldValue = this.valueOf();
|
|
68
|
-
const n = super.push(...items);
|
|
69
|
-
this.container.emitAll("push", this, oldValue);
|
|
70
|
-
return n;
|
|
71
|
-
}
|
|
72
|
-
pop() {
|
|
73
|
-
const oldValue = this.valueOf();
|
|
74
|
-
const item = super.pop();
|
|
75
|
-
this.container.emitAll("pop", this, oldValue);
|
|
76
|
-
return item;
|
|
77
|
-
}
|
|
78
|
-
shift() {
|
|
79
|
-
const oldValue = this.valueOf();
|
|
80
|
-
const item = super.shift();
|
|
81
|
-
this.container.emitAll("shift", this, oldValue);
|
|
82
|
-
return item;
|
|
83
|
-
}
|
|
84
|
-
unshift(...items) {
|
|
85
|
-
const oldValue = this.valueOf();
|
|
86
|
-
const n = super.unshift(...items);
|
|
87
|
-
this.container.emitAll("unshift", this, oldValue);
|
|
88
|
-
return n;
|
|
89
|
-
}
|
|
90
|
-
splice(start, deleteCount = 0, ...items) {
|
|
91
|
-
const oldValue = this.valueOf();
|
|
92
|
-
const deleted = super.splice(start, deleteCount, ...items);
|
|
93
|
-
this.container.emitAll("splice", this, oldValue);
|
|
94
|
-
return deleted;
|
|
95
|
-
}
|
|
96
|
-
sort(compareFn) {
|
|
97
|
-
const oldValue = this.valueOf();
|
|
98
|
-
super.sort(compareFn);
|
|
99
|
-
this.container.emitAll("sort", this, oldValue);
|
|
100
|
-
return this;
|
|
101
|
-
}
|
|
102
|
-
reverse() {
|
|
103
|
-
const oldValue = this.valueOf();
|
|
104
|
-
const reversed = super.reverse();
|
|
105
|
-
this.container.emitAll("reverse", this, oldValue);
|
|
106
|
-
return reversed;
|
|
107
|
-
}
|
|
108
|
-
fill(value, start, end) {
|
|
109
|
-
const oldValue = this.valueOf();
|
|
110
|
-
super.fill(value, start, end);
|
|
111
|
-
this.container.emitAll("fill", this, oldValue);
|
|
112
|
-
return this;
|
|
113
|
-
}
|
|
114
|
-
copyWithin(target, start, end) {
|
|
115
|
-
const oldValue = this.valueOf();
|
|
116
|
-
super.copyWithin(target, start, end);
|
|
117
|
-
this.container.emitAll("copyWithin", this, oldValue);
|
|
118
|
-
return this;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Changes the length of the array and emits a change.
|
|
122
|
-
*/
|
|
123
|
-
set length(value) {
|
|
124
|
-
const oldValue = this.length;
|
|
125
|
-
super.length = value;
|
|
126
|
-
this.container.emitAll("length", this, oldValue);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Clears all elements in the list.
|
|
130
|
-
*/
|
|
131
|
-
clear() {
|
|
132
|
-
const oldValue = this.length;
|
|
133
|
-
super.length = 0;
|
|
134
|
-
this.container.emitAll("clear", this, oldValue);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Inserts items at a specific index.
|
|
138
|
-
*/
|
|
139
|
-
insert(index, ...items) {
|
|
140
|
-
const oldValue = this.valueOf();
|
|
141
|
-
super.splice(index, 0, ...items);
|
|
142
|
-
this.container.emitAll("insert", this, oldValue);
|
|
143
|
-
return this.length;
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Removes a specific item from the list.
|
|
147
|
-
*/
|
|
148
|
-
removeItem(value) {
|
|
149
|
-
const index = super.indexOf(value);
|
|
150
|
-
if (index === -1)
|
|
151
|
-
return value;
|
|
152
|
-
const oldValue = this.valueOf();
|
|
153
|
-
super.splice(index, 1);
|
|
154
|
-
this.container.emitAll("removeValue", this, oldValue);
|
|
155
|
-
return value;
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Removes elements starting from an index.
|
|
159
|
-
*/
|
|
160
|
-
remove(index, count = 1) {
|
|
161
|
-
const oldValue = this.valueOf();
|
|
162
|
-
super.splice(index, count);
|
|
163
|
-
this.container.emitAll("remove", this, oldValue);
|
|
164
|
-
return this.length;
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Returns a shallow copy of the current list.
|
|
168
|
-
*/
|
|
169
|
-
valueOf() {
|
|
170
|
-
return Array.from(this);
|
|
171
|
-
}
|
|
172
|
-
get length() {
|
|
173
|
-
return super.length;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Synchronizes the children of an HTML element with a list of HTMLElements.
|
|
177
|
-
*
|
|
178
|
-
* @param list - The list of elements to reflect in the container.
|
|
179
|
-
* @param element - The container element whose children will be updated.
|
|
180
|
-
*/
|
|
181
|
-
static syncComponentWithList(list, element) {
|
|
182
|
-
const currentChildren = Array.from(element.children);
|
|
183
|
-
currentChildren.forEach((child) => {
|
|
184
|
-
if (!list.includes(child)) {
|
|
185
|
-
element.removeChild(child);
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
list.forEach((el) => {
|
|
189
|
-
// @ts-ignore
|
|
190
|
-
if (el instanceof Node && !currentChildren.includes(el)) {
|
|
191
|
-
element.appendChild(el);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
list.forEach((el, index) => {
|
|
195
|
-
if (el instanceof Node && element.children[index] !== el) {
|
|
196
|
-
element.insertBefore(el, element.children[index] || null);
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Identifies this object as a custom reactive list in `Object.prototype.toString`.
|
|
202
|
-
*/
|
|
203
|
-
get [Symbol.toStringTag]() {
|
|
204
|
-
return "refList";
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* Ensures Array is returned when using methods like `slice()` or `map()`.
|
|
208
|
-
*/
|
|
209
|
-
static get [Symbol.species]() {
|
|
210
|
-
return Array;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* Gets the current value of the reactive list.
|
|
214
|
-
* Returns a shallow copy of the internal array to prevent direct mutation.
|
|
215
|
-
*/
|
|
216
|
-
get value() {
|
|
217
|
-
return this.container.value.valueOf();
|
|
218
|
-
}
|
|
219
|
-
/**
|
|
220
|
-
* Replaces the entire contents of the list with a new array of items.
|
|
221
|
-
* If the same array reference is passed, no update or notification occurs.
|
|
222
|
-
*
|
|
223
|
-
* @param value - The new array of items to assign.
|
|
224
|
-
*/
|
|
225
|
-
set value(value) {
|
|
226
|
-
// @ts-ignore
|
|
227
|
-
if (this === value)
|
|
228
|
-
return;
|
|
229
|
-
super.splice(0, this.length, ...value);
|
|
230
|
-
this.emit("value", value);
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Serializes the current list value for JSON output.
|
|
234
|
-
* This ensures only the raw array contents are emitted.
|
|
235
|
-
*/
|
|
236
|
-
toJSON() {
|
|
237
|
-
return this.value;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
//# sourceMappingURL=RefList.js.map
|
package/core/ref/RefList.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RefList.js","sourceRoot":"","sources":["../../../src/core/ref/RefList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAO,MAAM,GAAG,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAI,KAAU;IACnC,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,iDAAiD;AACjD,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE;IACjD,KAAK,EAAE,UAAU,QAAa;QAC5B,OAAO,CAAC,CAAC,QAAQ,IAAI,QAAQ,YAAY,OAAO,CAAC;IACnD,CAAC;CACF,CAAC,CAAC;AAOH;;;GAGG;AACH,MAAM,OAAO,OAAiB,SAAQ,KAAQ;IAE5C;;OAEG;IACc,SAAS,CAAe;IAChC,EAAE,CAAS;IAGpB;;;;;OAKG;IACH,YAAY,KAAU;QACpB,KAAK,CAAC,GAAG,KAAK,CAAC,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;QACxC,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;IACK,IAAI,CAAC,YAA6B,EAAE,KAAU;QACpD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAChC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACxD,CAAC;IAaD;;OAEG;IACH,SAAS,CAAC,MA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.d.ts
DELETED
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { ref } from ".";
|
|
2
|
-
/**
|
|
3
|
-
* Creates a new reactive map from the given entries.
|
|
4
|
-
*
|
|
5
|
-
* @param entries - Optional initial key-value pairs.
|
|
6
|
-
* @returns A reactive RefMap instance.
|
|
7
|
-
*/
|
|
8
|
-
export declare function refMap<K, V>(entries?: readonly (readonly [K, V])[] | null): RefMap<K, V>;
|
|
9
|
-
/**
|
|
10
|
-
* A type representing either a native Map or a reactive RefMap.
|
|
11
|
-
*/
|
|
12
|
-
export type refMap<K, V> = Map<K, V> | RefMap<K, V>;
|
|
13
|
-
/**
|
|
14
|
-
* A reactive wrapper around the native Map object.
|
|
15
|
-
* Supports automatic reactivity and subscription to changes.
|
|
16
|
-
*/
|
|
17
|
-
export declare class RefMap<K, V> extends Map<K, V> implements ref<Map<K, V>> {
|
|
18
|
-
/**
|
|
19
|
-
* Internal container managing subscribers and value propagation.
|
|
20
|
-
*/
|
|
21
|
-
private readonly container;
|
|
22
|
-
readonly id: string;
|
|
23
|
-
/**
|
|
24
|
-
* Constructs a new reactive map instance.
|
|
25
|
-
*
|
|
26
|
-
* @param entries - Optional initial entries to populate the map.
|
|
27
|
-
* @param refKey - Optional registration key for the Ref registry.
|
|
28
|
-
*/
|
|
29
|
-
constructor(entries?: readonly (readonly [K, V])[] | null);
|
|
30
|
-
/**
|
|
31
|
-
* Emits a change event to all subscribers for a given mutation type.
|
|
32
|
-
*
|
|
33
|
-
* @param propertyName - The kind of mutation (e.g., "set", "clear").
|
|
34
|
-
* @param value - The current state of the map.
|
|
35
|
-
*/
|
|
36
|
-
private emit;
|
|
37
|
-
/** Reactive subscription methods **/
|
|
38
|
-
subscribe(target: (value: Map<K, V>, oldValue: Map<K, V>) => void): boolean;
|
|
39
|
-
subscribe(target: (value: Map<K, V>, oldValue: Map<K, V>) => void, onUnsubscribe: Function): boolean;
|
|
40
|
-
subscribe(target: object, propertyName: string | symbol): boolean;
|
|
41
|
-
subscribe(target: object, propertyName: string | symbol, onUnsubscribe: Function): boolean;
|
|
42
|
-
subscribe(target: object | ((value: Map<K, V>, oldValue: Map<K, V>) => void), propertyName: string | symbol | Function, onUnsubscribe?: Function): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Subscribes to future changes without emitting the current value.
|
|
45
|
-
*
|
|
46
|
-
* @param target - Function to call on change.
|
|
47
|
-
* @param onUnsubscribe - Optional callback to invoke on unsubscription.
|
|
48
|
-
*/
|
|
49
|
-
listen(target: (value: Map<K, V>, oldValue: Map<K, V>) => void, onUnsubscribe?: Function): boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Unsubscribes a function or object-property pair from receiving updates.
|
|
52
|
-
*/
|
|
53
|
-
unsubscribe(target: (arg: Map<K, V>) => void): boolean;
|
|
54
|
-
unsubscribe(targe: object, propertyName: string | symbol): boolean;
|
|
55
|
-
/** Reactive mutation overrides **/
|
|
56
|
-
/**
|
|
57
|
-
* Sets a value for a given key and notifies subscribers.
|
|
58
|
-
*
|
|
59
|
-
* @param key - The key to insert or update.
|
|
60
|
-
* @param value - The value to associate with the key.
|
|
61
|
-
* @returns The map itself.
|
|
62
|
-
*/
|
|
63
|
-
set(key: K, value: V): this;
|
|
64
|
-
/**
|
|
65
|
-
* Deletes a key-value pair and notifies subscribers.
|
|
66
|
-
*
|
|
67
|
-
* @param key - The key to delete.
|
|
68
|
-
* @returns True if the key existed and was removed.
|
|
69
|
-
*/
|
|
70
|
-
delete(key: K): boolean;
|
|
71
|
-
/**
|
|
72
|
-
* Clears all entries from the map and notifies subscribers.
|
|
73
|
-
*/
|
|
74
|
-
clear(): void;
|
|
75
|
-
/**
|
|
76
|
-
* Returns a shallow copy of the current map state.
|
|
77
|
-
*/
|
|
78
|
-
valueOf(): Map<K, V>;
|
|
79
|
-
/**
|
|
80
|
-
* Ensures native `Map` is returned when using `Map` methods that create new instances.
|
|
81
|
-
*/
|
|
82
|
-
static get [Symbol.species](): MapConstructor;
|
|
83
|
-
/**
|
|
84
|
-
* Gets the current value of the reactive map.
|
|
85
|
-
* Returns a shallow copy to prevent unintended mutation.
|
|
86
|
-
*/
|
|
87
|
-
get value(): Map<K, V>;
|
|
88
|
-
/**
|
|
89
|
-
* Sets the entire contents of the map to match the given Map instance.
|
|
90
|
-
* If the same reference is passed, no update is triggered.
|
|
91
|
-
*
|
|
92
|
-
* @param value - A new Map to replace the current contents.
|
|
93
|
-
*/
|
|
94
|
-
set value(value: Map<K, V>);
|
|
95
|
-
/**
|
|
96
|
-
* Serializes the map to a plain JavaScript object for JSON output.
|
|
97
|
-
* Note: keys are converted to string.
|
|
98
|
-
*/
|
|
99
|
-
toJSON(): any;
|
|
100
|
-
}
|