element-vir 12.5.0 → 12.5.2
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,16 +1,10 @@
|
|
|
1
1
|
import { getObjectTypedKeys } from '@augment-vir/common';
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
3
2
|
export function assignInputs(element, inputs) {
|
|
4
3
|
const instanceState = element.instanceState;
|
|
5
4
|
getObjectTypedKeys(inputs).forEach((newInputKey) => {
|
|
6
5
|
if (instanceState && newInputKey in instanceState) {
|
|
7
6
|
throw new Error(`Cannot set input '${newInputKey}' on '${element.tagName}'. '${element.tagName}' already has a state property with the same name.`);
|
|
8
7
|
}
|
|
9
|
-
/**
|
|
10
|
-
* No need to check if it's already a property or not, as the property function already
|
|
11
|
-
* makes that check.
|
|
12
|
-
*/
|
|
13
|
-
property()(element, newInputKey);
|
|
14
8
|
if ('instanceInputs' in element) {
|
|
15
9
|
element.instanceInputs[newInputKey] =
|
|
16
10
|
inputs[newInputKey];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { property } from 'lit/decorators.js';
|
|
1
2
|
import { isObservablePropertyHandlerCreator, isObservablePropertyHandlerInstance, } from './observable-property/observable-property-handler';
|
|
2
3
|
function assertValidPropertyName(propKey, element, elementTagName) {
|
|
3
4
|
if (typeof propKey !== 'string' && typeof propKey !== 'number' && typeof propKey !== 'symbol') {
|
|
@@ -14,18 +15,26 @@ export function createElementUpdaterProxy(element, verifyExists) {
|
|
|
14
15
|
* back in here.
|
|
15
16
|
*/
|
|
16
17
|
const elementAsProps = element;
|
|
17
|
-
function
|
|
18
|
+
function verifyProperty(propertyKey) {
|
|
18
19
|
if (verifyExists) {
|
|
19
20
|
assertValidPropertyName(propertyKey, element, element.tagName);
|
|
20
21
|
}
|
|
22
|
+
else {
|
|
23
|
+
/**
|
|
24
|
+
* No need to check if it's already a property or not, as the property function already
|
|
25
|
+
* makes that check.
|
|
26
|
+
*/
|
|
27
|
+
property()(element, propertyKey);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function valueGetter(target, propertyKey) {
|
|
31
|
+
verifyProperty(propertyKey);
|
|
21
32
|
return elementAsProps[propertyKey];
|
|
22
33
|
}
|
|
23
34
|
const propsProxy = new Proxy({}, {
|
|
24
35
|
get: valueGetter,
|
|
25
36
|
set: (target, propertyKey, newValue) => {
|
|
26
|
-
|
|
27
|
-
assertValidPropertyName(propertyKey, element, element.tagName);
|
|
28
|
-
}
|
|
37
|
+
verifyProperty(propertyKey);
|
|
29
38
|
const existingObservablePropertyHandler = element.observablePropertyHandlerMap[propertyKey];
|
|
30
39
|
function setValueOnElement(value) {
|
|
31
40
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "element-vir",
|
|
3
|
-
"version": "12.5.
|
|
3
|
+
"version": "12.5.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"custom",
|
|
6
6
|
"web",
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"test:types": "tsc --noEmit"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@augment-vir/browser": "^
|
|
43
|
-
"@augment-vir/common": "^
|
|
42
|
+
"@augment-vir/browser": "^14.2.0",
|
|
43
|
+
"@augment-vir/common": "^14.2.0",
|
|
44
44
|
"lit": "2.7.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@augment-vir/browser-testing": "^
|
|
48
|
-
"@augment-vir/node-js": "^
|
|
47
|
+
"@augment-vir/browser-testing": "^14.2.0",
|
|
48
|
+
"@augment-vir/node-js": "^14.2.0",
|
|
49
49
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
50
50
|
"@open-wc/testing": "^3.1.8",
|
|
51
51
|
"@types/mocha": "^10.0.1",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"prettier-plugin-sort-json": "^1.0.0",
|
|
72
72
|
"prettier-plugin-toml": "^0.3.1",
|
|
73
73
|
"ts-node": "^10.9.1",
|
|
74
|
-
"type-fest": "^3.
|
|
74
|
+
"type-fest": "^3.11.0",
|
|
75
75
|
"typescript": "^5.0.4",
|
|
76
|
-
"virmator": "^6.5.
|
|
76
|
+
"virmator": "^6.5.2",
|
|
77
77
|
"vite": "^4.3.8",
|
|
78
78
|
"vite-tsconfig-paths": "^4.2.0"
|
|
79
79
|
}
|