@zcomponent/html 0.0.2 → 0.0.4

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/lib/CSS.d.ts CHANGED
@@ -4,6 +4,11 @@ interface CSSConstructorProps {
4
4
  * @zvalues files *.css
5
5
  */
6
6
  source: string;
7
+ /**
8
+ * @zprop
9
+ * @zdefault true
10
+ */
11
+ includeAtDesignTime: boolean;
7
12
  }
8
13
  /**
9
14
  * The CSS component will ensure that the CSS file referenced by its `source` constructor prop is added to your page and loaded by the browser.
package/lib/CSS.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Component, registerLoadable } from '@zcomponent/core';
1
+ import { Component, isDesignTime, registerLoadable } from '@zcomponent/core';
2
2
  const alreadyAdded = new Map();
3
3
  /**
4
4
  * The CSS component will ensure that the CSS file referenced by its `source` constructor prop is added to your page and loaded by the browser.
@@ -12,7 +12,7 @@ export class CSS extends Component {
12
12
  constructor(contextManager, constructorProps) {
13
13
  super(contextManager, constructorProps);
14
14
  this.constructorProps = constructorProps;
15
- if (!constructorProps.source)
15
+ if (!constructorProps.source || (constructorProps.includeAtDesignTime === false && isDesignTime(contextManager)))
16
16
  return;
17
17
  this._elm = alreadyAdded.get(constructorProps.source);
18
18
  if (this._elm)
@@ -120,7 +120,7 @@ export class ZHTMLElement extends Component {
120
120
  const handler = (e) => {
121
121
  evt.emit(e);
122
122
  };
123
- evt.hasBindings.withValue(b => {
123
+ evt.hasListeners.addListener(b => {
124
124
  if (b)
125
125
  this.element.addEventListener(evtName, handler);
126
126
  else
@@ -0,0 +1,56 @@
1
+ import { ContextManager } from '@zcomponent/core';
2
+ import { HTMLElementProps, ZHTMLElement } from './HTMLElement';
3
+ /** @zcomponent
4
+ * @ztag html/element/h1
5
+ * @zparents html/element/**
6
+ * @zgroup Heading
7
+ * @zicon html
8
+ */
9
+ export declare class H1 extends ZHTMLElement<HTMLHeadingElement> {
10
+ constructor(mgr: ContextManager, props: HTMLElementProps);
11
+ }
12
+ /** @zcomponent
13
+ * @ztag html/element/h2
14
+ * @zparents html/element/**
15
+ * @zgroup Heading
16
+ * @zicon html
17
+ */
18
+ export declare class H2 extends ZHTMLElement<HTMLHeadingElement> {
19
+ constructor(mgr: ContextManager, props: HTMLElementProps);
20
+ }
21
+ /** @zcomponent
22
+ * @ztag html/element/h3
23
+ * @zparents html/element/**
24
+ * @zicon html
25
+ * @zgroup Heading
26
+ */
27
+ export declare class H3 extends ZHTMLElement<HTMLHeadingElement> {
28
+ constructor(mgr: ContextManager, props: HTMLElementProps);
29
+ }
30
+ /** @zcomponent
31
+ * @ztag html/element/h4
32
+ * @zparents html/element/**
33
+ * @zicon html
34
+ * @zgroup Heading
35
+ */
36
+ export declare class H4 extends ZHTMLElement<HTMLHeadingElement> {
37
+ constructor(mgr: ContextManager, props: HTMLElementProps);
38
+ }
39
+ /** @zcomponent
40
+ * @ztag html/element/h5
41
+ * @zparents html/element/**
42
+ * @zicon html
43
+ * @zgroup Heading
44
+ */
45
+ export declare class H5 extends ZHTMLElement<HTMLHeadingElement> {
46
+ constructor(mgr: ContextManager, props: HTMLElementProps);
47
+ }
48
+ /** @zcomponent
49
+ * @ztag html/element/h6
50
+ * @zparents html/element/**
51
+ * @zicon html
52
+ * @zgroup Heading
53
+ */
54
+ export declare class H6 extends ZHTMLElement<HTMLHeadingElement> {
55
+ constructor(mgr: ContextManager, props: HTMLElementProps);
56
+ }
@@ -0,0 +1,67 @@
1
+ import { ZHTMLElement } from './HTMLElement';
2
+ /** @zcomponent
3
+ * @ztag html/element/h1
4
+ * @zparents html/element/**
5
+ * @zgroup Heading
6
+ * @zicon html
7
+ */
8
+ export class H1 extends ZHTMLElement {
9
+ constructor(mgr, props) {
10
+ super(mgr, props, document.createElement('h1'));
11
+ }
12
+ }
13
+ /** @zcomponent
14
+ * @ztag html/element/h2
15
+ * @zparents html/element/**
16
+ * @zgroup Heading
17
+ * @zicon html
18
+ */
19
+ export class H2 extends ZHTMLElement {
20
+ constructor(mgr, props) {
21
+ super(mgr, props, document.createElement('h2'));
22
+ }
23
+ }
24
+ /** @zcomponent
25
+ * @ztag html/element/h3
26
+ * @zparents html/element/**
27
+ * @zicon html
28
+ * @zgroup Heading
29
+ */
30
+ export class H3 extends ZHTMLElement {
31
+ constructor(mgr, props) {
32
+ super(mgr, props, document.createElement('h3'));
33
+ }
34
+ }
35
+ /** @zcomponent
36
+ * @ztag html/element/h4
37
+ * @zparents html/element/**
38
+ * @zicon html
39
+ * @zgroup Heading
40
+ */
41
+ export class H4 extends ZHTMLElement {
42
+ constructor(mgr, props) {
43
+ super(mgr, props, document.createElement('h4'));
44
+ }
45
+ }
46
+ /** @zcomponent
47
+ * @ztag html/element/h5
48
+ * @zparents html/element/**
49
+ * @zicon html
50
+ * @zgroup Heading
51
+ */
52
+ export class H5 extends ZHTMLElement {
53
+ constructor(mgr, props) {
54
+ super(mgr, props, document.createElement('h5'));
55
+ }
56
+ }
57
+ /** @zcomponent
58
+ * @ztag html/element/h6
59
+ * @zparents html/element/**
60
+ * @zicon html
61
+ * @zgroup Heading
62
+ */
63
+ export class H6 extends ZHTMLElement {
64
+ constructor(mgr, props) {
65
+ super(mgr, props, document.createElement('h6'));
66
+ }
67
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zcomponent/html",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "author": "Zappar Limited",
19
19
  "license": "Proprietary",
20
20
  "dependencies": {
21
- "@zcomponent/core": "~0.0.9"
21
+ "@zcomponent/core": "~0.0.15"
22
22
  },
23
23
  "devDependencies": {
24
24
  "typescript": "^4.9.4"