Files
feuerwerk/src/core/graph/nodes/data/literals.ts
T
adminandClaude Opus 5.5 4857bb75e6
game-maker / gate (push) Successful in 3m24s
game-maker / suite (push) Successful in 10m22s
Show lists in the inspector and variables in their own tab (#252)
The List tab could show one list at a time and was the only place to
see its items. A list now shows its items right where it lives, and a
new Variables tab shows all variables of an asset or placed object.

- InlineList draws the items of a list under its row in the inspector,
  in struct fields and in the Variables tab. A list inside a list or a
  struct field is drawn the same way, one step indented.
- The index column is the indent. Items sit under their list without an
  own margin, and the index column is 16 px wide instead of 28 px.
- Above 20 items (INLINE_LIMIT) the rest collapses into "... N more -
  open in tab". During a run the rows show the values from the game.
- ListHead puts "N items" and "+ Item" in one row. "N items" opens the
  list in a tab. A separate Open button squeezed the counter to zero
  width in the narrow inspector column.
- VariablesEditor shows every variable of a behavior asset, a variables
  asset or a placed behavior. On an asset it edits the declarations. On
  a placed object an edit only overrides that object, with the usual
  reset and push buttons.
- Opening a list inside a tab adds a new tab and keeps the open one.
  valuesKey gives each list its own document, so a list that is already
  open is shown instead of opened twice.
- Titles read "Pickup · Variables" or "Listy · nums · [3]". The tab
  closes when its asset or object is deleted.
- Lists on node inputs stay inline only, a node owns no variables.
- The List tab, ListEditor and the __gm.list hook are gone.

Tests:
- ./check.sh: 181 files, 2645 tests, CHECK EXIT 0
- GM_STEPS=1,21,22,32: ALL PASSED, 123 checks
- e2e 21 is rewritten for inline lists and the new tab, 22 and 32 are
  adapted. Sum in README: 1486 (+6 in 21, -1 in 22), counted by hand.
- Counter-probes fail as expected: sub-lists not told apart (1 unit
  test), sub-list replacing the open tab, all items drawn inline (60
  rows instead of 20), no live values (0 rows at 24 items in a run).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 21:56:21 +02:00

63 lines
2.2 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { KIND, kindLabel, type VariableKind } from '../../../properties/kinds';
import { coerceValue, flatDef, type PropertyDef } from '../../../properties/PropertySchema';
import type { NodeDef } from '../../NodeRegistry';
/** A node handing out one constant of a kind: its one setting, edited as that kind, is its output. */
function literal(type: string, kind: Exclude<VariableKind, 'struct' | 'object'>, description: string): NodeDef {
const value: PropertyDef =
kind === 'list'
? { key: 'value', label: 'Value', kind, default: [] }
: kind === 'number'
? { ...flatDef('value', kind, { label: 'Value' }), step: 1 }
: flatDef('value', kind, { label: 'Value' });
return {
type,
label: kindLabel(kind),
category: 'data',
description,
inputs: [],
outputs: [{ key: 'value', label: 'value', type: KIND[kind].travels }],
params: [value],
run: (_ctx, _inputs, params) => ({ outputs: { value: coerceValue(value, params.value ?? value.default) } }),
};
}
export const NumberLiteral = literal('Number', 'number', 'A constant number.');
export const BooleanLiteral = literal('Boolean', 'boolean', 'A constant true/false.');
export const StringLiteral = literal('String', 'text', 'A constant text.');
export const TextureLiteral = literal(
'Texture',
'texture',
'A constant picture: a texture or one of its frames, as a sprite wears it.',
);
export const StateMachineLiteral = literal(
'StateMachine',
'statemachine',
'A constant state machine, for a "State branch" or a "Set state" to work on.',
);
export const SoundLiteral = literal(
'Sound',
'sound',
'A constant sound, for a "Play sound" or a "Stop sound" to work on.',
);
export const SceneLiteral = literal(
'Scene',
'scene',
'A constant scene, for a "Load scene" to work on.',
);
export const AnimationLiteral = literal(
'Animation',
'animation',
'A constant animation, for a "Play animation", "Pause animation" or "Stop animation" to work on.',
);
export const AssetLiteral = literal(
'Asset',
'asset',
'A constant placeable asset, for a "Spawn" to place or an "Is asset" to compare with.',
);
export const ListLiteral = literal(
'List',
'list',
'A constant list, edited item by item in the inspector – each item with its own kind.',
);