@neocompose/cli 0.83.0 → 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.
@@ -7949,6 +7949,35 @@ var WORLD_SYSTEM_CLASS_DEFINITIONS = [
7949
7949
  ],
7950
7950
  dispatch: 0 /* Synchronous */,
7951
7951
  schemaKey: "TryConvert"
7952
+ },
7953
+ {
7954
+ memberId: "system_a92b0911-8e7e-48ef-a12e-f3c55c33f64b",
7955
+ memberKind: "function",
7956
+ docsText: "The nearest tile grid that owns this tile, or null when no grid owns it or that grid is not a T. A tile in an object's tile layer answers with the object's grid.",
7957
+ returnTypeInfo: {
7958
+ type: 21,
7959
+ required: false,
7960
+ ownerMemberId: "system_a92b0911-8e7e-48ef-a12e-f3c55c33f64b",
7961
+ index: 0
7962
+ },
7963
+ argumentTypes: [],
7964
+ genericParams: [
7965
+ {
7966
+ name: "T",
7967
+ constraint: {
7968
+ type: 7,
7969
+ required: true,
7970
+ classId: "system_b78f7f1d-f63c-4abb-ae65-852e69246534"
7971
+ },
7972
+ defaultType: {
7973
+ type: 7,
7974
+ required: true,
7975
+ classId: "system_b78f7f1d-f63c-4abb-ae65-852e69246534"
7976
+ }
7977
+ }
7978
+ ],
7979
+ dispatch: 0 /* Synchronous */,
7980
+ schemaKey: "GetArea"
7952
7981
  }
7953
7982
  ],
7954
7983
  worldKind: "tile"
@@ -7996,6 +8025,35 @@ var WORLD_SYSTEM_CLASS_DEFINITIONS = [
7996
8025
  docsText: "The object's box collider, or null for none. Any world object can carry one: placed objects, nested children, and sprites alike.",
7997
8026
  schemaClassWorldKind: "objectCollider",
7998
8027
  schemaKey: "Collider"
8028
+ },
8029
+ {
8030
+ memberId: "system_7ad477e2-be5b-4892-b9ba-2a2f2476988d",
8031
+ memberKind: "function",
8032
+ docsText: "The nearest tile grid that owns this value, or null when no grid owns it or that grid is not a T. Nested children answer with their placed root's grid.",
8033
+ returnTypeInfo: {
8034
+ type: 21,
8035
+ required: false,
8036
+ ownerMemberId: "system_7ad477e2-be5b-4892-b9ba-2a2f2476988d",
8037
+ index: 0
8038
+ },
8039
+ argumentTypes: [],
8040
+ genericParams: [
8041
+ {
8042
+ name: "T",
8043
+ constraint: {
8044
+ type: 7,
8045
+ required: true,
8046
+ classId: "system_b78f7f1d-f63c-4abb-ae65-852e69246534"
8047
+ },
8048
+ defaultType: {
8049
+ type: 7,
8050
+ required: true,
8051
+ classId: "system_b78f7f1d-f63c-4abb-ae65-852e69246534"
8052
+ }
8053
+ }
8054
+ ],
8055
+ dispatch: 0 /* Synchronous */,
8056
+ schemaKey: "GetArea"
7999
8057
  }
8000
8058
  ],
8001
8059
  worldKind: "objectBase"
@@ -17999,6 +18057,10 @@ var NEO_OBJECT_GRID_MEMBER_IDS = {
17999
18057
  GetTile: "system_593e6208-e2ca-505e-9933-04b17102b6d2",
18000
18058
  GetTiles: "system_5a41d36a-bcd9-4867-9e46-d743f6e09582"
18001
18059
  };
