Rename all 1,169 components to path-based names with namespace support

Component names now reflect filesystem location using / as path separator
and : as namespace separator for shared components:
  ~sx-header → ~layouts/header
  ~layout-app-body → ~shared:layout/app-body
  ~blog-admin-dashboard → ~admin/dashboard

209 files, 4,941 replacements across all services.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-12 22:00:12 +00:00
parent de80d921e9
commit b0920a1121
209 changed files with 4620 additions and 4620 deletions

View File

@@ -14,13 +14,13 @@ def _load_components():
# ---------------------------------------------------------------------------
# ~cart-mini
# ~shared:fragments/cart-mini
# ---------------------------------------------------------------------------
class TestCartMini:
def test_empty_cart_shows_logo(self):
html = sx(
'(~cart-mini :cart-count cart-count :blog-url blog-url :cart-url cart-url)',
'(~shared:fragments/cart-mini :cart-count cart-count :blog-url blog-url :cart-url cart-url)',
**{"cart-count": 0, "blog-url": "https://blog.example.com/", "cart-url": "https://cart.example.com/"},
)
assert 'id="cart-mini"' in html
@@ -30,7 +30,7 @@ class TestCartMini:
def test_nonempty_cart_shows_badge(self):
html = sx(
'(~cart-mini :cart-count cart-count :blog-url blog-url :cart-url cart-url)',
'(~shared:fragments/cart-mini :cart-count cart-count :blog-url blog-url :cart-url cart-url)',
**{"cart-count": 3, "blog-url": "https://blog.example.com/", "cart-url": "https://cart.example.com/"},
)
assert 'id="cart-mini"' in html
@@ -41,13 +41,13 @@ class TestCartMini:
def test_oob_attribute(self):
html = sx(
'(~cart-mini :cart-count 0 :blog-url "" :cart-url "" :oob "true")',
'(~shared:fragments/cart-mini :cart-count 0 :blog-url "" :cart-url "" :oob "true")',
)
assert 'sx-swap-oob="true"' in html
def test_no_oob_when_nil(self):
html = sx(
'(~cart-mini :cart-count 0 :blog-url "" :cart-url "")',
'(~shared:fragments/cart-mini :cart-count 0 :blog-url "" :cart-url "")',
)
assert "sx-swap-oob" not in html
@@ -94,13 +94,13 @@ class TestAuthMenu:
# ---------------------------------------------------------------------------
# ~account-nav-item
# ~shared:fragments/account-nav-item
# ---------------------------------------------------------------------------
class TestAccountNavItem:
def test_renders_link(self):
html = sx(
'(~account-nav-item :href "/orders/" :label "orders")',
'(~shared:fragments/account-nav-item :href "/orders/" :label "orders")',
)
assert 'href="/orders/"' in html
assert ">orders<" in html
@@ -109,19 +109,19 @@ class TestAccountNavItem:
def test_custom_label(self):
html = sx(
'(~account-nav-item :href "/cart/orders/" :label "my orders")',
'(~shared:fragments/account-nav-item :href "/cart/orders/" :label "my orders")',
)
assert ">my orders<" in html
# ---------------------------------------------------------------------------
# ~calendar-entry-nav
# ~shared:navigation/calendar-entry-nav
# ---------------------------------------------------------------------------
class TestCalendarEntryNav:
def test_renders_entry(self):
html = sx(
'(~calendar-entry-nav :href "/events/entry/1/" :name "Workshop" :date-str "Jan 15, 2026 at 14:00" :nav-class "btn")',
'(~shared:navigation/calendar-entry-nav :href "/events/entry/1/" :name "Workshop" :date-str "Jan 15, 2026 at 14:00" :nav-class "btn")',
**{"date-str": "Jan 15, 2026 at 14:00", "nav-class": "btn"},
)
assert 'href="/events/entry/1/"' in html
@@ -130,13 +130,13 @@ class TestCalendarEntryNav:
# ---------------------------------------------------------------------------
# ~calendar-link-nav
# ~shared:navigation/calendar-link-nav
# ---------------------------------------------------------------------------
class TestCalendarLinkNav:
def test_renders_calendar_link(self):
html = sx(
'(~calendar-link-nav :href "/events/cal/" :name "Art Events" :nav-class "btn")',
'(~shared:navigation/calendar-link-nav :href "/events/cal/" :name "Art Events" :nav-class "btn")',
**{"nav-class": "btn"},
)
assert 'href="/events/cal/"' in html
@@ -145,13 +145,13 @@ class TestCalendarLinkNav:
# ---------------------------------------------------------------------------
# ~market-link-nav
# ~shared:navigation/market-link-nav
# ---------------------------------------------------------------------------
class TestMarketLinkNav:
def test_renders_market_link(self):
html = sx(
'(~market-link-nav :href "/market/farm/" :name "Farm Shop" :nav-class "btn")',
'(~shared:navigation/market-link-nav :href "/market/farm/" :name "Farm Shop" :nav-class "btn")',
**{"nav-class": "btn"},
)
assert 'href="/market/farm/"' in html
@@ -160,13 +160,13 @@ class TestMarketLinkNav:
# ---------------------------------------------------------------------------
# ~post-card
# ~shared:cards/post-card
# ---------------------------------------------------------------------------
class TestPostCard:
def test_basic_card(self):
html = sx(
'(~post-card :title "Hello World" :slug "hello" :href "/hello/"'
'(~shared:cards/post-card :title "Hello World" :slug "hello" :href "/hello/"'
' :feature-image "/img/hello.jpg" :excerpt "A test post"'
' :status "published" :published-at "15 Jan 2026"'
' :hx-select "#main-panel")',
@@ -184,7 +184,7 @@ class TestPostCard:
def test_draft_status(self):
html = sx(
'(~post-card :title "Draft" :slug "draft" :href "/draft/"'
'(~shared:cards/post-card :title "Draft" :slug "draft" :href "/draft/"'
' :status "draft" :updated-at "15 Jan 2026"'
' :hx-select "#main-panel")',
**{"hx-select": "#main-panel", "updated-at": "15 Jan 2026"},
@@ -195,7 +195,7 @@ class TestPostCard:
def test_draft_with_publish_requested(self):
html = sx(
'(~post-card :title "Pending" :slug "pending" :href "/pending/"'
'(~shared:cards/post-card :title "Pending" :slug "pending" :href "/pending/"'
' :status "draft" :publish-requested true'
' :hx-select "#main-panel")',
**{"hx-select": "#main-panel", "publish-requested": True},
@@ -205,7 +205,7 @@ class TestPostCard:
def test_no_image(self):
html = sx(
'(~post-card :title "No Img" :slug "no-img" :href "/no-img/"'
'(~shared:cards/post-card :title "No Img" :slug "no-img" :href "/no-img/"'
' :status "published" :hx-select "#main-panel")',
**{"hx-select": "#main-panel"},
)
@@ -214,7 +214,7 @@ class TestPostCard:
def test_widgets_and_at_bar(self):
"""Widgets and at-bar are sx kwarg slots rendered by the client."""
html = sx(
'(~post-card :title "T" :slug "s" :href "/"'
'(~shared:cards/post-card :title "T" :slug "s" :href "/"'
' :status "published" :hx-select "#mp")',
**{"hx-select": "#mp"},
)
@@ -224,13 +224,13 @@ class TestPostCard:
# ---------------------------------------------------------------------------
# ~base-shell and ~error-page
# ~shared:pages/base-shell and ~shared:pages/error-page
# ---------------------------------------------------------------------------
class TestBaseShell:
def test_renders_full_page(self):
html = sx(
'(~base-shell :title "Test" :asset-url "/static" (p "Hello"))',
'(~shared:pages/base-shell :title "Test" :asset-url "/static" (p "Hello"))',
**{"asset-url": "/static"},
)
assert "<!doctype html>" in html
@@ -243,7 +243,7 @@ class TestBaseShell:
class TestErrorPage:
def test_404_page(self):
html = sx(
'(~error-page :title "404 Error" :message "NOT FOUND" :image "/static/errors/404.gif" :asset-url "/static")',
'(~shared:pages/error-page :title "404 Error" :message "NOT FOUND" :image "/static/errors/404.gif" :asset-url "/static")',
**{"asset-url": "/static"},
)
assert "<!doctype html>" in html
@@ -253,7 +253,7 @@ class TestErrorPage:
def test_error_page_no_image(self):
html = sx(
'(~error-page :title "500 Error" :message "SERVER ERROR" :asset-url "/static")',
'(~shared:pages/error-page :title "500 Error" :message "SERVER ERROR" :asset-url "/static")',
**{"asset-url": "/static"},
)
assert "SERVER ERROR" in html
@@ -261,13 +261,13 @@ class TestErrorPage:
# ---------------------------------------------------------------------------
# ~relation-nav
# ~shared:navigation/relation-nav
# ---------------------------------------------------------------------------
class TestRelationNav:
def test_renders_link(self):
html = sx(
'(~relation-nav :href "/market/farm/" :name "Farm Shop" :icon "fa fa-shopping-bag")',
'(~shared:navigation/relation-nav :href "/market/farm/" :name "Farm Shop" :icon "fa fa-shopping-bag")',
)
assert 'href="/market/farm/"' in html
assert "Farm Shop" in html
@@ -275,7 +275,7 @@ class TestRelationNav:
def test_no_icon(self):
html = sx(
'(~relation-nav :href "/cal/" :name "Events")',
'(~shared:navigation/relation-nav :href "/cal/" :name "Events")',
)
assert 'href="/cal/"' in html
assert "Events" in html
@@ -283,20 +283,20 @@ class TestRelationNav:
def test_custom_nav_class(self):
html = sx(
'(~relation-nav :href "/" :name "X" :nav-class "custom-class")',
'(~shared:navigation/relation-nav :href "/" :name "X" :nav-class "custom-class")',
**{"nav-class": "custom-class"},
)
assert 'class="custom-class"' in html
# ---------------------------------------------------------------------------
# ~relation-attach
# ~shared:relations/attach
# ---------------------------------------------------------------------------
class TestRelationAttach:
def test_renders_button(self):
html = sx(
'(~relation-attach :create-url "/market/create/" :label "Add Market" :icon "fa fa-plus")',
'(~shared:relations/attach :create-url "/market/create/" :label "Add Market" :icon "fa fa-plus")',
**{"create-url": "/market/create/"},
)
assert 'href="/market/create/"' in html
@@ -306,20 +306,20 @@ class TestRelationAttach:
def test_default_label(self):
html = sx(
'(~relation-attach :create-url "/create/")',
'(~shared:relations/attach :create-url "/create/")',
**{"create-url": "/create/"},
)
assert "Add" in html
# ---------------------------------------------------------------------------
# ~relation-detach
# ~shared:relations/detach
# ---------------------------------------------------------------------------
class TestRelationDetach:
def test_renders_button(self):
html = sx(
'(~relation-detach :detach-url "/api/unrelate" :name "Farm Shop")',
'(~shared:relations/detach :detach-url "/api/unrelate" :name "Farm Shop")',
**{"detach-url": "/api/unrelate"},
)
assert 'sx-delete="/api/unrelate"' in html
@@ -328,7 +328,7 @@ class TestRelationDetach:
def test_default_name(self):
html = sx(
'(~relation-detach :detach-url "/api/unrelate")',
'(~shared:relations/detach :detach-url "/api/unrelate")',
**{"detach-url": "/api/unrelate"},
)
assert "this item" in html
@@ -343,7 +343,7 @@ class TestRenderPage:
from shared.sx.page import render_page
html = render_page(
'(~error-page :title "Test" :message "MSG" :asset-url "/s")',
'(~shared:pages/error-page :title "Test" :message "MSG" :asset-url "/s")',
**{"asset-url": "/s"},
)
assert "<!doctype html>" in html