@zcomponent/html 1.3.2 → 1.4.0-beta
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.js +5 -1
- package/lib/HTMLElement.js +2 -1
- package/lib/context.d.ts +1 -0
- package/lib/context.js +1 -0
- package/package.json +2 -2
package/lib/CSS.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Component, isDesignTime, registerLoadable } from '@zcomponent/core';
|
|
2
|
+
import { HTMLContext } from './context';
|
|
2
3
|
const alreadyAdded = new Map();
|
|
3
4
|
/**
|
|
4
5
|
* 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.
|
|
@@ -20,7 +21,10 @@ export class CSS extends Component {
|
|
|
20
21
|
else {
|
|
21
22
|
this._elm = [1, document.createElement('link')];
|
|
22
23
|
registerLoadable(contextManager, new Promise((resolve, reject) => {
|
|
23
|
-
this._elm[1].addEventListener('load',
|
|
24
|
+
this._elm[1].addEventListener('load', () => {
|
|
25
|
+
contextManager.get(HTMLContext).onCSSChanged.emit();
|
|
26
|
+
resolve();
|
|
27
|
+
});
|
|
24
28
|
this._elm[1].addEventListener('error', reject);
|
|
25
29
|
}));
|
|
26
30
|
this._elm[1].setAttribute('rel', 'stylesheet');
|
package/lib/HTMLElement.js
CHANGED
package/lib/context.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Event, ContextManager, Context } from '@zcomponent/core';
|
|
|
2
2
|
export declare class HTMLContext extends Context {
|
|
3
3
|
onNodeConstructed: Event<[Node]>;
|
|
4
4
|
onNodeDisposed: Event<[Node]>;
|
|
5
|
+
onCSSChanged: Event<[]>;
|
|
5
6
|
}
|
|
6
7
|
export declare function useOnNodeConstructed(mgr: ContextManager): Event<[Node]>;
|
|
7
8
|
export declare function useOnNodeDisposed(mgr: ContextManager): Event<[Node]>;
|
package/lib/context.js
CHANGED