Describe every value kind in one table instead of spreading it over the code
A kind like colour or texture used to be spelled out in five parallel lists, its port type, its empty value, its glyph, its label and its list tag - 22 literal places for texture alone. core/properties/kinds.ts now holds one row per kind and the rest is derived from it, so adding a kind is one row. The five literal nodes collapse into literals.ts, the six kind menus into one helper. Number, Text, Boolean is now the one order everywhere; the variable and port menus used to list Boolean before Text. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8a7185948d
commit
3ed8b68ecf
39 files changed
+699
-565
No files matched your search
@@ -9,8 +9,9 @@ import { AddNodeCommand, ConnectCommand } from '../../src/core/commands/graphCom
|
||||
import { AddStructFieldCommand, AddVariableCommand } from '../../src/core/commands/variableCommands';
|
||||
import { deserializeProject, serializeProject } from '../../src/core/store/serialize';
|
||||
import type { BehaviorAsset } from '../../src/core/model/Asset';
|
||||
import { colorItem } from '../../src/core/model/Properties';
|
||||
import { tagged } from '../../src/core/model/Properties';
|
||||
import { createEmptyProject, findAsset } from '../../src/core/model/Project';
|
||||
import { FIELD_KINDS, LIST_ITEM_KINDS } from '../../src/core/properties/kinds';
|
||||
import { variableDef } from '../../src/core/properties/PropertySchema';
|
||||
import { resolveList } from '../../src/editor/list/slot';
|
||||
import { EditorState, type ListSlot } from '../../src/editor/state';
|
||||
@@ -83,8 +84,8 @@ describe('the address a list is edited through', () => {
|
||||
});
|
||||
|
||||
it('takes a whole list of mixed items as it is, here and on a node setting', () => {
|
||||
list().replace(['5', true, colorItem(0xff0000)]);
|
||||
expect(list().value).toEqual(['5', true, colorItem(0xff0000)]);
|
||||
list().replace(['5', true, tagged('color', 0xff0000)]);
|
||||
expect(list().value).toEqual(['5', true, tagged('color', 0xff0000)]);
|
||||
|
||||
const add = new AddNodeCommand(f.behavior.id, 'List', 0, 0);
|
||||
expect(f.state.execute(add)).toBe(true);
|
||||
@@ -260,8 +261,10 @@ describe('a list a struct field holds', () => {
|
||||
* the next write, which reads as the menu entry doing nothing at all.
|
||||
*/
|
||||
it('offers the flat kinds only, where the whole list has struct as well', () => {
|
||||
expect(list().kinds).toEqual(['number', 'text', 'boolean', 'color', 'texture']);
|
||||
expect(list().kinds).toEqual(FIELD_KINDS);
|
||||
expect(list().kinds).not.toContain('struct');
|
||||
const whole = resolveList(f.state, { kind: 'asset', assetId: f.behavior.id, key: 'nums' })!;
|
||||
expect(whole.kinds).toEqual(['number', 'text', 'boolean', 'color', 'texture', 'struct']);
|
||||
expect(whole.kinds).toEqual(LIST_ITEM_KINDS);
|
||||
expect(whole.kinds).toContain('struct');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user