@neocompose/cli 0.82.5 → 0.84.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neocompose/cli",
3
- "version": "0.82.5",
3
+ "version": "0.84.0",
4
4
  "description": "Neo Compose native project-source CLI with bidirectional sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,7 +9,7 @@ description: >-
9
9
  `@neocompose/cli` or `node cli/bin/neo.mjs` in the neo-compose repository.
10
10
  ---
11
11
 
12
- <!-- reviewed-through-cli: 0.82.5 -->
12
+ <!-- reviewed-through-cli: 0.84.0 -->
13
13
 
14
14
  # Neo Compose CLI
15
15
 
@@ -65,6 +65,13 @@ cell two rows up without building a translated pattern. These queries track
65
65
  empty cells as well as hits, so a getter updates when a new neighbor appears.
66
66
  Calling them on an unplaced object is an error.
67
67
 
68
+ `this.GetArea()` returns the nearest `NeoTileGrid` that owns the object or
69
+ tile, or null when no grid owns it. It works on any `NeoObjectBase` or
70
+ `NeoTile`: a sprite child, an object held in another object's field, or a tile
71
+ in a nested layer link answers with its placed root's grid. A type argument
72
+ filters the answer, so `this.GetArea<FarmGrid>()` is null in any other grid.
73
+ It sees spawns, moves, and removals made earlier in the same evaluation.
74
+
68
75
  `WithCenter`, `WithoutCenter`, `Translate`, and `Union` return patterns.
69
76
  `Union` removes duplicate offsets while preserving first occurrence order.
70
77
  Box, Cross, and Line include the origin by default. Use `excluding: .Center`
@@ -129,7 +129,7 @@ wrappers.
129
129
  The marker near the top of `SKILL.md` must exactly match the package version:
130
130
 
131
131
  ```html
132
- <!-- reviewed-through-cli: 0.82.5 -->
132
+ <!-- reviewed-through-cli: 0.84.0 -->
133
133
  ```
134
134
 
135
135
  The quoted version above is checked too, so this instruction cannot go stale
@@ -58,7 +58,9 @@ abstract class Item<TContext extends SomeClass> : INamed {
58
58
  Use ordinary `public`, `protected`, `private`, `static`, `virtual`, `abstract`,
59
59
  `sealed`, and `override` semantics. A sealed class is an instantiable leaf:
60
60
  it may extend another class but cannot be extended, cannot also be abstract,
61
- and can only be sealed while it has no subclasses. Interfaces are non-generic.
61
+ and can only be sealed while it has no subclasses. Interfaces can declare type
62
+ parameters and pass arguments to the interfaces they extend; see Interface
63
+ members.
62
64
  A read-only override may narrow a class or interface contract to an assignable
63
65
  class or derived interface, including a non-null value for a nullable contract.
64
66
  Generated Unity C# keeps the inherited property type for Mono compatibility;
@@ -298,6 +300,56 @@ A `Reference<T>` member satisfies an interface `T Foo { get; }` or
298
300
 
299
301
  Constructor and function parameters use `Set<T>` for several selections.
300
302
 
303
+ ### Interface members
304
+
305
+ An interface types a member anywhere a class does: a field, a nullable,
306
+ `readonly`, or `static` field, a `List`, `Set`, or `Dictionary` entry, a
307
+ generic argument, a parameter, and `Reference<I>`. Each row holds its own
308
+ class, which must implement the interface.
309
+
310
+ ```neo
311
+ interface IContainer<T extends Item> {
312
+ List<T> Contents { get; }
313
+ }
314
+
315
+ class Crate<T extends Item> : IContainer<T> {
316
+ public List<T> Contents = [];
317
+ }
318
+
319
+ class Player {
320
+ public IContainer<Seed>? Pouch = new Crate<Seed>();
321
+ public List<IContainer<Seed>> Racks = [];
322
+ }
323
+ ```
324
+
325
+ - Construct a class, never the interface: `new IContainer<Seed>()` is an error.
326
+ Defaults and constructor arguments name the concrete class.
327
+ - An open class can sit in an interface slot only when the interface fills
328
+ every class parameter, as `Crate<T> : IContainer<T>` does. Otherwise store a
329
+ closed subclass.
330
+ - A class implements a given interface once, counting its `extends` chain.
331
+ `IContainer<Seed>` and `IContainer<Tool>` on one class is an error.
332
+ - An interface argument is a type parameter in scope or a type with none
333
+ inside it. `IContainer<List<T>>` is an error.
334
+ - `x is IContainer<Seed>` compares the arguments the row implements the
335
+ interface with. A generic interface needs its arguments in `is`.
336
+ - `NeoVariant<I>` is an error, since variants belong to a class. `@index` on a
337
+ collection of interface entries is an error; `@column` can name an interface
338
+ property.
339
+ - Interfaces carry no storage. A row fits a slot only when its class allows
340
+ the storage the row lives in. The compiler refuses an assignment that can't
341
+ fit, and push and commit refuse an authored row that doesn't fit.
342
+ - A variant or animation override that puts a different class in an
343
+ interface slot replaces the slot's row.
344
+ - A generic parameter can be constrained by an interface,
345
+ `T extends IContainer<Seed>`, and an interface can be a generic argument
346
+ where the parameter's constraint admits it.
347
+
348
+ Generated C# types the slot by the generated interface, so a class that
349
+ doesn't implement it doesn't compile. Writing a C# class that implements the
350
+ interface but isn't a Neo class throws, naming the slot. So does writing a row
351
+ the interface doesn't determine.
352
+
301
353
  ### Set members
302
354
 
303
355
  `Set<T>` is an insertion-ordered collection that can't hold duplicates. The
@@ -314,9 +366,9 @@ identities; added entries receive stable identities under the instance.
314
366
 
315
367
  An owned Set holds `bool`, `int`, `float`, `decimal`,
316
368
  `@settings(format: .Plain) string`, vectors, `Color`, sprites, audio clips,
317
- or a class. Elements can't be nullable, collections, variants, delegates,
318
- actions, or interfaces. A class entry is unique by row, a value entry by its
319
- value. `@index` and `@column` work as on a List; `kind:` is an error, since a
369
+ a class, or an interface. Elements can't be nullable, collections, variants,
370
+ delegates, or actions. A class or interface entry is unique by row, a value
371
+ entry by its value. `@index` and `@column` work as on a List; `kind:` is an error, since a
320
372
  Set is always insertion-ordered.
321
373
 
322
374
  ```neo