pmcf 2.61.0 → 2.62.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.
- package/package.json +1 -1
- package/src/base.mjs +15 -1
- package/types/base.d.mts +2 -0
package/package.json
CHANGED
package/src/base.mjs
CHANGED
|
@@ -41,6 +41,7 @@ export class Base {
|
|
|
41
41
|
_packaging = new Set();
|
|
42
42
|
_directory;
|
|
43
43
|
_finalize;
|
|
44
|
+
_properties;
|
|
44
45
|
|
|
45
46
|
static {
|
|
46
47
|
addType(this);
|
|
@@ -221,6 +222,10 @@ export class Base {
|
|
|
221
222
|
}
|
|
222
223
|
};
|
|
223
224
|
|
|
225
|
+
if(data?.properties) {
|
|
226
|
+
this._properties = data.properties;
|
|
227
|
+
}
|
|
228
|
+
|
|
224
229
|
for (const property of Object.values(type.properties)) {
|
|
225
230
|
if (property.writeable) {
|
|
226
231
|
const value = data[property.name];
|
|
@@ -452,6 +457,15 @@ export class Base {
|
|
|
452
457
|
return false;
|
|
453
458
|
}
|
|
454
459
|
|
|
460
|
+
property(name) {
|
|
461
|
+
const value = this._properties?.[name];
|
|
462
|
+
if(value === undefined && this.owner) {
|
|
463
|
+
return this.owner.property(name);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
return value;
|
|
467
|
+
}
|
|
468
|
+
|
|
455
469
|
expand(object) {
|
|
456
470
|
if (this.isTemplate) {
|
|
457
471
|
return object;
|
|
@@ -460,7 +474,7 @@ export class Base {
|
|
|
460
474
|
switch (typeof object) {
|
|
461
475
|
case "string":
|
|
462
476
|
return object.replaceAll(/\$\{([^\}]*)\}/g, (match, m1) => {
|
|
463
|
-
return getAttribute(this, m1) ?? "${" + m1 + "}";
|
|
477
|
+
return this.property(m1) ?? getAttribute(this, m1) ?? "${" + m1 + "}";
|
|
464
478
|
});
|
|
465
479
|
|
|
466
480
|
case "object":
|
package/types/base.d.mts
CHANGED
|
@@ -61,6 +61,7 @@ export class Base {
|
|
|
61
61
|
_packaging: Set<any>;
|
|
62
62
|
_directory: any;
|
|
63
63
|
_finalize: any;
|
|
64
|
+
_properties: any;
|
|
64
65
|
ownerFor(property: any, data: any): any;
|
|
65
66
|
read(data: any, type: any): void;
|
|
66
67
|
named(name: any): void;
|
|
@@ -106,6 +107,7 @@ export class Base {
|
|
|
106
107
|
set tags(value: Set<any>);
|
|
107
108
|
get tags(): Set<any>;
|
|
108
109
|
get isTemplate(): boolean;
|
|
110
|
+
property(name: any): any;
|
|
109
111
|
expand(object: any): any;
|
|
110
112
|
finalize(action: any): void;
|
|
111
113
|
execFinalize(): void;
|