Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

The package version runs on its own semver; the schema it is generated from is `SCHEMA_DIST_TAG`.

## 0.131.0 (2026-11-16)

- **`unplaced_by_links_3d`: what a saved `by-links-3d` layout map does not place.** Given the graph and the ids of the elements the Map's Pins stand for (a list, a tuple or a set), it answers the ids of the graph's nodes that the Map has no Pin for, by id in code point order. Every node counts, of any type and with or without a link, since the method places every node it is handed. `placed` is read as `unplaced_by_kind` reads it: a member that is not a non-empty string is passed over, and an id that is no node is no part of the answer; two nodes with one id raise `ValueError`, as `layout_by_links_3d` does. The npm SDK's `unplacedByLinks3d` answers the same list.
- Tests: the method's shared fixture gains eight cases (72) and an `unplaced` suite of eight, the same bytes as the npm SDK's copy. No answer of the method changes.

## 0.130.1 (2026-11-16)

- **`layout_by_links_3d` no longer raises on a Map whose width or height is under 0.** A Map's `width` and `height` are any whole number in the standard. One under 0 raised a `PlateError` from inside the method when that Map held the most pinned elements, and with both under 0 the Map became a plate with every place mirrored. A width or height that is not over 0 is now no size: such a Map is no plate, no other Map is tried in its stead, and the world is laid out by its links alone; a Map over a place with such a size is no small plate. The method's shared fixture gains four cases for it (64), the same bytes as the npm SDK's copy.
Expand Down
3 changes: 2 additions & 1 deletion src/onlyworlds/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
unplaced_around,
unplaced_by_kind,
)
from .layout_links_3d import BY_LINKS_3D_REST, LayoutByLinks3d, layout_by_links_3d
from .layout_links_3d import BY_LINKS_3D_REST, LayoutByLinks3d, layout_by_links_3d, unplaced_by_links_3d
from .layout_trail import (
TRAIL_TIERS,
TrailHanger,
Expand Down Expand Up @@ -324,6 +324,7 @@
"type_word",
"unplaced_around",
"unplaced_by_kind",
"unplaced_by_links_3d",
"unread_for",
"uuid7",
"verify_level",
Expand Down
2 changes: 1 addition & 1 deletion src/onlyworlds/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.130.1"
__version__ = "0.131.0"
36 changes: 35 additions & 1 deletion src/onlyworlds/layout_links_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@
from ._directions import DIRECTIONS
from ._layout3d.method import HeldRangeError, HeldTypeError, layout3d
from ._layout3d.space import space_rows
from .layout_kind import _placed_ids

__all__ = ["BY_LINKS_3D_REST", "HeldRangeError", "HeldTypeError", "LayoutByLinks3d", "layout_by_links_3d"]
__all__ = [
"BY_LINKS_3D_REST",
"HeldRangeError",
"HeldTypeError",
"LayoutByLinks3d",
"layout_by_links_3d",
"unplaced_by_links_3d",
]

#: The rest length of the by-links-3d layout: a link's length at rest, and the unit of its answer's points.
BY_LINKS_3D_REST = 60.0
Expand Down Expand Up @@ -116,3 +124,29 @@ def layout_by_links_3d(
raise TypeError("layout_by_links_3d: the graph is {nodes, edges}, as world_graph answers it")
rows = space_rows(list(elements) if elements is not None else None)
return cast(LayoutByLinks3d, layout3d(nodes, edges, rows, DIRECTIONS, held=held, held_unit=held_unit))


def unplaced_by_links_3d(graph: Mapping[str, Any], placed: Iterable[Any]) -> list[str]:
"""What a saved ``by-links-3d`` layout map does not place.

Answers the ids of the graph's nodes that are not in ``placed``, by id in code point order. The method places
every node it is handed, of any type and with or without a link, so nothing else is left out. ``placed`` is the
ids of the elements the Map's Pins stand for, a list or a set: from ``map_space``, the ``element_id`` of each pin
whose ``map`` is this Map. A member that is not a non-empty string (a Pin that stands for no element) is passed
over, and an id that is no node of the graph is no part of the answer. The answer's length is the count a tool
shows; reading or drawing a layout map never changes it. The npm SDK's ``unplacedByLinks3d`` answers the same
list.

Raises ``TypeError`` on a graph that is not ``{nodes, edges}`` or a ``placed`` that is not a list or a set, and,
as ``layout_by_links_3d`` does, ``ValueError`` when two nodes share an id.
"""
nodes = graph.get("nodes") if isinstance(graph, Mapping) else None
edges = graph.get("edges") if isinstance(graph, Mapping) else None
if not isinstance(nodes, list) or not isinstance(edges, list):
raise TypeError("unplaced_by_links_3d: the graph is {nodes, edges}, as world_graph answers it")
taken = _placed_ids("unplaced_by_links_3d", placed)
ids = sorted(x["id"] for x in nodes)
for i in range(1, len(ids)):
if ids[i] == ids[i - 1]:
raise ValueError(f"unplaced_by_links_3d: two nodes share the id {ids[i]}")
return [i for i in ids if i not in taken]
Loading
Loading