18060
+ var NEO_GET_AREA_MEMBER_IDS = {
18061
+ NeoObjectBase: "system_7ad477e2-be5b-4892-b9ba-2a2f2476988d",
18062
+ NeoTile: "system_a92b0911-8e7e-48ef-a12e-f3c55c33f64b"
18063
+ };
18002
18064
  var NEO_CELL_PATTERN_PURE_NATIVE_MEMBER_IDS = /* @__PURE__ */ new Set([
18003
18065
  NEO_CELL_PATTERN_MEMBER_IDS.Contains,
18004
18066
  NEO_CELL_PATTERN_MEMBER_IDS.Cells,
@@ -18008,6 +18070,7 @@ var NEO_CELL_PATTERN_PURE_NATIVE_MEMBER_IDS = /* @__PURE__ */ new Set([
18008
18070
  NEO_CELL_PATTERN_MEMBER_IDS.Union
18009
18071
  ]);
18010
18072
  var NEO_OBJECT_CLASS_ID = "system_f671535d-0eb6-4139-9caf-5c5276febd31";
18073
+ var NEO_TILE_GRID_CLASS_ID = "system_b78f7f1d-f63c-4abb-ae65-852e69246534";
18011
18074
 
18012
18075
  // ../packages/neoscript-language/src/tile-conversion.ts
18013
18076
  var NEO_TILE_CONVERT_MEMBER_ID = "system_54ecc5a7-874d-54ed-92f4-38100a4b7465";
@@ -18042,39 +18105,26 @@ function isCenter(offset) {
18042
18105
  return offset.x === 0 && offset.y === 0;
18043
18106
  }
18044
18107
  function evaluateCellPatternNative(memberId, receiver, args, ctx) {
18045
- if (!NEO_CELL_PATTERN_PURE_NATIVE_MEMBER_IDS.has(memberId)) {
18046
- return { handled: false };
18047
- }
18048
- const pattern = (offsets2) => ({
18049
- handled: true,
18050
- value: ctx.constructPattern(offsets2)
18051
- });
18052
18108
  const offsets = ctx.readPattern(receiver);
18053
18109
  switch (memberId) {
18054
18110
  case NEO_CELL_PATTERN_MEMBER_IDS.Contains: {
18055
18111
  const offset = vector(args[0], "Contains offset");
18056
- return {
18057
- handled: true,
18058
- value: offsets.some(
18059
- (cell) => cell.x === offset.x && cell.y === offset.y
18060
- )
18061
- };
18112
+ return offsets.some((cell) => cell.x === offset.x && cell.y === offset.y);
18062
18113
  }
18063
18114
  case NEO_CELL_PATTERN_MEMBER_IDS.Cells:
18064
- return {
18065
- handled: true,
18066
- value: translated(offsets, vector(args[0], "Cells origin"))
18067
- };
18115
+ return translated(offsets, vector(args[0], "Cells origin"));
18068
18116
  case NEO_CELL_PATTERN_MEMBER_IDS.WithCenter:
18069
- if (offsets.some(isCenter)) return { handled: true, value: receiver };
18070
- return pattern([{ x: 0, y: 0 }, ...offsets]);
18117
+ if (offsets.some(isCenter)) return receiver;
18118
+ return ctx.constructPattern([{ x: 0, y: 0 }, ...offsets]);
18071
18119
  case NEO_CELL_PATTERN_MEMBER_IDS.WithoutCenter:
18072
- if (!offsets.some(isCenter)) return { handled: true, value: receiver };
18073
- return pattern(offsets.filter((offset) => !isCenter(offset)));
18120
+ if (!offsets.some(isCenter)) return receiver;
18121
+ return ctx.constructPattern(
18122
+ offsets.filter((offset) => !isCenter(offset))
18123
+ );
18074
18124
  case NEO_CELL_PATTERN_MEMBER_IDS.Translate: {
18075
18125
  const offset = vector(args[0], "Translate offset");
18076
- if (isCenter(offset)) return { handled: true, value: receiver };
18077
- return pattern(translated(offsets, offset));
18126
+ if (isCenter(offset)) return receiver;
18127
+ return ctx.constructPattern(translated(offsets, offset));
18078
18128
  }
18079
18129
  case NEO_CELL_PATTERN_MEMBER_IDS.Union: {
18080
18130
  const other = ctx.readPattern(args[0]);
@@ -18088,7 +18138,7 @@ function evaluateCellPatternNative(memberId, receiver, args, ctx) {
18088
18138
  result.push(offset);
18089
18139
  }
18090
18140
  }
18091
- return pattern(result);
18141
+ return ctx.constructPattern(result);
18092
18142
  }
18093
18143
  default:
18094
18144
  throw new Error(
@@ -24513,6 +24563,21 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
24513
24563
  ctx
24514
24564
  );
24515
24565
  }
24566
+ if (unorderedContainerValueId !== null && Array.isArray(targetValue)) {
24567
+ const cache = unorderedListProjectionCache(ctx);
24568
+ const appended = ins.mutation === "Add" /* Add */ && cache.writtenContainerIds.has(unorderedContainerValueId);
24569
+ releaseWrittenUnorderedEntries(
24570
+ unorderedContainerValueId,
24571
+ unorderedEntriesBeforeMutation ?? [],
24572
+ cache
24573
+ );
24574
+ trackWrittenUnorderedEntries(
24575
+ unorderedContainerValueId,
24576
+ targetValue,
24577
+ appended ? targetValue.length - 1 : 0,
24578
+ cache
24579
+ );
24580
+ }
24516
24581
  invalidateEvaluatorIndexes(ctx, targetValue);
24517
24582
  switch (ins.mutation) {
24518
24583
  case "Insert" /* Insert */:
@@ -25518,10 +25583,8 @@ function evalPointerCore(pointer, scope, ctx, resultUsage = "value") {
25518
25583
  if (member.kind === 13 /* Function */) {
25519
25584
  const systemResult = evaluateSystemNative(
25520
25585
  member.id,
25521
- innerThis,
25522
- args,
25523
- ctx,
25524
- typeArguments
25586
+ { receiver: innerThis, args, typeArguments },
25587
+ ctx
25525
25588
  );
25526
25589
  if (systemResult.handled) return systemResult.value;
25527
25590
  const hosted = ctx.unavailableNativeHandler?.({
@@ -25863,8 +25926,11 @@ function invokeDelegateValue(value, args, ctx, callSiteId, ownerReceiver, result
25863
25926
  if (member.kind === 13 /* Function */) {
25864
25927
  const systemResult = evaluateSystemNative(
25865
25928
  member.id,
25866
- receiver,
25867
- args,
25929
+ {
25930
+ receiver,
25931
+ args,
25932
+ typeArguments: calleeTypeArguments(void 0, member, ctx)
25933
+ },
25868
25934
  ctx
25869
25935
  );
25870
25936
  if (systemResult.handled) return systemResult.value;
@@ -27373,6 +27439,8 @@ function createUnorderedListProjectionCache() {
27373
27439
  return {
27374
27440
  byContainerId: /* @__PURE__ */ new Map(),
27375
27441
  containerIdByArray: /* @__PURE__ */ new WeakMap(),
27442
+ writtenContainerIds: /* @__PURE__ */ new Set(),
27443
+ writtenEntryParents: /* @__PURE__ */ new Map(),
27376
27444
  scalarEntryIds: /* @__PURE__ */ new Set(),
27377
27445
  referenceEntryIndexesByArray: /* @__PURE__ */ new WeakMap(),
27378
27446
  referenceEntryKeysByRecord: /* @__PURE__ */ new WeakMap()
@@ -27433,9 +27501,27 @@ function invalidateUnorderedListProjection(containerValueId, ctx) {
27433
27501
  const projection = cache.byContainerId.get(containerValueId);
27434
27502
  if (projection === void 0) return;
27435
27503
  detachRemovedUnorderedScalarEntries(projection, [], ctx);
27504
+ releaseWrittenUnorderedEntries(containerValueId, projection, cache);
27436
27505
  cache.byContainerId.delete(containerValueId);
27506
+ cache.writtenContainerIds.delete(containerValueId);
27437
27507
  cache.containerIdByArray.delete(projection);
27438
27508
  }
27509
+ function trackWrittenUnorderedEntries(containerValueId, projection, start, cache, references = cache.referenceEntryIndexesByArray.get(projection)) {
27510
+ cache.writtenContainerIds.add(containerValueId);
27511
+ for (let index = start; index < projection.length; index++) {
27512
+ const entry = projection[index];
27513
+ if (typeof entry === "string" && references?.has(index) !== true) {
27514
+ cache.writtenEntryParents.set(entry, containerValueId);
27515
+ }
27516
+ }
27517
+ }
27518
+ function releaseWrittenUnorderedEntries(containerValueId, entries, cache) {
27519
+ for (const entry of entries) {
27520
+ if (typeof entry === "string" && cache.writtenEntryParents.get(entry) === containerValueId) {
27521
+ cache.writtenEntryParents.delete(entry);
27522
+ }
27523
+ }
27524
+ }
27439
27525
  function updateUnorderedListProjectionAfterAssignment(row, value, ctx) {
27440
27526
  invalidateUnorderedListProjection(row.id, ctx);
27441
27527
  const member = memberForValueRow(row, ctx);
@@ -27454,6 +27540,7 @@ function updateUnorderedListProjectionAfterAssignment(row, value, ctx) {
27454
27540
  }
27455
27541
  cache.byContainerId.set(row.id, projection);
27456
27542
  cache.containerIdByArray.set(projection, row.id);
27543
+ trackWrittenUnorderedEntries(row.id, projection, 0, cache, referenceIndexes);
27457
27544
  }
27458
27545
  function evaluatorUnorderedListEntryIds(containerValueId, ctx) {
27459
27546
  ctx.containerDependencies?.add(containerValueId);
@@ -27610,7 +27697,8 @@ function resolveMemberForValueRow(row, ctx, visited) {
27610
27697
  ctx.onUnattributableValueRead?.(
27611
27698
  ownershipChainRead("member-owner-resolution", row.id)
27612
27699
  );
27613
- for (const link of evaluatorParentLinks(indexes4, row.id)) {
27700
+ for (const link of evaluatorParentEdges(row, ctx, indexes4)) {
27701
+ if ("memberId" in link) return evalMemberById(ctx.vm, link.memberId);
27614
27702
  const parent = evalValueById(
27615
27703
  ctx,
27616
27704
  link.parentId,
@@ -27633,6 +27721,93 @@ function resolveMemberForValueRow(row, ctx, visited) {
27633
27721
  }
27634
27722
  return null;
27635
27723
  }
27724
+ function* evaluatorParentEdges(row, ctx, indexes4) {
27725
+ const cache = ctx.__unorderedListProjections;
27726
+ const writtenParentId = cache?.writtenEntryParents.get(row.id);
27727
+ if (writtenParentId !== void 0) {
27728
+ yield { parentId: writtenParentId, key: "" };
27729
+ }
27730
+ const written = cache?.writtenContainerIds;
27731
+ for (const link of indexes4.parentLinksByChildId.get(row.id) ?? []) {
27732
+ if (written?.has(link.parentId) !== true) yield link;
27733
+ }
27734
+ const database = ctx.vm.databaseVM;
27735
+ const documentContainerId = database?.evaluatorIndexes?.valueById.get(
27736
+ row.id
27737
+ )?.containerId;
27738
+ const rewritten = indexes4.shadowedBaseRowIds.has(row.id);
27739
+ const stale = (parentId) => written?.has(parentId) === true || indexes4.shadowedBaseRowIds.has(parentId) || row.containerId !== parentId && (documentContainerId === parentId || rewritten && database?.valueById(row.id)?.containerId === parentId);
27740
+ const placement = database?.storedValuePlacementForValueId?.(row.id);
27741
+ const placedParentId = placement?.parentValueId;
27742
+ if (placement !== null && placement !== void 0 && typeof placedParentId === "string" && !stale(placedParentId)) {
27743
+ yield { parentId: placedParentId, memberId: placement.memberId };
27744
+ }
27745
+ for (const link of indexes4.baseParentLinksByChildId?.get(row.id) ?? []) {
27746
+ if (!stale(link.parentId)) yield link;
27747
+ }
27748
+ }
27749
+ function currentUnorderedContainerId(row, ctx) {
27750
+ const cache = ctx.__unorderedListProjections;
27751
+ const writtenParentId = cache?.writtenEntryParents.get(row.id);
27752
+ if (writtenParentId !== void 0) return writtenParentId;
27753
+ const containerId = row.containerId;
27754
+ if (typeof containerId !== "string") return void 0;
27755
+ const released = cache?.writtenContainerIds.has(containerId) === true;
27756
+ return released ? void 0 : containerId;
27757
+ }
27758
+ function firstOwnerEdge(row, ctx) {
27759
+ const indexes4 = evaluatorIndexes(ctx);
27760
+ const edge = evaluatorParentEdges(row, ctx, indexes4).next().value;
27761
+ if (edge !== void 0) return edge;
27762
+ const rows = ctx.vm.databaseVM?.virtualInstanceRowsForValue(row.id);
27763
+ if (rows === void 0 || rows.length === 0) return void 0;
27764
+ ensureVirtualExpansionIndexed(rows, ctx, indexes4);
27765
+ return evaluatorParentEdges(row, ctx, indexes4).next().value;
27766
+ }
27767
+ function untrackedValueById(id, ctx) {
27768
+ if (ctx.__removedValueIds?.has(id)) return null;
27769
+ const local = ctx.__runtimeSessionValues?.get(id) ?? ctx.__valueOverlay?.get(id);
27770
+ if (local !== void 0) return local;
27771
+ const database = ctx.vm.databaseVM;
27772
+ if (database !== void 0) return database.valueById(id);
27773
+ return ctx.vm.values.find((value) => value.id === id) ?? null;
27774
+ }
27775
+ function placingMemberBinding(row, ctx) {
27776
+ const direct = evaluatorIndexes(ctx).memberByValueId.get(row.id);
27777
+ if (direct !== void 0) return direct;
27778
+ const root = rootMemberForValueRow(row, ctx);
27779
+ if (root !== null) return root;
27780
+ const staticRoot = activeStaticBindingRoot(row.id, ctx);
27781
+ if (staticRoot !== null) return staticRoot.member;
27782
+ const placement = ctx.vm.databaseVM?.storedValuePlacementForValueId?.(row.id);
27783
+ if (placement !== null && placement !== void 0) {
27784
+ if (placement.parentValueId === null) {
27785
+ return evalMemberById(ctx.vm, placement.memberId);
27786
+ }
27787
+ }
27788
+ const syntheticMemberId = memberIdFromSyntheticDefaultValueId(row.id);
27789
+ return syntheticMemberId === null ? null : evalMemberById(ctx.vm, syntheticMemberId);
27790
+ }
27791
+ function placingMember(row, ctx, ownerEdge, depth = 0) {
27792
+ const bound = placingMemberBinding(row, ctx);
27793
+ if (bound !== null) return bound;
27794
+ const edge = ownerEdge ?? firstOwnerEdge(row, ctx);
27795
+ if (edge === void 0) return null;
27796
+ if ("memberId" in edge) return evalMemberById(ctx.vm, edge.memberId);
27797
+ if (depth >= MAX_AREA_DEPTH) return null;
27798
+ const parent = untrackedValueById(edge.parentId, ctx);
27799
+ if (parent === null) return null;
27800
+ const parentMember = parent.classId === void 0 ? placingMember(parent, ctx, void 0, depth + 1) : null;
27801
+ if (parentMember !== null && isMemberWithEntries(parentMember)) {
27802
+ return evalMemberById(ctx.vm, parentMember.entryMemberId);
27803
+ }
27804
+ const classId = parent.classId ?? (parentMember !== null && isClassTypedMember(parentMember) ? parentMember.classId : void 0);
27805
+ return classId === void 0 ? null : memberForCustomSchemaValue(classId, edge.key, ctx);
27806
+ }
27807
+ function placedClassId(row, ctx, ownerEdge) {
27808
+ const member = placingMember(row, ctx, ownerEdge);
27809
+ return member !== null && isClassTypedMember(member) ? member.classId : void 0;
27810
+ }
27636
27811
  function worldGridQueryIndexForContext(context) {
27637
27812
  const ctx = withEvaluationRuntime(context, []);
27638
27813
  const vm = ctx.vm;
@@ -27849,51 +28024,156 @@ function gridQueryClassFilter(typeArgument, ctx) {
27849
28024
  );
27850
28025
  }
27851
28026
  const classId = typeArgument.classId;
27852
- if (classId === NEO_OBJECT_CLASS_ID || classId === NEO_TILE_CLASS_ID) {
28027
+ if (classId === NEO_OBJECT_CLASS_ID || classId === NEO_TILE_CLASS_ID || classId === NEO_TILE_GRID_CLASS_ID) {
27853
28028
  return void 0;
27854
28029
  }
27855
28030
  const schema = evaluatorSchemaIndex(ctx);
27856
28031
  return (candidate) => schema.classIsOrExtends(candidate, classId);
27857
28032
  }
27858
- function evaluateSystemNative(memberId, receiver, args, ctx, typeArguments) {
27859
- try {
27860
- if (memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetCell || memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetObjects || memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetTile || memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetTiles) {
27861
- const receiverRow = trackedRowForValueReference(receiver, ctx);
27862
- if (receiverRow === null) {
27863
- throw new NSGetterRuntimeError(
27864
- "Grid queries require a placed NeoObject receiver."
28033
+ function gridQueryPlacement(receiver, ctx) {
28034
+ const receiverRow = trackedRowForValueReference(receiver, ctx);
28035
+ if (receiverRow === null) {
28036
+ throw new NSGetterRuntimeError(
28037
+ "Grid queries require a placed NeoObject receiver."
28038
+ );
28039
+ }
28040
+ const index = worldGridQueryIndexForContext(ctx);
28041
+ return {
28042
+ index,
28043
+ placement: index.placement(receiverRow.id, ctx.worldQueryDependencies)
28044
+ };
28045
+ }
28046
+ function gridQueryArguments(call, ctx) {
28047
+ return {
28048
+ offsets: readCellPattern(call.args[0], ctx),
28049
+ shift: readGridQueryOffset(call.args[1]),
28050
+ accepts: gridQueryClassFilter(call.typeArguments?.[0], ctx)
28051
+ };
28052
+ }
28053
+ function cellPatternNative(memberId) {
28054
+ return (call, ctx) => evaluateCellPatternNative(memberId, call.receiver, call.args, {
28055
+ readPattern: (value) => readCellPattern(value, ctx),
28056
+ constructPattern: (offsets) => constructDeclaredClassValue(
28057
+ {
28058
+ schemaClassInfo: {
28059
+ type: 7 /* Class */,
28060
+ required: true,
28061
+ classId: NEO_CELL_PATTERN_CLASS_ID
28062
+ },
28063
+ constructorId: NEO_CELL_PATTERN_CONSTRUCTOR_ID,
28064
+ args: [
28065
+ {
28066
+ name: "offsets",
28067
+ valuePointer: {
28068
+ type: "value" /* value */,
28069
+ value: {
28070
+ typeInfo: {
28071
+ type: 6 /* List */,
28072
+ required: true,
28073
+ entryTypeInfo: {
28074
+ type: 15 /* Vector2Int */,
28075
+ required: true
28076
+ }
28077
+ },
28078
+ value: offsets
28079
+ }
28080
+ }
28081
+ }
28082
+ ],
28083
+ fields: []
28084
+ },
28085
+ createTopLevelScope(ctx),
28086
+ ctx
28087
+ )
28088
+ });
28089
+ }
28090
+ var MAX_AREA_DEPTH = 256;
28091
+ var getAreaNative = (call, ctx) => {
28092
+ const receiver = trackedRowForValueReference(call.receiver, ctx);
28093
+ let row = receiver === null ? null : evalValueById(
28094
+ ctx,
28095
+ receiver.id,
28096
+ ctx.__runtimeSessionValues,
28097
+ ctx.__valueOverlay
28098
+ );
28099
+ const schema = evaluatorSchemaIndex(ctx);
28100
+ for (let depth = 0; row !== null && depth < MAX_AREA_DEPTH; depth++) {
28101
+ let edge;
28102
+ if (!Array.isArray(row.value)) {
28103
+ let classId = row.classId ?? void 0;
28104
+ if (classId === void 0) {
28105
+ edge = firstOwnerEdge(row, ctx);
28106
+ classId = placedClassId(row, ctx, edge);
28107
+ }
28108
+ if (classId !== void 0 && schema.classIsOrExtends(classId, NEO_TILE_GRID_CLASS_ID)) {
28109
+ const accepts = gridQueryClassFilter(call.typeArguments?.[0], ctx);
28110
+ return accepts === void 0 || accepts(classId) ? readRowValue(row, ctx) : null;
28111
+ }
28112
+ }
28113
+ const parentId = (edge ?? firstOwnerEdge(row, ctx))?.parentId;
28114
+ if (parentId === void 0) {
28115
+ if (placingMemberBinding(row, ctx) === null) {
28116
+ ctx.onUnattributableValueRead?.(
28117
+ ownershipChainRead("owned-value-parents", row.id)
27865
28118
  );
27866
28119
  }
27867
- const index = worldGridQueryIndexForContext(ctx);
27868
- const placement = index.placement(
27869
- receiverRow.id,
27870
- ctx.worldQueryDependencies
27871
- );
27872
- if (memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetCell)
27873
- return { handled: true, value: { ...placement.cell } };
27874
- const offsets = readCellPattern(args[0], ctx);
27875
- const shift = readGridQueryOffset(args[1]);
27876
- const accepts = gridQueryClassFilter(typeArguments?.[0], ctx);
27877
- if (memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetObjects) {
27878
- const value = index.objects(
28120
+ return null;
28121
+ }
28122
+ row = currentUnorderedContainerId(row, ctx) === parentId ? untrackedValueById(parentId, ctx) : evalValueById(
28123
+ ctx,
28124
+ parentId,
28125
+ ctx.__runtimeSessionValues,
28126
+ ctx.__valueOverlay
28127
+ );
28128
+ }
28129
+ return null;
28130
+ };
28131
+ var SYSTEM_NATIVE_HANDLERS = new Map([
28132
+ [
28133
+ NEO_OBJECT_GRID_MEMBER_IDS.GetCell,
28134
+ (call, ctx) => ({
28135
+ ...gridQueryPlacement(call.receiver, ctx).placement.cell
28136
+ })
28137
+ ],
28138
+ [
28139
+ NEO_OBJECT_GRID_MEMBER_IDS.GetObjects,
28140
+ (call, ctx) => {
28141
+ const { index, placement } = gridQueryPlacement(call.receiver, ctx);
28142
+ const { offsets, shift, accepts } = gridQueryArguments(call, ctx);
28143
+ return referenceEntryList(
28144
+ index.objects(
27879
28145
  placement,
27880
28146
  offsets,
27881
28147
  ctx.worldQueryDependencies,
27882
28148
  shift,
27883
28149
  accepts
27884
- );
27885
- return { handled: true, value: referenceEntryList(value, ctx) };
27886
- }
27887
- if (memberId === NEO_OBJECT_GRID_MEMBER_IDS.GetTiles) {
27888
- const value = index.tiles(
28150
+ ),
28151
+ ctx
28152
+ );
28153
+ }
28154
+ ],
28155
+ [
28156
+ NEO_OBJECT_GRID_MEMBER_IDS.GetTiles,
28157
+ (call, ctx) => {
28158
+ const { index, placement } = gridQueryPlacement(call.receiver, ctx);
28159
+ const { offsets, shift, accepts } = gridQueryArguments(call, ctx);
28160
+ return referenceEntryList(
28161
+ index.tiles(
27889
28162
  placement,
27890
28163
  offsets,
27891
28164
  ctx.worldQueryDependencies,
27892
28165
  shift,
27893
28166
  accepts
27894
- );
27895
- return { handled: true, value: referenceEntryList(value, ctx) };
27896
- }
28167
+ ),
28168
+ ctx
28169
+ );
28170
+ }
28171
+ ],
28172
+ [
28173
+ NEO_OBJECT_GRID_MEMBER_IDS.GetTile,
28174
+ (call, ctx) => {
28175
+ const { index, placement } = gridQueryPlacement(call.receiver, ctx);
28176
+ const { offsets, shift, accepts } = gridQueryArguments(call, ctx);
27897
28177
  const tile = index.tile(
27898
28178
  placement,
27899
28179
  offsets,
@@ -27901,7 +28181,7 @@ function evaluateSystemNative(memberId, receiver, args, ctx, typeArguments) {
27901
28181
  shift,
27902
28182
  accepts
27903
28183
  );
27904
- if (tile === null) return { handled: true, value: null };
28184
+ if (tile === null) return null;
27905
28185
  const row = evalValueById(
27906
28186
  ctx,
27907
28187
  tile.placementValueId,
@@ -27913,43 +28193,20 @@ function evaluateSystemNative(memberId, receiver, args, ctx, typeArguments) {
27913
28193
  `Tile placement '${tile.placementValueId}' is missing.`
27914
28194
  );
27915
28195
  }
27916
- return { handled: true, value: readRowValue(row, ctx) };
28196
+ return readRowValue(row, ctx);
27917
28197
  }
27918
- return evaluateCellPatternNative(memberId, receiver, args, {
27919
- readPattern: (value) => readCellPattern(value, ctx),
27920
- constructPattern: (offsets) => constructDeclaredClassValue(
27921
- {
27922
- schemaClassInfo: {
27923
- type: 7 /* Class */,
27924
- required: true,
27925
- classId: NEO_CELL_PATTERN_CLASS_ID
27926
- },
27927
- constructorId: NEO_CELL_PATTERN_CONSTRUCTOR_ID,
27928
- args: [
27929
- {
27930
- name: "offsets",
27931
- valuePointer: {
27932
- type: "value" /* value */,
27933
- value: {
27934
- typeInfo: {
27935
- type: 6 /* List */,
27936
- required: true,
27937
- entryTypeInfo: {
27938
- type: 15 /* Vector2Int */,
27939
- required: true
27940
- }
27941
- },
27942
- value: offsets
27943
- }
27944
- }
27945
- }
27946
- ],
27947
- fields: []
27948
- },
27949
- createTopLevelScope(ctx),
27950
- ctx
27951
- )
27952
- });
28198
+ ],
28199
+ [NEO_GET_AREA_MEMBER_IDS.NeoObjectBase, getAreaNative],
28200
+ [NEO_GET_AREA_MEMBER_IDS.NeoTile, getAreaNative],
28201
+ ...[...NEO_CELL_PATTERN_PURE_NATIVE_MEMBER_IDS].map(
28202
+ (id) => [id, cellPatternNative(id)]
28203
+ )
28204
+ ]);
28205
+ function evaluateSystemNative(memberId, call, ctx) {
28206
+ const handler = SYSTEM_NATIVE_HANDLERS.get(memberId);
28207
+ if (handler === void 0) return { handled: false };
28208
+ try {
28209
+ return { handled: true, value: handler(call, ctx) };
27953
28210
  } catch (error) {
27954
28211
  if (error instanceof RangeError || error instanceof TypeError || error instanceof WorldGridQueryError) {
27955
28212
  throw new NSGetterRuntimeError(error.message, { cause: error });
@@ -32195,10 +32452,11 @@ function currentOwnedValueAttachments(valueId, ctx) {
32195
32452
  ctx.__runtimeSessionValues,
32196
32453
  ctx.__valueOverlay
32197
32454
  );
32198
- if (typeof row?.containerId === "string") {
32455
+ const containerId = row === null ? void 0 : currentUnorderedContainerId(row, ctx);
32456
+ if (containerId !== void 0) {
32199
32457
  add({
32200
- identity: `value:${row.containerId}:unordered-entry:${valueId}`,
32201
- label: row.containerId
32458
+ identity: `value:${containerId}:unordered-entry:${valueId}`,
32459
+ label: containerId
32202
32460
  });
32203
32461
  }
32204
32462
  const activeStaticRoot = activeStaticBindingRoot(valueId, ctx);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neocompose/cli",
3
- "version": "0.83.0",
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.83.0 -->
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.83.0 -->
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