UI layer for recipe-based crafting. Reads recipes from
lib-core.crafting, renders the known-subset as a vertical row-list
inside a panel managed by lib-core.panel, and dispatches right-click
context-menu actions registered by the consuming module.
Surface:
create(container_entity, opts) -> widget_def
register_action(widget, label, callback)
unregister_action(widget, label)
set_icon_resolver(widget, fn)
set_label_resolver(widget, fn)
set_summary_resolver(widget, fn)
Row-build is rebuilt per render frame from crafting.list_recipes():
- Visibility gate: recipe.is_known(ctx); errors hide row + emit [WARN]
- Availability gate: crafting.can_craft(id, container, ctx).ok
drives row colour (full vs dim text_color).
ctx comes from opts.ctx_factory() — default returns {}; override to
feed actor/skill/faction state into both predicates. label_resolver
defaults to recipe.name or recipe.id; summary_resolver joins input
template-ids with " + " and suffixes "xN" for count>1.
Right-click hit-tests row-rects captured during render, then opens
the menu via panel.show_context_menu(x, y, actions). Action
callbacks receive (recipe_id, {container, close_menu, refresh}).
Registration order is preserved (array-based, not pairs-based) so
context-menu rendering matches registration sequence.
Depends on lib-core.crafting 0.1.0, lib-core.panel 0.1.1,
lib-core.inventory-list 0.1.0, lib-core.composition 0.3.0. The last
two are not called directly but are required as direct deps so
modules consuming this widget satisfy crafting's transitive needs
(engine resolver is per-module non-transitive).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
25 lines
1.2 KiB
Plaintext
25 lines
1.2 KiB
Plaintext
Copyright (c) 2026 Calic. All rights reserved.
|
|
|
|
This software is part of the Sporel platform — **Tier 1 (Official /
|
|
Proprietary)** content per the Three-Tier Licensing Model documented in
|
|
`meta/docs/archive/design/vision.md §Licensing Model` (current source;
|
|
migration to `meta/docs/architecture/licensing-model.md` pending).
|
|
|
|
⚠ **WIP — Legal review required before public launch.** The terms below
|
|
reflect design intent only; the formalized license framework will be
|
|
finalized through legal counsel before the first public release. Until
|
|
then, this notice serves as a placeholder defending the platform owner's
|
|
rights against unintentional re-licensing.
|
|
|
|
No license is granted to copy, modify, distribute, sublicense, or otherwise
|
|
use this software in any form without prior written permission from the
|
|
copyright holder.
|
|
|
|
References:
|
|
- Tier 1 (this file): all rights reserved, proprietary, sold/distributed
|
|
via official channels (Steam, etc.)
|
|
- Tier 2 (Semi-Commercial Co-Development): bilateral contracts, revenue-
|
|
share — see vision.md §Licensing Model
|
|
- Tier 3 (Community Content): CC BY-NC-SA 4.0 + asymmetric CLA — applies
|
|
to community-uploaded libs/modules/assets, not this repo
|