element-vir 12.1.2 → 12.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.
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { typedHasProperties, typedHasProperty } from '@augment-vir/common';
|
|
2
|
+
export function isDeclarativeElement(input) {
|
|
3
|
+
const markerProperties = [
|
|
4
|
+
'instanceInputs',
|
|
5
|
+
'instanceState',
|
|
6
|
+
'definition',
|
|
7
|
+
];
|
|
8
|
+
return typedHasProperties(input, markerProperties);
|
|
9
|
+
}
|
|
10
|
+
export function assertsIsDeclarativeElement(input) {
|
|
11
|
+
if (!isDeclarativeElement(input)) {
|
|
12
|
+
console.error({ notDeclarativeElement: input });
|
|
13
|
+
throw new Error(`${typedHasProperty(input, 'tagName') ? input.tagName : input} is not a declarative element.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export * from './declarative-element/directives/on-dom-created.directive';
|
|
|
12
12
|
export * from './declarative-element/directives/on-resize.directive';
|
|
13
13
|
export * from './declarative-element/directives/render-async-state.directive';
|
|
14
14
|
export * from './declarative-element/directives/render-if.directive';
|
|
15
|
+
export * from './declarative-element/is-declarative-element';
|
|
15
16
|
export * from './declarative-element/properties/async-state';
|
|
16
17
|
export * from './declarative-element/properties/css-vars';
|
|
17
18
|
export * from './declarative-element/properties/element-events';
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export * from './declarative-element/directives/on-dom-created.directive';
|
|
|
11
11
|
export * from './declarative-element/directives/on-resize.directive';
|
|
12
12
|
export * from './declarative-element/directives/render-async-state.directive';
|
|
13
13
|
export * from './declarative-element/directives/render-if.directive';
|
|
14
|
+
export * from './declarative-element/is-declarative-element';
|
|
14
15
|
export * from './declarative-element/properties/async-state';
|
|
15
16
|
export * from './declarative-element/properties/css-vars';
|
|
16
17
|
export * from './declarative-element/properties/element-events';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { typedHasProperty } from '@augment-vir/common';
|
|
1
2
|
export function hasStaticTagName(value) {
|
|
2
|
-
return (
|
|
3
|
-
value.hasOwnProperty('tagName') &&
|
|
3
|
+
return (typedHasProperty(value, 'tagName') &&
|
|
4
4
|
typeof value.tagName === 'string' &&
|
|
5
5
|
value.tagName.includes('-'));
|
|
6
6
|
}
|