@zcomponent/core 0.0.17 → 0.0.19
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/types.d.ts +10 -3
- package/lib/types.js +2 -0
- package/lib/zcomponent.d.ts +2 -1
- package/lib/zcomponent.js +12 -0
- package/package.json +1 -1
package/lib/types.d.ts
CHANGED
|
@@ -52,11 +52,12 @@ export interface EventType extends BaseType {
|
|
|
52
52
|
}
|
|
53
53
|
export type Type = StringPrimitiveType | NumberPrimitiveType | BooleanPrimitiveType | ArrayType | TupleType | UnknownType | EnumType | UnionType | LiteralType | FunctionType | EventType;
|
|
54
54
|
export declare enum TypeHint {
|
|
55
|
-
|
|
55
|
+
'proportion' = "proportion",
|
|
56
56
|
'color-norm-rgb' = "color-norm-rgb",
|
|
57
57
|
'color-unnorm-rgb' = "color-unnorm-rgb",
|
|
58
58
|
'color-hex' = "color-hex",
|
|
59
|
-
'color-css' = "color-css"
|
|
59
|
+
'color-css' = "color-css",
|
|
60
|
+
'text-multiline' = "text-multiline"
|
|
60
61
|
}
|
|
61
62
|
export declare enum ValuesType {
|
|
62
63
|
'files' = "files",
|
|
@@ -64,7 +65,8 @@ export declare enum ValuesType {
|
|
|
64
65
|
'morphTargets' = "morphTargets",
|
|
65
66
|
'events' = "events",
|
|
66
67
|
'parentNodes' = "parentNodes",
|
|
67
|
-
'nodelabels' = "nodelabels"
|
|
68
|
+
'nodelabels' = "nodelabels",
|
|
69
|
+
'nodeids' = "nodeids"
|
|
68
70
|
}
|
|
69
71
|
export interface Values {
|
|
70
72
|
type: ValuesType;
|
|
@@ -143,6 +145,11 @@ export interface TemplateInfo {
|
|
|
143
145
|
content: string;
|
|
144
146
|
extn?: string;
|
|
145
147
|
}
|
|
148
|
+
export interface FileGenerator {
|
|
149
|
+
name: string;
|
|
150
|
+
url: string;
|
|
151
|
+
icon?: string;
|
|
152
|
+
}
|
|
146
153
|
export declare function symbolPathFromFilename(f: string): string;
|
|
147
154
|
export declare function isValidValueForType(def: any, t: Type, allowUndefined?: boolean): boolean;
|
|
148
155
|
export declare function outputForType(t: Type, alwaysBasic?: boolean): string;
|
package/lib/types.js
CHANGED
|
@@ -7,6 +7,7 @@ export var TypeHint;
|
|
|
7
7
|
TypeHint["color-unnorm-rgb"] = "color-unnorm-rgb";
|
|
8
8
|
TypeHint["color-hex"] = "color-hex";
|
|
9
9
|
TypeHint["color-css"] = "color-css";
|
|
10
|
+
TypeHint["text-multiline"] = "text-multiline";
|
|
10
11
|
})(TypeHint || (TypeHint = {}));
|
|
11
12
|
export var ValuesType;
|
|
12
13
|
(function (ValuesType) {
|
|
@@ -16,6 +17,7 @@ export var ValuesType;
|
|
|
16
17
|
ValuesType["events"] = "events";
|
|
17
18
|
ValuesType["parentNodes"] = "parentNodes";
|
|
18
19
|
ValuesType["nodelabels"] = "nodelabels";
|
|
20
|
+
ValuesType["nodeids"] = "nodeids";
|
|
19
21
|
})(ValuesType || (ValuesType = {}));
|
|
20
22
|
function valuesCompatible(l, r) {
|
|
21
23
|
if (!l && !r)
|
package/lib/zcomponent.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, ComponentChildren, ConstructorProps } from './component';
|
|
1
|
+
import { Component, ComponentChildren, ConstructorForComponent, ConstructorProps } from './component';
|
|
2
2
|
import { ContextManager, Context } from './context';
|
|
3
3
|
import { Entity } from './entity';
|
|
4
4
|
import { ZComponentData } from './interfaces';
|
|
@@ -48,6 +48,7 @@ export declare class ZComponent<RootType = any> extends Component<RootType> {
|
|
|
48
48
|
constructor(contextManager: ContextManager, constructorProps: ConstructorProps, _opts: ZComponentOptions);
|
|
49
49
|
private _constructorForNode;
|
|
50
50
|
private _constructorForBehavior;
|
|
51
|
+
resolveNodeID<T extends Component = Component>(id: string, type?: ConstructorForComponent<T>): T | undefined;
|
|
51
52
|
private _inflateBehaviors;
|
|
52
53
|
private _wrapBehaviors;
|
|
53
54
|
notifyPropsChanged(entries: Map<string, Set<string>>): void;
|
package/lib/zcomponent.js
CHANGED
|
@@ -178,6 +178,18 @@ export class ZComponent extends Component {
|
|
|
178
178
|
}
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
+
resolveNodeID(id, type) {
|
|
182
|
+
const entity = this.entityByID.get(id);
|
|
183
|
+
if (!entity)
|
|
184
|
+
return this.getZComponentInstance()?.resolveNodeID(id, type);
|
|
185
|
+
if (!(entity instanceof Component))
|
|
186
|
+
return undefined;
|
|
187
|
+
if (!type)
|
|
188
|
+
return entity;
|
|
189
|
+
if (entity instanceof type)
|
|
190
|
+
return entity;
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
181
193
|
_inflateBehaviors() {
|
|
182
194
|
for (const [nodeID, impl, ctx] of this._behaviorsToInitialize) {
|
|
183
195
|
this._wrapBehaviors(nodeID, impl, ctx);
|