asajs 4.0.11-indev → 4.0.12
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/config.d.ts +6 -0
- package/dist/js/compilers/bindings/Checker.js +3 -0
- package/dist/js/compilers/bindings/Function.js +23 -0
- package/dist/js/components/UI.js +6 -4
- package/dist/types/compilers/bindings/Checker.d.ts +1 -0
- package/dist/types/compilers/bindings/Function.d.ts +10 -0
- package/dist/types/components/UI.d.ts +2 -2
- package/dist/types/types/properties/element/Control.d.ts +1 -0
- package/package.json +1 -1
package/config.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RandomBindingString, ResolveBinding } from "../../components/Utils.js";
|
|
2
2
|
import { bindingFuntions } from "../Configuration.js";
|
|
3
|
+
import { isString } from "./Checker.js";
|
|
3
4
|
export const FunctionMap = new Map();
|
|
4
5
|
export const defaultFunctions = {
|
|
5
6
|
/**
|
|
@@ -116,6 +117,28 @@ export const defaultFunctions = {
|
|
|
116
117
|
value: count,
|
|
117
118
|
};
|
|
118
119
|
},
|
|
120
|
+
contains: (source_str, contains_str) => {
|
|
121
|
+
return {
|
|
122
|
+
value: `(not (${source_str} - ${contains_str} = ${source_str}))`,
|
|
123
|
+
};
|
|
124
|
+
},
|
|
125
|
+
starts_with: (source_str, start_str) => {
|
|
126
|
+
const bindGenSource = RandomBindingString();
|
|
127
|
+
if (isString(start_str))
|
|
128
|
+
start_str = `'ASAJS_STARTS_WITH:${start_str.slice(1)}`;
|
|
129
|
+
else
|
|
130
|
+
start_str = `('ASAJS_STARTS_WITH:' + ${start_str})`;
|
|
131
|
+
const { value } = defaultFunctions.contains(bindGenSource, start_str);
|
|
132
|
+
return {
|
|
133
|
+
genBindings: [
|
|
134
|
+
{
|
|
135
|
+
source: `('ASAJS_STARTS_WITH:' + ${source_str})`,
|
|
136
|
+
target: bindGenSource,
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
value,
|
|
140
|
+
};
|
|
141
|
+
},
|
|
119
142
|
/**
|
|
120
143
|
* Return a translatable string
|
|
121
144
|
* @param key
|
package/dist/js/components/UI.js
CHANGED
|
@@ -89,10 +89,12 @@ export class UI extends Class {
|
|
|
89
89
|
* @param name
|
|
90
90
|
* @returns
|
|
91
91
|
*/
|
|
92
|
-
addChild(child, properties, name) {
|
|
92
|
+
addChild(child, properties, name, callback) {
|
|
93
93
|
if (this === child)
|
|
94
94
|
throw new Error("Cannot add a child to itself");
|
|
95
|
-
|
|
95
|
+
const childName = name || RandomString(16);
|
|
96
|
+
this.controls.set(childName, [child, properties || {}]);
|
|
97
|
+
callback?.(childName);
|
|
96
98
|
return this;
|
|
97
99
|
}
|
|
98
100
|
addAnimations(...anims) {
|
|
@@ -244,8 +246,8 @@ export class ModifyUI extends UI {
|
|
|
244
246
|
},
|
|
245
247
|
});
|
|
246
248
|
}
|
|
247
|
-
insertChild(child, properties) {
|
|
248
|
-
return this.insertFrontChild(child, properties);
|
|
249
|
+
insertChild(child, properties, name) {
|
|
250
|
+
return this.insertFrontChild(child, properties, name);
|
|
249
251
|
}
|
|
250
252
|
replaceChild(where, child, properties) {
|
|
251
253
|
return this.addModifications({
|
|
@@ -6,3 +6,4 @@ export declare function isBinaryChar(char: string): boolean;
|
|
|
6
6
|
export declare function isOctalChar(char: string): boolean;
|
|
7
7
|
export declare function isCompileBinding(input: string): boolean;
|
|
8
8
|
export declare function isHasBinding(input: string): boolean;
|
|
9
|
+
export declare function isString(input: string): boolean;
|
|
@@ -63,6 +63,16 @@ export declare const defaultFunctions: {
|
|
|
63
63
|
}[];
|
|
64
64
|
value: `#${string}`;
|
|
65
65
|
};
|
|
66
|
+
contains: (source_str: string, contains_str: string) => {
|
|
67
|
+
value: string;
|
|
68
|
+
};
|
|
69
|
+
starts_with: (source_str: string, start_str: string) => {
|
|
70
|
+
genBindings: {
|
|
71
|
+
source: string;
|
|
72
|
+
target: `#${string}`;
|
|
73
|
+
}[];
|
|
74
|
+
value: string;
|
|
75
|
+
};
|
|
66
76
|
/**
|
|
67
77
|
* Return a translatable string
|
|
68
78
|
* @param key
|
|
@@ -59,7 +59,7 @@ export declare class UI<T extends Type, K extends Renderer | null = null> extend
|
|
|
59
59
|
* @param name
|
|
60
60
|
* @returns
|
|
61
61
|
*/
|
|
62
|
-
addChild<T extends Type, K extends Renderer | null>(child: UI<T, K>, properties?: Properties<T, K>, name?: string): this;
|
|
62
|
+
addChild<T extends Type, K extends Renderer | null>(child: UI<T, K>, properties?: Properties<T, K>, name?: string, callback?: (name: string) => void): this;
|
|
63
63
|
addAnimations(...anims: (Animation<AnimType> | AnimationKeyframe<AnimType>)[]): this;
|
|
64
64
|
/**
|
|
65
65
|
* Return a extend of this element
|
|
@@ -104,7 +104,7 @@ export declare class ModifyUI<T extends Type = Type.PANEL, S extends string = st
|
|
|
104
104
|
insertFrontChild<T extends Type, K extends Renderer | null>(child: UI<T, K>, properties?: Properties<T, K>, name?: string): this;
|
|
105
105
|
insertAfterChild<T extends Type, K extends Renderer | null>(where: S, child: UI<T, K>, properties?: Properties<T, K>, name?: string): this;
|
|
106
106
|
insertBeforeChild<T extends Type, K extends Renderer | null>(where: S, child: UI<T, K>, properties?: Properties<T, K>, name?: string): this;
|
|
107
|
-
insertChild<T extends Type, K extends Renderer | null>(child: UI<T, K>, properties?: Properties<T, K
|
|
107
|
+
insertChild<T extends Type, K extends Renderer | null>(child: UI<T, K>, properties?: Properties<T, K>, name?: string): this;
|
|
108
108
|
replaceChild<T extends Type, K extends Renderer | null>(where: S, child: UI<T, K>, properties?: Properties<T, K>): this;
|
|
109
109
|
/**
|
|
110
110
|
* Remove a child of this element
|
|
@@ -17,6 +17,7 @@ export interface Control {
|
|
|
17
17
|
draggable?: Value<boolean>;
|
|
18
18
|
follows_cursor?: Value<boolean>;
|
|
19
19
|
property_bag?: Value<PropertyBags>;
|
|
20
|
+
collection_index?: Value<number>;
|
|
20
21
|
property_bag_for_children?: Value<PropertyBags>;
|
|
21
22
|
[key: Binding]: Value<any>;
|
|
22
23
|
[key: Variable]: Value<any>;
|