forked from FoundKeyGang/FoundKey
Refactor
This commit is contained in:
parent
1903aaf351
commit
d0c8d537f5
1 changed files with 15 additions and 15 deletions
|
@ -80,16 +80,22 @@ const funcDefs = {
|
||||||
dailyRandomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
|
dailyRandomPick: { in: [0], out: 0, category: 'random', icon: faDice, },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const literalDefs = {
|
||||||
|
text: { out: 'string', category: 'value', icon: faQuoteRight, },
|
||||||
|
multiLineText: { out: 'string', category: 'value', icon: faAlignLeft, },
|
||||||
|
textList: { out: 'stringArray', category: 'value', icon: faList, },
|
||||||
|
number: { out: 'number', category: 'value', icon: faSortNumericUp, },
|
||||||
|
ref: { out: null, category: 'value', icon: faSuperscript, },
|
||||||
|
in: { out: null, category: 'value', icon: faSuperscript, },
|
||||||
|
fn: { out: 'function', category: 'value', icon: faSuperscript, },
|
||||||
|
};
|
||||||
|
|
||||||
const blockDefs = [
|
const blockDefs = [
|
||||||
{ type: 'text', out: 'string', category: 'value', icon: faQuoteRight, },
|
...Object.entries(literalDefs).map(([k, v]) => ({
|
||||||
{ type: 'multiLineText', out: 'string', category: 'value', icon: faAlignLeft, },
|
type: k, out: v.out, category: v.category, icon: v.icon
|
||||||
{ type: 'textList', out: 'stringArray', category: 'value', icon: faList, },
|
})),
|
||||||
{ type: 'number', out: 'number', category: 'value', icon: faSortNumericUp, },
|
|
||||||
{ type: 'ref', out: null, category: 'value', icon: faSuperscript, },
|
|
||||||
{ type: 'in', out: null, category: 'value', icon: faSuperscript, },
|
|
||||||
{ type: 'fn', out: 'function', category: 'value', icon: faSuperscript, },
|
|
||||||
...Object.entries(funcDefs).map(([k, v]) => ({
|
...Object.entries(funcDefs).map(([k, v]) => ({
|
||||||
type: k, out: v.out || null, category: v.category, icon: v.icon
|
type: k, out: v.out, category: v.category, icon: v.icon
|
||||||
}))
|
}))
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -170,13 +176,7 @@ export class AiScript {
|
||||||
@autobind
|
@autobind
|
||||||
public static isLiteralBlock(v: Block) {
|
public static isLiteralBlock(v: Block) {
|
||||||
if (v.type === null) return true;
|
if (v.type === null) return true;
|
||||||
if (v.type === 'text') return true;
|
if (literalDefs[v.type]) return true;
|
||||||
if (v.type === 'multiLineText') return true;
|
|
||||||
if (v.type === 'textList') return true;
|
|
||||||
if (v.type === 'number') return true;
|
|
||||||
if (v.type === 'ref') return true;
|
|
||||||
if (v.type === 'fn') return true;
|
|
||||||
if (v.type === 'in') return true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue