typecomposer 0.1.47 → 0.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/index.js +1 -2
- package/core/components/AlertPanel.d.ts +6 -6
- package/core/components/AlertPanel.js +1 -75
- package/core/components/AlertPanel.js.map +1 -1
- package/core/components/AvatarPanel.d.ts +2 -2
- package/core/components/AvatarPanel.js +1 -62
- package/core/components/AvatarPanel.js.map +1 -1
- package/core/components/BorderPanel.d.ts +2 -2
- package/core/components/BorderPanel.js +1 -90
- package/core/components/BorderPanel.js.map +1 -1
- package/core/components/CardPanel.d.ts +2 -2
- package/core/components/CardPanel.js +1 -11
- package/core/components/CardPanel.js.map +1 -1
- package/core/components/CheckBox.d.ts +2 -2
- package/core/components/CheckBox.js +1 -109
- package/core/components/CheckBox.js.map +1 -1
- package/core/components/ColorPicker.d.ts +2 -2
- package/core/components/ColorPicker.js +1 -36
- package/core/components/ColorPicker.js.map +1 -1
- package/core/components/ContextMenu.d.ts +3 -3
- package/core/components/ContextMenu.js +1 -64
- package/core/components/ContextMenu.js.map +1 -1
- package/core/components/DialogPanel.d.ts +2 -2
- package/core/components/DialogPanel.js +1 -62
- package/core/components/DialogPanel.js.map +1 -1
- package/core/components/DropDown.d.ts +3 -3
- package/core/components/DropDown.js +1 -231
- package/core/components/DropDown.js.map +1 -1
- package/core/components/FlowPanel.d.ts +2 -2
- package/core/components/FlowPanel.js +1 -40
- package/core/components/FlowPanel.js.map +1 -1
- package/core/components/ForEach.d.ts +2 -2
- package/core/components/ForEach.js +1 -88
- package/core/components/ForEach.js.map +1 -1
- package/core/components/GridPanel.d.ts +4 -7
- package/core/components/GridPanel.js +1 -30
- package/core/components/GridPanel.js.map +1 -1
- package/core/components/HBox.d.ts +2 -2
- package/core/components/HBox.js +1 -10
- package/core/components/HBox.js.map +1 -1
- package/core/components/LazyLoading.d.ts +2 -2
- package/core/components/LazyLoading.js +1 -36
- package/core/components/LazyLoading.js.map +1 -1
- package/core/components/ListPanel.d.ts +2 -2
- package/core/components/ListPanel.js +1 -153
- package/core/components/ListPanel.js.map +1 -1
- package/core/components/PopUpButton.d.ts +2 -2
- package/core/components/PopUpButton.js +1 -57
- package/core/components/PopUpButton.js.map +1 -1
- package/core/components/ScrollPanel.d.ts +2 -2
- package/core/components/ScrollPanel.js +1 -35
- package/core/components/ScrollPanel.js.map +1 -1
- package/core/components/SliderPanel.d.ts +2 -2
- package/core/components/SliderPanel.js +1 -135
- package/core/components/SliderPanel.js.map +1 -1
- package/core/components/StackPanel.d.ts +2 -2
- package/core/components/StackPanel.js +1 -10
- package/core/components/StackPanel.js.map +1 -1
- package/core/components/TabItem.js +1 -84
- package/core/components/TabPanel.d.ts +2 -2
- package/core/components/TabPanel.js +1 -96
- package/core/components/TabPanel.js.map +1 -1
- package/core/components/TextEdit.js +1 -174
- package/core/components/TextField.d.ts +2 -2
- package/core/components/TextField.js +1 -140
- package/core/components/TextField.js.map +1 -1
- package/core/components/ToggleButton.d.ts +2 -2
- package/core/components/ToggleButton.js +1 -20
- package/core/components/ToggleButton.js.map +1 -1
- package/core/components/Tooltip.d.ts +4 -6
- package/core/components/Tooltip.js +1 -14
- package/core/components/Tooltip.js.map +1 -1
- package/core/components/VBox.d.ts +2 -2
- package/core/components/VBox.js +1 -10
- package/core/components/VBox.js.map +1 -1
- package/core/components/VirtualScroll.d.ts +2 -2
- package/core/components/VirtualScroll.js +1 -47
- package/core/components/index.d.ts +1 -2
- package/core/components/index.js +1 -30
- package/core/components/index.js.map +1 -1
- package/core/decorators/RegisterComponent.js +1 -20
- package/core/decorators/StyleLink.js +1 -13
- package/core/decorators/index.js +1 -6
- package/core/element/AbbreviationElement.d.ts +2 -4
- package/core/element/AbbreviationElement.js +1 -10
- package/core/element/AbbreviationElement.js.map +1 -1
- package/core/element/AnchorElement.d.ts +2 -18
- package/core/element/AnchorElement.js +1 -31
- package/core/element/AnchorElement.js.map +1 -1
- package/core/element/AreaElement.d.ts +2 -15
- package/core/element/AreaElement.js +1 -11
- package/core/element/AreaElement.js.map +1 -1
- package/core/element/ArticleElement.d.ts +2 -2
- package/core/element/ArticleElement.js +1 -12
- package/core/element/ArticleElement.js.map +1 -1
- package/core/element/AudioElement.d.ts +2 -9
- package/core/element/AudioElement.js +1 -10
- package/core/element/AudioElement.js.map +1 -1
- package/core/element/BaseElement.d.ts +2 -5
- package/core/element/BaseElement.js +1 -11
- package/core/element/BaseElement.js.map +1 -1
- package/core/element/BodyElement.d.ts +2 -2
- package/core/element/BodyElement.js +1 -11
- package/core/element/BodyElement.js.map +1 -1
- package/core/element/BoldElement.d.ts +2 -2
- package/core/element/BoldElement.js +1 -10
- package/core/element/BoldElement.js.map +1 -1
- package/core/element/BreakElement.d.ts +2 -2
- package/core/element/BreakElement.js +1 -10
- package/core/element/BreakElement.js.map +1 -1
- package/core/element/ButtonElement.d.ts +4 -21
- package/core/element/ButtonElement.js +1 -47
- package/core/element/ButtonElement.js.map +1 -1
- package/core/element/CanvasElement.d.ts +2 -2
- package/core/element/CanvasElement.js +1 -14
- package/core/element/CanvasElement.js.map +1 -1
- package/core/element/CaptionElement.d.ts +2 -2
- package/core/element/CaptionElement.js +1 -13
- package/core/element/CaptionElement.js.map +1 -1
- package/core/element/CiteElement.d.ts +2 -2
- package/core/element/CiteElement.js +1 -11
- package/core/element/CiteElement.js.map +1 -1
- package/core/element/CodeElement.d.ts +2 -2
- package/core/element/CodeElement.js +1 -13
- package/core/element/CodeElement.js.map +1 -1
- package/core/element/DataListElement.d.ts +2 -2
- package/core/element/DataListElement.js +1 -13
- package/core/element/DataListElement.js.map +1 -1
- package/core/element/DefinitionDescriptionElement.d.ts +2 -2
- package/core/element/DefinitionDescriptionElement.js +1 -13
- package/core/element/DefinitionDescriptionElement.js.map +1 -1
- package/core/element/DefinitionElement.d.ts +2 -2
- package/core/element/DefinitionElement.js +1 -13
- package/core/element/DefinitionElement.js.map +1 -1
- package/core/element/DeletedTextElement.d.ts +2 -4
- package/core/element/DeletedTextElement.js +1 -15
- package/core/element/DeletedTextElement.js.map +1 -1
- package/core/element/DetailsElement.d.ts +3 -6
- package/core/element/DetailsElement.js +1 -28
- package/core/element/DetailsElement.js.map +1 -1
- package/core/element/DialogElement.d.ts +2 -4
- package/core/element/DialogElement.js +1 -14
- package/core/element/DialogElement.js.map +1 -1
- package/core/element/DivElement.d.ts +2 -2
- package/core/element/DivElement.js +1 -10
- package/core/element/DivElement.js.map +1 -1
- package/core/element/EmElement.d.ts +2 -2
- package/core/element/EmElement.js +1 -10
- package/core/element/EmElement.js.map +1 -1
- package/core/element/EmbedElement.d.ts +2 -7
- package/core/element/EmbedElement.js +1 -19
- package/core/element/EmbedElement.js.map +1 -1
- package/core/element/FieldSetElement.d.ts +3 -6
- package/core/element/FieldSetElement.js +1 -34
- package/core/element/FieldSetElement.js.map +1 -1
- package/core/element/FooterElement.d.ts +2 -2
- package/core/element/FooterElement.js +1 -13
- package/core/element/FooterElement.js.map +1 -1
- package/core/element/FormElement.d.ts +2 -17
- package/core/element/FormElement.js +1 -36
- package/core/element/FormElement.js.map +1 -1
- package/core/element/Fragment.js +1 -103
- package/core/element/H1Element.d.ts +2 -2
- package/core/element/H1Element.js +1 -10
- package/core/element/H1Element.js.map +1 -1
- package/core/element/H2Element.d.ts +2 -2
- package/core/element/H2Element.js +1 -10
- package/core/element/H2Element.js.map +1 -1
- package/core/element/H3Element.d.ts +2 -2
- package/core/element/H3Element.js +1 -10
- package/core/element/H3Element.js.map +1 -1
- package/core/element/H4Element.d.ts +2 -2
- package/core/element/H4Element.js +1 -10
- package/core/element/H4Element.js.map +1 -1
- package/core/element/H5Element.d.ts +2 -2
- package/core/element/H5Element.js +1 -10
- package/core/element/H5Element.js.map +1 -1
- package/core/element/H6Element.d.ts +2 -2
- package/core/element/H6Element.js +1 -10
- package/core/element/H6Element.js.map +1 -1
- package/core/element/HeadElement.d.ts +2 -2
- package/core/element/HeadElement.js +1 -11
- package/core/element/HeadElement.js.map +1 -1
- package/core/element/HeaderElement.d.ts +2 -2
- package/core/element/HeaderElement.js +1 -13
- package/core/element/HeaderElement.js.map +1 -1
- package/core/element/HorizontalRuleElement.d.ts +2 -2
- package/core/element/HorizontalRuleElement.js +1 -13
- package/core/element/HorizontalRuleElement.js.map +1 -1
- package/core/element/HtmlElement.d.ts +2 -4
- package/core/element/HtmlElement.js +1 -19
- package/core/element/HtmlElement.js.map +1 -1
- package/core/element/IFrameElement.d.ts +2 -15
- package/core/element/IFrameElement.js +1 -67
- package/core/element/IFrameElement.js.map +1 -1
- package/core/element/ILayout.d.ts +2 -2
- package/core/element/ILayout.js +1 -9
- package/core/element/ILayout.js.map +1 -1
- package/core/element/IconElement.d.ts +2 -2
- package/core/element/IconElement.js +1 -32
- package/core/element/IconElement.js.map +1 -1
- package/core/element/IdiomaticElement.d.ts +2 -1
- package/core/element/IdiomaticElement.js +1 -6
- package/core/element/IdiomaticElement.js.map +1 -1
- package/core/element/ImageElement.d.ts +2 -2
- package/core/element/ImageElement.js +1 -17
- package/core/element/ImageElement.js.map +1 -1
- package/core/element/InputElement.d.ts +2 -16
- package/core/element/InputElement.js +1 -81
- package/core/element/InputElement.js.map +1 -1
- package/core/element/LabelElement.d.ts +2 -5
- package/core/element/LabelElement.js +1 -10
- package/core/element/LabelElement.js.map +1 -1
- package/core/element/LegendElement.d.ts +2 -4
- package/core/element/LegendElement.js +1 -15
- package/core/element/LegendElement.js.map +1 -1
- package/core/element/ListItemElement.d.ts +2 -4
- package/core/element/ListItemElement.js +1 -28
- package/core/element/ListItemElement.js.map +1 -1
- package/core/element/MainElement.d.ts +2 -2
- package/core/element/MainElement.js +1 -10
- package/core/element/MainElement.js.map +1 -1
- package/core/element/NavElement.d.ts +2 -2
- package/core/element/NavElement.js +1 -10
- package/core/element/NavElement.js.map +1 -1
- package/core/element/OrderedListElement.d.ts +2 -2
- package/core/element/OrderedListElement.js +1 -10
- package/core/element/OrderedListElement.js.map +1 -1
- package/core/element/ParagraphElement.d.ts +2 -2
- package/core/element/ParagraphElement.js +1 -10
- package/core/element/ParagraphElement.js.map +1 -1
- package/core/element/PreElement.d.ts +2 -2
- package/core/element/PreElement.js +1 -10
- package/core/element/PreElement.js.map +1 -1
- package/core/element/SectionElement.d.ts +2 -2
- package/core/element/SectionElement.js +1 -12
- package/core/element/SectionElement.js.map +1 -1
- package/core/element/SelectElement.d.ts +2 -2
- package/core/element/SelectElement.js +1 -12
- package/core/element/SelectElement.js.map +1 -1
- package/core/element/SourceElement.d.ts +2 -5
- package/core/element/SourceElement.js +1 -14
- package/core/element/SourceElement.js.map +1 -1
- package/core/element/SpanElement.d.ts +2 -2
- package/core/element/SpanElement.js +1 -10
- package/core/element/SpanElement.js.map +1 -1
- package/core/element/StrongElement.d.ts +2 -2
- package/core/element/StrongElement.js +1 -12
- package/core/element/StrongElement.js.map +1 -1
- package/core/element/StyleElement.d.ts +2 -2
- package/core/element/StyleElement.js +1 -10
- package/core/element/StyleElement.js.map +1 -1
- package/core/element/SummaryElement.d.ts +2 -2
- package/core/element/SummaryElement.js +1 -12
- package/core/element/SummaryElement.js.map +1 -1
- package/core/element/SvgElement.d.ts +3 -3
- package/core/element/SvgElement.js +1 -151
- package/core/element/SvgElement.js.map +1 -1
- package/core/element/TableBodyElement.d.ts +2 -2
- package/core/element/TableBodyElement.js +1 -10
- package/core/element/TableBodyElement.js.map +1 -1
- package/core/element/TableCellElement.d.ts +3 -6
- package/core/element/TableCellElement.js +1 -25
- package/core/element/TableCellElement.js.map +1 -1
- package/core/element/TableColElement.d.ts +2 -4
- package/core/element/TableColElement.js +1 -13
- package/core/element/TableColElement.js.map +1 -1
- package/core/element/TableColGroupElement.d.ts +2 -4
- package/core/element/TableColGroupElement.js +1 -15
- package/core/element/TableColGroupElement.js.map +1 -1
- package/core/element/TableElement.d.ts +2 -42
- package/core/element/TableElement.js +1 -228
- package/core/element/TableElement.js.map +1 -1
- package/core/element/TableFootElement.d.ts +2 -2
- package/core/element/TableFootElement.js +1 -10
- package/core/element/TableFootElement.js.map +1 -1
- package/core/element/TableFootRowElement.d.ts +2 -2
- package/core/element/TableFootRowElement.js +1 -23
- package/core/element/TableFootRowElement.js.map +1 -1
- package/core/element/TableHeadCellElement.d.ts +2 -2
- package/core/element/TableHeadCellElement.js +1 -24
- package/core/element/TableHeadCellElement.js.map +1 -1
- package/core/element/TableHeadElement.d.ts +2 -2
- package/core/element/TableHeadElement.js +1 -10
- package/core/element/TableHeadElement.js.map +1 -1
- package/core/element/TableHeadRowElement.d.ts +2 -2
- package/core/element/TableHeadRowElement.js +1 -29
- package/core/element/TableHeadRowElement.js.map +1 -1
- package/core/element/TableRowElement.d.ts +2 -2
- package/core/element/TableRowElement.js +1 -29
- package/core/element/TableRowElement.js.map +1 -1
- package/core/element/TextAreaElement.d.ts +2 -4
- package/core/element/TextAreaElement.js +1 -10
- package/core/element/TextAreaElement.js.map +1 -1
- package/core/element/UListElement.d.ts +2 -2
- package/core/element/UListElement.js +1 -10
- package/core/element/UListElement.js.map +1 -1
- package/core/element/VideoElement.d.ts +2 -10
- package/core/element/VideoElement.js +1 -16
- package/core/element/VideoElement.js.map +1 -1
- package/core/element/index.d.ts +3 -3
- package/core/element/index.js +1 -73
- package/core/element/index.js.map +1 -1
- package/core/event/index.js +1 -75
- package/core/index.d.ts +0 -3
- package/core/index.js +1 -10
- package/core/index.js.map +1 -1
- package/core/ref/Computed.js +1 -75
- package/core/ref/Computed.js.map +1 -1
- package/core/ref/RefBoolean.js +1 -119
- package/core/ref/RefContainer.js +1 -114
- package/core/ref/RefContainer.js.map +1 -1
- package/core/ref/RefList.js +1 -240
- package/core/ref/RefMap.js +1 -149
- package/core/ref/RefNumber.js +1 -157
- package/core/ref/RefObject.js +1 -265
- package/core/ref/RefObject.js.map +1 -1
- package/core/ref/RefProperty.js +1 -46
- package/core/ref/RefSet.js +1 -148
- package/core/ref/RefState.js +1 -89
- package/core/ref/RefString.js +1 -179
- package/core/ref/RefString.js.map +1 -1
- package/core/ref/index.js +1 -71
- package/core/router/RouteView.d.ts +2 -2
- package/core/router/RouteView.js +1 -84
- package/core/router/RouteView.js.map +1 -1
- package/core/router/Router.d.ts +8 -9
- package/core/router/Router.js +1 -307
- package/core/router/Router.js.map +1 -1
- package/core/router/RouterEvent.js +1 -43
- package/core/router/RouterGuard.js +1 -3
- package/core/router/index.js +1 -5
- package/core/styles/index.d.ts +3 -3
- package/core/styles/index.js +1 -36
- package/core/styles/index.js.map +1 -1
- package/{core/app/index.d.ts → global/app.d.ts} +5 -7
- package/global/app.js +1 -0
- package/global/app.js.map +1 -0
- package/global/index.d.ts +10 -4
- package/global/index.js +1 -1286
- package/global/index.js.map +1 -1
- package/global/safari-polyfill.js +1 -234
- package/index.d.ts +1 -0
- package/index.js +1 -4
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/style.scss +2 -17
- package/typings/index.d.ts +58 -66
- package/LICENSE +0 -21
- package/README.md +0 -62
- package/core/app/Validate.d.ts +0 -61
- package/core/app/Validate.js +0 -2
- package/core/app/Validate.js.map +0 -1
- package/core/app/index.js +0 -181
- package/core/app/index.js.map +0 -1
- package/core/components/TablePanel.d.ts +0 -34
- package/core/components/TablePanel.js +0 -127
- package/core/components/TablePanel.js.map +0 -1
- package/core/components/VirtualScroll copy 2.d.ts +0 -24
- package/core/components/VirtualScroll copy 2.js +0 -92
- package/core/components/VirtualScroll copy 2.js.map +0 -1
- package/core/ref/RefObject copy.d.ts +0 -124
- package/core/ref/RefObject copy.js +0 -271
- package/core/ref/RefObject copy.js.map +0 -1
|
@@ -1,10 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export class UListElement extends HTMLUListElement {
|
|
3
|
-
static TAG = "tc-ul-element";
|
|
4
|
-
constructor(props) {
|
|
5
|
-
super();
|
|
6
|
-
Component.applyProps(this, props);
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
TypeComposer.defineElement(UListElement.TAG, UListElement, { extends: "ul" });
|
|
10
|
-
//# sourceMappingURL=UListElement.js.map
|
|
1
|
+
import{Component}from"../../";export class UListElement extends HTMLUListElement{static TAG="tc-ul-element";constructor(e){super(),Component.initComponent(this,UListElement,e)}}TypeComposer.defineElement(UListElement.TAG,UListElement,{extends:"ul"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UListElement.js","sourceRoot":"","sources":["../../../src/core/element/UListElement.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"UListElement.js","sourceRoot":"","sources":["../../../src/core/element/UListElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEhD,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IACjD,MAAM,CAAU,GAAG,GAAW,eAAe,CAAC;IAC9C,YAAY,KAAiC;QAC5C,KAAK,EAAE,CAAC;QACR,aAAa;QACP,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;;AAGF,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ElementType } from "../../";
|
|
2
2
|
export declare class VideoElement extends HTMLVideoElement implements IComponent {
|
|
3
3
|
static readonly TAG: string;
|
|
4
|
-
constructor(props?:
|
|
5
|
-
autoplay?: boolean;
|
|
6
|
-
controls?: boolean;
|
|
7
|
-
loop?: boolean;
|
|
8
|
-
muted?: boolean;
|
|
9
|
-
poster?: string;
|
|
10
|
-
preload?: "auto" | "metadata" | "none";
|
|
11
|
-
src?: string;
|
|
12
|
-
});
|
|
4
|
+
constructor(props?: ElementType<VideoElement>);
|
|
13
5
|
}
|
|
@@ -1,16 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// <video>
|
|
3
|
-
export class VideoElement extends HTMLVideoElement {
|
|
4
|
-
static TAG = "tc-video-element";
|
|
5
|
-
constructor(props) {
|
|
6
|
-
super();
|
|
7
|
-
const src = props?.src;
|
|
8
|
-
delete props?.src;
|
|
9
|
-
if (src) {
|
|
10
|
-
this.appendChild(new SourceElement({ src: src }));
|
|
11
|
-
}
|
|
12
|
-
Component.applyProps(this, props);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
TypeComposer.defineElement(VideoElement.TAG, VideoElement, { extends: "video" });
|
|
16
|
-
//# sourceMappingURL=VideoElement.js.map
|
|
1
|
+
import{Component,SourceElement}from"../../";export class VideoElement extends HTMLVideoElement{static TAG="tc-video-element";constructor(e){super(),e?.src&&this.appendChild(new SourceElement({src:e?.src})),delete e?.src,Component.initComponent(this,VideoElement,e)}}TypeComposer.defineElement(VideoElement.TAG,VideoElement,{extends:"video"});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VideoElement.js","sourceRoot":"","sources":["../../../src/core/element/VideoElement.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"VideoElement.js","sourceRoot":"","sources":["../../../src/core/element/VideoElement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,SAAS,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC/D,UAAU;AACV,MAAM,OAAO,YAAa,SAAQ,gBAAgB;IACjD,MAAM,CAAU,GAAG,GAAW,kBAAkB,CAAC;IACjD,YAAY,KAAiC;QAC5C,KAAK,EAAE,CAAC;QACR,IAAI,KAAK,EAAE,GAAG,EAAE,CAAC;YAChB,IAAI,CAAC,WAAW,CAAC,IAAI,aAAa,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC;QAC1D,CAAC;QACD,OAAO,KAAK,EAAE,GAAG,CAAC;QAClB,aAAa;QACP,SAAS,CAAC,aAAa,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC;IAC1D,CAAC;;AAGF,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC"}
|
package/core/element/index.d.ts
CHANGED
|
@@ -5,9 +5,9 @@ export { DataListElement } from "./DataListElement";
|
|
|
5
5
|
export { DefinitionElement } from "./DefinitionElement";
|
|
6
6
|
export { DivElement } from "./DivElement";
|
|
7
7
|
export { FieldSetElement } from "./FieldSetElement";
|
|
8
|
-
export { FormElement
|
|
8
|
+
export { FormElement } from "./FormElement";
|
|
9
9
|
export { ImageElement } from "./ImageElement";
|
|
10
|
-
export { InputElement
|
|
10
|
+
export { InputElement } from "./InputElement";
|
|
11
11
|
export { LabelElement } from "./LabelElement";
|
|
12
12
|
export { LegendElement } from "./LegendElement";
|
|
13
13
|
export { ListItemElement } from "./ListItemElement";
|
|
@@ -59,7 +59,7 @@ export { TableBodyElement } from "./TableBodyElement";
|
|
|
59
59
|
export { TableCellElement } from "./TableCellElement";
|
|
60
60
|
export { TableColElement } from "./TableColElement";
|
|
61
61
|
export { TableColGroupElement } from "./TableColGroupElement";
|
|
62
|
-
export { TableElement
|
|
62
|
+
export { TableElement } from "./TableElement";
|
|
63
63
|
export { TableFootElement } from "./TableFootElement";
|
|
64
64
|
export { TableFootRowElement } from "./TableFootRowElement";
|
|
65
65
|
export { TableHeadCellElement } from "./TableHeadCellElement";
|
package/core/element/index.js
CHANGED
|
@@ -1,73 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { AnchorElement } from "./AnchorElement";
|
|
3
|
-
export { ButtonElement } from "./ButtonElement";
|
|
4
|
-
export { DataListElement } from "./DataListElement";
|
|
5
|
-
export { DefinitionElement } from "./DefinitionElement";
|
|
6
|
-
export { DivElement } from "./DivElement";
|
|
7
|
-
export { FieldSetElement } from "./FieldSetElement";
|
|
8
|
-
export { FormElement } from "./FormElement";
|
|
9
|
-
export { ImageElement } from "./ImageElement";
|
|
10
|
-
export { InputElement } from "./InputElement";
|
|
11
|
-
export { LabelElement } from "./LabelElement";
|
|
12
|
-
export { LegendElement } from "./LegendElement";
|
|
13
|
-
export { ListItemElement } from "./ListItemElement";
|
|
14
|
-
export { ParagraphElement } from "./ParagraphElement";
|
|
15
|
-
export { AreaElement } from "./AreaElement";
|
|
16
|
-
export { ArticleElement } from "./ArticleElement";
|
|
17
|
-
export { AudioElement } from "./AudioElement";
|
|
18
|
-
export { BaseElement } from "./BaseElement";
|
|
19
|
-
export { BodyElement } from "./BodyElement";
|
|
20
|
-
export { BoldElement } from "./BoldElement";
|
|
21
|
-
export { BreakElement } from "./BreakElement";
|
|
22
|
-
export { CanvasElement } from "./CanvasElement";
|
|
23
|
-
export { CaptionElement } from "./CaptionElement";
|
|
24
|
-
export { CiteElement } from "./CiteElement";
|
|
25
|
-
export { CodeElement } from "./CodeElement";
|
|
26
|
-
export { DefinitionDescriptionElement } from "./DefinitionDescriptionElement";
|
|
27
|
-
export { DeletedTextElement } from "./DeletedTextElement";
|
|
28
|
-
export { DetailsElement } from "./DetailsElement";
|
|
29
|
-
export { DialogElement } from "./DialogElement";
|
|
30
|
-
export { EmbedElement } from "./EmbedElement";
|
|
31
|
-
export { EmElement } from "./EmElement";
|
|
32
|
-
export { FooterElement } from "./FooterElement";
|
|
33
|
-
export { Fragment } from "./Fragment";
|
|
34
|
-
export { H1Element } from "./H1Element";
|
|
35
|
-
export { H2Element } from "./H2Element";
|
|
36
|
-
export { H3Element } from "./H3Element";
|
|
37
|
-
export { H4Element } from "./H4Element";
|
|
38
|
-
export { H5Element } from "./H5Element";
|
|
39
|
-
export { H6Element } from "./H6Element";
|
|
40
|
-
export { HeadElement } from "./HeadElement";
|
|
41
|
-
export { HeaderElement } from "./HeaderElement";
|
|
42
|
-
export { HorizontalRuleElement } from "./HorizontalRuleElement";
|
|
43
|
-
export { HtmlElement } from "./HtmlElement";
|
|
44
|
-
export { IconElement } from "./IconElement";
|
|
45
|
-
export { IFrameElement } from "./IFrameElement";
|
|
46
|
-
export { MainElement } from "./MainElement";
|
|
47
|
-
export { NavElement } from "./NavElement";
|
|
48
|
-
export { OrderedListElement } from "./OrderedListElement";
|
|
49
|
-
export { PreElement } from "./PreElement";
|
|
50
|
-
export { SectionElement } from "./SectionElement";
|
|
51
|
-
export { SelectElement } from "./SelectElement";
|
|
52
|
-
export { SourceElement } from "./SourceElement";
|
|
53
|
-
export { SpanElement } from "./SpanElement";
|
|
54
|
-
export { StrongElement } from "./StrongElement";
|
|
55
|
-
export { StyleElement } from "./StyleElement";
|
|
56
|
-
export { SummaryElement } from "./SummaryElement";
|
|
57
|
-
export { SvgElement } from "./SvgElement";
|
|
58
|
-
export { TableBodyElement } from "./TableBodyElement";
|
|
59
|
-
export { TableCellElement } from "./TableCellElement";
|
|
60
|
-
export { TableColElement } from "./TableColElement";
|
|
61
|
-
export { TableColGroupElement } from "./TableColGroupElement";
|
|
62
|
-
export { TableElement } from "./TableElement";
|
|
63
|
-
export { TableFootElement } from "./TableFootElement";
|
|
64
|
-
export { TableFootRowElement } from "./TableFootRowElement";
|
|
65
|
-
export { TableHeadCellElement } from "./TableHeadCellElement";
|
|
66
|
-
export { TableHeadElement } from "./TableHeadElement";
|
|
67
|
-
export { TableHeadRowElement } from "./TableHeadRowElement";
|
|
68
|
-
export { TableRowElement } from "./TableRowElement";
|
|
69
|
-
export { TextAreaElement } from "./TextAreaElement";
|
|
70
|
-
export { UListElement } from "./UListElement";
|
|
71
|
-
export { VideoElement } from "./VideoElement";
|
|
72
|
-
export { IdiomaticElement } from "./IdiomaticElement";
|
|
73
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export{AbbreviationElement}from"./AbbreviationElement";export{AnchorElement}from"./AnchorElement";export{ButtonElement}from"./ButtonElement";export{DataListElement}from"./DataListElement";export{DefinitionElement}from"./DefinitionElement";export{DivElement}from"./DivElement";export{FieldSetElement}from"./FieldSetElement";export{FormElement}from"./FormElement";export{ImageElement}from"./ImageElement";export{InputElement}from"./InputElement";export{LabelElement}from"./LabelElement";export{LegendElement}from"./LegendElement";export{ListItemElement}from"./ListItemElement";export{ParagraphElement}from"./ParagraphElement";export{AreaElement}from"./AreaElement";export{ArticleElement}from"./ArticleElement";export{AudioElement}from"./AudioElement";export{BaseElement}from"./BaseElement";export{BodyElement}from"./BodyElement";export{BoldElement}from"./BoldElement";export{BreakElement}from"./BreakElement";export{CanvasElement}from"./CanvasElement";export{CaptionElement}from"./CaptionElement";export{CiteElement}from"./CiteElement";export{CodeElement}from"./CodeElement";export{DefinitionDescriptionElement}from"./DefinitionDescriptionElement";export{DeletedTextElement}from"./DeletedTextElement";export{DetailsElement}from"./DetailsElement";export{DialogElement}from"./DialogElement";export{EmbedElement}from"./EmbedElement";export{EmElement}from"./EmElement";export{FooterElement}from"./FooterElement";export{Fragment}from"./Fragment";export{H1Element}from"./H1Element";export{H2Element}from"./H2Element";export{H3Element}from"./H3Element";export{H4Element}from"./H4Element";export{H5Element}from"./H5Element";export{H6Element}from"./H6Element";export{HeadElement}from"./HeadElement";export{HeaderElement}from"./HeaderElement";export{HorizontalRuleElement}from"./HorizontalRuleElement";export{HtmlElement}from"./HtmlElement";export{IconElement}from"./IconElement";export{IFrameElement}from"./IFrameElement";export{MainElement}from"./MainElement";export{NavElement}from"./NavElement";export{OrderedListElement}from"./OrderedListElement";export{PreElement}from"./PreElement";export{SectionElement}from"./SectionElement";export{SelectElement}from"./SelectElement";export{SourceElement}from"./SourceElement";export{SpanElement}from"./SpanElement";export{StrongElement}from"./StrongElement";export{StyleElement}from"./StyleElement";export{SummaryElement}from"./SummaryElement";export{SvgElement}from"./SvgElement";export{TableBodyElement}from"./TableBodyElement";export{TableCellElement}from"./TableCellElement";export{TableColElement}from"./TableColElement";export{TableColGroupElement}from"./TableColGroupElement";export{TableElement}from"./TableElement";export{TableFootElement}from"./TableFootElement";export{TableFootRowElement}from"./TableFootRowElement";export{TableHeadCellElement}from"./TableHeadCellElement";export{TableHeadElement}from"./TableHeadElement";export{TableHeadRowElement}from"./TableHeadRowElement";export{TableRowElement}from"./TableRowElement";export{TextAreaElement}from"./TextAreaElement";export{UListElement}from"./UListElement";export{VideoElement}from"./VideoElement";export{IdiomaticElement}from"./IdiomaticElement";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/element/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/element/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aA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oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/core/event/index.js
CHANGED
|
@@ -1,75 +1 @@
|
|
|
1
|
-
export class EventComponent extends Event {
|
|
2
|
-
data = [];
|
|
3
|
-
isInit = false;
|
|
4
|
-
static events = new Map();
|
|
5
|
-
eventsListener = new Map();
|
|
6
|
-
static serialize = "event-component-";
|
|
7
|
-
constructor(type, options) {
|
|
8
|
-
super(EventComponent.serialize + type, options);
|
|
9
|
-
}
|
|
10
|
-
static emitEvent(type, ...data) {
|
|
11
|
-
const event = EventComponent.createEventBase(type, ...data);
|
|
12
|
-
if (event) {
|
|
13
|
-
if (data.length > 0)
|
|
14
|
-
event.data = data;
|
|
15
|
-
event.isInit = true;
|
|
16
|
-
return document.dispatchEvent(event);
|
|
17
|
-
}
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
static createEventBase(type, ...data) {
|
|
21
|
-
if (type === undefined || type === null || type === "")
|
|
22
|
-
return null;
|
|
23
|
-
let event = EventComponent.events.get(type);
|
|
24
|
-
if (event)
|
|
25
|
-
return event;
|
|
26
|
-
event = new EventComponent(type);
|
|
27
|
-
EventComponent.events.set(type, event);
|
|
28
|
-
event.data = data;
|
|
29
|
-
event.isInit = data.length > 0;
|
|
30
|
-
return event;
|
|
31
|
-
}
|
|
32
|
-
static createEvent(type, ...data) {
|
|
33
|
-
return EventComponent.createEventBase(type, ...data) !== null;
|
|
34
|
-
}
|
|
35
|
-
static addEventListener(component, type, listener, options) {
|
|
36
|
-
const e = EventComponent.createEventBase(type);
|
|
37
|
-
if (e) {
|
|
38
|
-
const eventListener = function (event) {
|
|
39
|
-
listener(...event.data);
|
|
40
|
-
};
|
|
41
|
-
if (e.isInit)
|
|
42
|
-
listener(...e.data);
|
|
43
|
-
const listeners = e.eventsListener.get(component) || [];
|
|
44
|
-
listeners.push(eventListener);
|
|
45
|
-
e.eventsListener.set(component, listeners);
|
|
46
|
-
document.addEventListener(e.type, eventListener, options);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
static removeEventListener(component, type) {
|
|
50
|
-
const e = EventComponent.events.get(type);
|
|
51
|
-
if (e) {
|
|
52
|
-
const listeners = e.eventsListener.get(component);
|
|
53
|
-
if (listeners) {
|
|
54
|
-
for (let event of listeners) {
|
|
55
|
-
document.removeEventListener(e.type, event);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
static removeEventListeners(component) {
|
|
61
|
-
for (let type of EventComponent.events.keys()) {
|
|
62
|
-
EventComponent.removeEventListener(component, type);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
static deleteEvent(type) {
|
|
66
|
-
const e = EventComponent.events.get(type);
|
|
67
|
-
if (e) {
|
|
68
|
-
for (let component of e.eventsListener.keys()) {
|
|
69
|
-
EventComponent.removeEventListeners(component);
|
|
70
|
-
}
|
|
71
|
-
EventComponent.events.delete(type);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export class EventComponent extends Event{data=[];isInit=!1;static events=new Map;eventsListener=new Map;static serialize="event-component-";constructor(e,t){super(EventComponent.serialize+e,t)}static emitEvent(e,...t){const n=EventComponent.createEventBase(e,...t);return!!n&&(t.length>0&&(n.data=t),n.isInit=!0,document.dispatchEvent(n))}static createEventBase(e,...t){if(null==e||""===e)return null;let n=EventComponent.events.get(e);return n||(n=new EventComponent(e),EventComponent.events.set(e,n),n.data=t,n.isInit=t.length>0,n)}static createEvent(e,...t){return null!==EventComponent.createEventBase(e,...t)}static addEventListener(e,t,n,s){const o=EventComponent.createEventBase(t);if(o){const t=function(e){n(...e.data)};o.isInit&&n(...o.data);const v=o.eventsListener.get(e)||[];v.push(t),o.eventsListener.set(e,v),document.addEventListener(o.type,t,s)}}static removeEventListener(e,t){const n=EventComponent.events.get(t);if(n){const t=n.eventsListener.get(e);if(t)for(let e of t)document.removeEventListener(n.type,e)}}static removeEventListeners(e){for(let t of EventComponent.events.keys())EventComponent.removeEventListener(e,t)}static deleteEvent(e){const t=EventComponent.events.get(e);if(t){for(let e of t.eventsListener.keys())EventComponent.removeEventListeners(e);EventComponent.events.delete(e)}}}
|
package/core/index.d.ts
CHANGED
package/core/index.js
CHANGED
|
@@ -1,10 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export * from "./app";
|
|
3
|
-
export * from "./app/Validate";
|
|
4
|
-
export * from "../global";
|
|
5
|
-
export * from "./styles";
|
|
6
|
-
export * from "./decorators";
|
|
7
|
-
export * from "./element";
|
|
8
|
-
export * from "./components";
|
|
9
|
-
export * from "./router";
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export*from"../global";export*from"./styles";export*from"./decorators";export*from"./element";export*from"./components";export*from"./router";
|
package/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC"}
|
package/core/ref/Computed.js
CHANGED
|
@@ -1,75 +1 @@
|
|
|
1
|
-
import { ref }
|
|
2
|
-
function isTemplateElement(value) {
|
|
3
|
-
const cache = new Map();
|
|
4
|
-
if (!Array.isArray(value)) {
|
|
5
|
-
value = [value];
|
|
6
|
-
}
|
|
7
|
-
for (const v of value) {
|
|
8
|
-
if (v && v instanceof HTMLElement) {
|
|
9
|
-
const key = (v.key || "").toString();
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
return cache.size > 0;
|
|
13
|
-
}
|
|
14
|
-
const computedSymbol = Symbol("computed");
|
|
15
|
-
class ComputedSet extends Set {
|
|
16
|
-
[computedSymbol] = true;
|
|
17
|
-
elements = new Map();
|
|
18
|
-
put(item) {
|
|
19
|
-
if (item && item instanceof ref) {
|
|
20
|
-
this.add(item);
|
|
21
|
-
return item.value;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
cache(key) {
|
|
25
|
-
return { key: key, controller: this };
|
|
26
|
-
}
|
|
27
|
-
setCache(key, value) {
|
|
28
|
-
this.elements.set(key, new WeakRef(value));
|
|
29
|
-
}
|
|
30
|
-
getCache(key) {
|
|
31
|
-
const ref = this.elements.get(key);
|
|
32
|
-
if (ref && !ref.deref()) {
|
|
33
|
-
this.elements.delete(key);
|
|
34
|
-
}
|
|
35
|
-
return ref ? ref.deref() : undefined;
|
|
36
|
-
}
|
|
37
|
-
clone() {
|
|
38
|
-
const newSet = new ComputedSet();
|
|
39
|
-
for (const item of this) {
|
|
40
|
-
newSet.add(item);
|
|
41
|
-
}
|
|
42
|
-
return newSet;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
export function computed(fn, ...values) {
|
|
46
|
-
if (typeof fn !== "function")
|
|
47
|
-
throw new Error("computed: fn must be a function");
|
|
48
|
-
const observers = new ComputedSet();
|
|
49
|
-
for (const v of values) {
|
|
50
|
-
observers.put(v);
|
|
51
|
-
}
|
|
52
|
-
// @ts-ignore
|
|
53
|
-
const r = ref(fn(observers));
|
|
54
|
-
// @ts-ignore
|
|
55
|
-
const func = observers.length > 0 ? () => fn(observers)
|
|
56
|
-
: () => {
|
|
57
|
-
const oldObservers = observers.clone();
|
|
58
|
-
observers.clear();
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
r.value = fn(observers);
|
|
61
|
-
const observersToRemove = oldObservers.size > 0 ? [...oldObservers].filter(o => !observers.has(o)) : [];
|
|
62
|
-
const observersToAdd = observers.size > 0 ? [...observers].filter(o => !oldObservers.has(o)) : [];
|
|
63
|
-
for (const item of observersToRemove) {
|
|
64
|
-
item.unsubscribe(func);
|
|
65
|
-
}
|
|
66
|
-
for (const item of observersToAdd) {
|
|
67
|
-
item.listen(func);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
for (const item of observers) {
|
|
71
|
-
item.listen(func);
|
|
72
|
-
}
|
|
73
|
-
return r;
|
|
74
|
-
}
|
|
75
|
-
//# sourceMappingURL=Computed.js.map
|
|
1
|
+
import{ref}from"./RefObject";function isTemplateElement(e){const t=new Map;Array.isArray(e)||(e=[e]);for(const t of e)if(t&&t instanceof HTMLElement){(t.key||"").toString()}return t.size>0}const computedSymbol=Symbol("computed");class ComputedSet extends Set{[computedSymbol]=!0;elements=new Map;put(e){if(e&&e instanceof ref)return this.add(e),e.value}cache(e){return{key:e,controller:this}}setCache(e,t){this.elements.set(e,new WeakRef(t))}getCache(e){const t=this.elements.get(e);return t&&!t.deref()&&this.elements.delete(e),t?t.deref():void 0}clone(){const e=new ComputedSet;for(const t of this)e.add(t);return e}}export function computed(e,...t){if("function"!=typeof e)throw new Error("computed: fn must be a function");const o=new ComputedSet;for(const e of t)o.put(e);const n=e(o),s=ref(n),r=()=>{const t=o.clone();o.clear(),s.value=e(o);const n=t.size>0?[...t].filter(e=>!o.has(e)):[],c=o.size>0?[...o].filter(e=>!t.has(e)):[];for(const e of n)e.unsubscribe(r);for(const e of c)e.listen(r)};for(const e of o)e.listen(r);return s}
|
package/core/ref/Computed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Computed.js","sourceRoot":"","sources":["../../../src/core/ref/Computed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,GAAG,EAAE,MAAM,aAAa,CAAC;AAEvD,SAAS,iBAAiB,CAAC,KAAU;IACnC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAe,CAAC;IACrC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,YAAY,WAAW,EAAE,CAAC;YAClC,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"Computed.js","sourceRoot":"","sources":["../../../src/core/ref/Computed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,GAAG,EAAE,MAAM,aAAa,CAAC;AAEvD,SAAS,iBAAiB,CAAC,KAAU;IACnC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAe,CAAC;IACrC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAC1B,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;IACD,KAAK,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,IAAI,CAAC,YAAY,WAAW,EAAE,CAAC;YAClC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;QACvC,CAAC;IACH,CAAC;IACD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C,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,CAAC;IACF,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,CAAkB,CAAC;AAC5B,CAAC"}
|
package/core/ref/RefBoolean.js
CHANGED
|
@@ -1,119 +1 @@
|
|
|
1
|
-
import { Ref }
|
|
2
|
-
import { RefContainer } from "./RefContainer";
|
|
3
|
-
/**
|
|
4
|
-
* Creates a new reactive boolean reference.
|
|
5
|
-
*
|
|
6
|
-
* @param value - The initial boolean value.
|
|
7
|
-
* @returns A new instance of RefBoolean.
|
|
8
|
-
*/
|
|
9
|
-
export function refBoolean(value) {
|
|
10
|
-
return new RefBoolean(value);
|
|
11
|
-
}
|
|
12
|
-
// Customizes instanceof behavior for type checking
|
|
13
|
-
Object.defineProperty(refBoolean, Symbol.hasInstance, {
|
|
14
|
-
value: function (instance) {
|
|
15
|
-
return !!instance && instance instanceof RefBoolean;
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
/**
|
|
19
|
-
* Reactive wrapper for a boolean value, supporting subscriptions and reactivity.
|
|
20
|
-
*/
|
|
21
|
-
export class RefBoolean {
|
|
22
|
-
/**
|
|
23
|
-
* Internal container that manages subscribers and the current value.
|
|
24
|
-
*/
|
|
25
|
-
container;
|
|
26
|
-
id;
|
|
27
|
-
/**
|
|
28
|
-
* Constructs a reactive boolean wrapper.
|
|
29
|
-
*
|
|
30
|
-
* @param value - The initial boolean value.
|
|
31
|
-
* @param refKey - Optional key used for registration in a central Ref registry.
|
|
32
|
-
*/
|
|
33
|
-
constructor(value) {
|
|
34
|
-
this.container = new RefContainer(value);
|
|
35
|
-
this.id = this.container.id;
|
|
36
|
-
// Registers in Ref registry if key is provided
|
|
37
|
-
Ref.set(this.id, this);
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Emits a change if the new value differs from the current value.
|
|
41
|
-
*
|
|
42
|
-
* @param propertyName - The property being updated (typically "value").
|
|
43
|
-
* @param value - The new value being set.
|
|
44
|
-
*/
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
emit(propertyName, value) {
|
|
47
|
-
if (this.value === value)
|
|
48
|
-
return;
|
|
49
|
-
const oldValue = this.valueOf();
|
|
50
|
-
this.container.emitAll(propertyName, (this.container.value = value.valueOf()), oldValue);
|
|
51
|
-
}
|
|
52
|
-
subscribe(target, propertyName, onUnsubscribe) {
|
|
53
|
-
return this.container.emit(this.container.subscribe(target, propertyName, onUnsubscribe), this.value, this.value);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Subscribes to value changes without emitting the current value.
|
|
57
|
-
*
|
|
58
|
-
* @param target - Callback function to be invoked on future value changes.
|
|
59
|
-
* @param onUnsubscribe - Optional callback to be invoked when unsubscribed.
|
|
60
|
-
* @returns true if subscription was successful.
|
|
61
|
-
*/
|
|
62
|
-
listen(target, onUnsubscribe) {
|
|
63
|
-
return this.container.subscribe(target, onUnsubscribe) !== undefined;
|
|
64
|
-
}
|
|
65
|
-
unsubscribe(targe, propertyName = "") {
|
|
66
|
-
return this.container.unsubscribe(targe, propertyName);
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Provides primitive conversion support for the boolean wrapper.
|
|
70
|
-
*
|
|
71
|
-
* @param hint - The conversion context ("default", "number", "string", etc.)
|
|
72
|
-
* @returns The primitive boolean value.
|
|
73
|
-
*/
|
|
74
|
-
[Symbol.toPrimitive](hint) {
|
|
75
|
-
if (hint === "boolean" || hint === "default") {
|
|
76
|
-
return this.value;
|
|
77
|
-
}
|
|
78
|
-
return this.valueOf();
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Specifies the primitive type associated with this object.
|
|
82
|
-
*/
|
|
83
|
-
static get [Symbol.species]() {
|
|
84
|
-
return Boolean;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Gets the current boolean value.
|
|
88
|
-
*/
|
|
89
|
-
get value() {
|
|
90
|
-
return this.container.value.valueOf();
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Sets a new boolean value and notifies subscribers if changed.
|
|
94
|
-
*/
|
|
95
|
-
set value(value) {
|
|
96
|
-
this.emit("value", value);
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Returns the primitive boolean value.
|
|
100
|
-
*/
|
|
101
|
-
valueOf() {
|
|
102
|
-
return this.value.valueOf();
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Returns a JSON-serializable representation of this boolean.
|
|
106
|
-
* If this is a root ref, only the value is returned. Otherwise, a wrapped object is returned.
|
|
107
|
-
*/
|
|
108
|
-
// @ts-ignore
|
|
109
|
-
toJSON() {
|
|
110
|
-
return this.container.root ? this.value : { value: this.value };
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Returns a string representation of the current value.
|
|
114
|
-
*/
|
|
115
|
-
toString() {
|
|
116
|
-
return this.container.toString();
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
//# sourceMappingURL=RefBoolean.js.map
|
|
1
|
+
import{Ref}from".";import{RefContainer}from"./RefContainer";export function refBoolean(e){return new RefBoolean(e)}Object.defineProperty(refBoolean,Symbol.hasInstance,{value:function(e){return!!e&&e instanceof RefBoolean}});export class RefBoolean{container;id;constructor(e){this.container=new RefContainer(e),this.id=this.container.id,Ref.set(this.id,this)}emit(e,t){if(this.value===t)return;const i=this.valueOf();this.container.emitAll(e,this.container.value=t.valueOf(),i)}subscribe(e,t,i){return this.container.emit(this.container.subscribe(e,t,i),this.value,this.value)}listen(e,t){return void 0!==this.container.subscribe(e,t)}unsubscribe(e,t=""){return this.container.unsubscribe(e,t)}[Symbol.toPrimitive](e){return"boolean"===e||"default"===e?this.value:this.valueOf()}static get[Symbol.species](){return Boolean}get value(){return this.container.value.valueOf()}set value(e){this.emit("value",e)}valueOf(){return this.value.valueOf()}toJSON(){return this.container.root?this.value:{value:this.value}}toString(){return this.container.toString()}}
|
package/core/ref/RefContainer.js
CHANGED
|
@@ -1,114 +1 @@
|
|
|
1
|
-
import { Ref }
|
|
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
|
+
import{Ref}from".";const refSubscriber=Symbol("refSubscriber");export class RefContainer{value;root;static#t=0;#e=[];id=`${Math.random().toString(36).substring(2,4)}${RefContainer.#t++}`;constructor(t,e){this.value=t,this.root=e}emit(t,e,r){if(t.target instanceof Function)t.target(e,r);else{const s=t.target.deref();if(void 0===s)return this.#e=this.#e.filter(e=>e!==t),!1;"function"==typeof s[t.propertyName]?s[t.propertyName](e,r):s[t.propertyName]!==e&&(s[t.propertyName]=e)}return!0}info(){}emitAll(t,e,r){return this.#e.forEach(t=>this.emit(t,e,r)),this.root&&this.root.emitAll&&this.root.emitAll("value",this.root.instance?this.root.instance.value:this.root.value,r),e}getSubscriber(t,e){const r={subscriber:void 0,index:-1};if("function"==typeof t){const e=this.#e.findIndex(e=>e.target===t);r.index=e,-1!==e&&(r.subscriber=this.#e[e])}else{const s=this.#e.findIndex(r=>"function"!=typeof r.target&&r.target.deref()===t&&r.propertyName===e);r.index=s,-1!==s&&(r.subscriber=this.#e[s])}return r}subscribe(t,e,r){const s=this.getSubscriber(t,e);if(e instanceof Function&&(r=e),s.subscriber)return s.subscriber;const i={target:t instanceof Function?t:new WeakRef(t),propertyName:"string"==typeof e?e:"",onUnsubscribe:r,refSubscriber:refSubscriber};return this.#e.push(i),"function"!=typeof t&&Ref.subscribe(t,"string"==typeof e?e:"",this),i}listen(t,e){return this.subscribe(t,e)}unsubscribe(t,e){const r=this.getSubscriber(t,e);return void 0!==r.subscriber&&(r.subscriber.onUnsubscribe?.(),this.#e=this.#e.filter((t,e)=>e!==r.index),"function"!=typeof t&&Ref.unsubscribe(t,e),!0)}[Symbol.toPrimitive](t){return"string"===t||"default"===t?this.value:this.value.valueOf()}toString(){return"object"==typeof this.value?JSON.stringify(this.value):this.value instanceof Object?"[object Object]":this.value.toString()}toJSON(){try{return JSON.parse(JSON.stringify(this.value))}catch(t){return{}}}}
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;IAMJ;IAA6B;IALhD,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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