@zcomponent/html 1.0.0 → 1.2.0

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.
@@ -1,12 +1,17 @@
1
1
  import { Component, ConstructorProps, ContextManager, Event, Observable } from '@zcomponent/core';
2
2
  export interface HTMLElementProps extends ConstructorProps {
3
- /** @zprop */
4
3
  innerText?: string;
5
4
  }
6
5
  export declare class ZHTMLElement<T extends HTMLElement> extends Component {
7
6
  element: T;
8
7
  /** @zprop */
9
8
  onClick: Event<[MouseEvent]>;
9
+ /**
10
+ * @zprop
11
+ * @ztype text-multiline
12
+ * @zgrouppriority 21
13
+ */
14
+ innerText: Observable<string, never>;
10
15
  constructor(contextManager: ContextManager, props: HTMLElementProps, element: T);
11
16
  appendChild(c: Component): void;
12
17
  private _connectChild;
@@ -6,6 +6,12 @@ export class ZHTMLElement extends Component {
6
6
  this.element = element;
7
7
  /** @zprop */
8
8
  this.onClick = new Event();
9
+ /**
10
+ * @zprop
11
+ * @ztype text-multiline
12
+ * @zgrouppriority 21
13
+ */
14
+ this.innerText = new Observable('');
9
15
  /** @zprop */
10
16
  this.id = new Observable('', v => (this.element.id = v));
11
17
  /** @zprop */
@@ -91,8 +97,12 @@ export class ZHTMLElement extends Component {
91
97
  * @zdefault row
92
98
  */
93
99
  this.flexDirection = new Observable(CSSFlexDirection.row, v => (this.element.style.flexDirection = v));
94
- if (props.innerText !== undefined)
100
+ if (props.innerText === undefined) {
101
+ this.innerText.addListener(v => (element.innerText = v));
102
+ }
103
+ else {
95
104
  element.innerText = props.innerText;
105
+ }
96
106
  for (const child of this.children) {
97
107
  this._connectChild(child);
98
108
  }
package/lib/i.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { ContextManager } from '@zcomponent/core';
2
+ import { HTMLElementProps, ZHTMLElement } from './HTMLElement';
3
+ /** @zcomponent
4
+ * @ztag html/element/i
5
+ * @zparents html/element/**
6
+ * @zicon html
7
+ */
8
+ export declare class I extends ZHTMLElement<HTMLElement> {
9
+ constructor(mgr: ContextManager, props: HTMLElementProps);
10
+ }
package/lib/i.js ADDED
@@ -0,0 +1,11 @@
1
+ import { ZHTMLElement } from './HTMLElement';
2
+ /** @zcomponent
3
+ * @ztag html/element/i
4
+ * @zparents html/element/**
5
+ * @zicon html
6
+ */
7
+ export class I extends ZHTMLElement {
8
+ constructor(mgr, props) {
9
+ super(mgr, props, document.createElement('i'));
10
+ }
11
+ }
package/lib/span.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ import { ContextManager } from '@zcomponent/core';
2
+ import { HTMLElementProps, ZHTMLElement } from './HTMLElement';
3
+ /** @zcomponent
4
+ * @ztag html/element/span
5
+ * @zparents html/element/**
6
+ * @zicon html
7
+ */
8
+ export declare class Span extends ZHTMLElement<HTMLSpanElement> {
9
+ constructor(mgr: ContextManager, props: HTMLElementProps);
10
+ }
package/lib/span.js ADDED
@@ -0,0 +1,11 @@
1
+ import { ZHTMLElement } from './HTMLElement';
2
+ /** @zcomponent
3
+ * @ztag html/element/span
4
+ * @zparents html/element/**
5
+ * @zicon html
6
+ */
7
+ export class Span extends ZHTMLElement {
8
+ constructor(mgr, props) {
9
+ super(mgr, props, document.createElement('span'));
10
+ }
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcomponent/html",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",