feat(wardley): add (ecosystem) decorator and PST attitude zones#7696
feat(wardley): add (ecosystem) decorator and PST attitude zones#7696tractorjuice wants to merge 3 commits intomermaid-js:developfrom
Conversation
- Add `(ecosystem)` source-strategy alongside build/buy/outsource/market. Renders as concentric circles with a diagonal-hatch ring, matching the OWM ecosystem-play symbol. - Add attitude zones using OWM's canonical 4-coordinate form `keyword [v1, m1, v2, m2]`. Renders as a translucent labelled rectangle in OWM's colour palette: pioneers (light blue), settlers (medium blue), townplanners (purple). - Accept `explorers` as an alias for `pioneers` and `villagers` as an alias for `settlers`. - Update Sourcing Strategy docs (corrected misleading shape descriptions for build/buy/outsource/market) and add an Attitude Zones section with example. - Refresh tool URL to create.wardleymaps.ai and drop dead link. Tests: 45 unit tests (parser package + mermaid package + builder), plus Cypress fixtures for both new features. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
✅ Deploy Preview for mermaid-js ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
🦋 Changeset detectedLatest commit: 5ed4ea6 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@mermaid-js/examples
mermaid
@mermaid-js/layout-elk
@mermaid-js/layout-tidy-tree
@mermaid-js/mermaid-zenuml
@mermaid-js/parser
@mermaid-js/tiny
commit: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #7696 +/- ##
==========================================
- Coverage 3.33% 3.33% -0.01%
==========================================
Files 542 541 -1
Lines 56881 57014 +133
Branches 839 839
==========================================
Hits 1899 1899
- Misses 54982 55115 +133
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
knsv-bot
left a comment
There was a problem hiding this comment.
[sisyphus-bot]
Thanks for this, @tractorjuice — really thoughtful extension to wardley-beta. The OWM ecosystem decorator and PST attitude zones are a natural fit, and the test coverage you've put in across parser, builder, db, and Cypress is genuinely above-bar. A few small things below, mostly around theming and a couple of docs claims to double-check. 🙏
What's working well
- 🎉 [praise] Test coverage is excellent — 18 parser tests in
packages/parser/tests/wardley.test.tscovering all five strategy decorators, alias normalization, multi-zone parsing, reverse-corner ordering, and three malformed-input rejection cases, plus 27 integration tests at the db/builder layer and two Cypress visual scenarios. This is the kind of layered testing the new-diagram checklist asks for. - 🎉 [praise]
wardleyRenderer.ts:147scopes the diagonal-hatch pattern withdiagonalHatch-${id}so multiple wardley diagrams on a single page won't collide on<defs>IDs. Easy thing to miss; nice catch. - 🎉 [praise] Render order is correct — attitudes are drawn before axes/grid/components (
wardleyRenderer.ts:179-222), so they correctly sit as background regions. - 🎉 [praise] Defensive handling of attitude geometry —
Math.min/Math.absto normalize corners (wardleyRenderer.ts:198-201) plus the "accepts attitude corners in reverse order" parser test means users can write either corner first without breakage. - 🎉 [praise] Aliasing (
explorers→pioneers,villagers→settlers) is handled inwardleyParser.ts:240-245after parsing rather than in the grammar, which keeps the AST surface consistent with the canonical kinds. Good separation. - 🎉 [praise] Both source docs (
packages/mermaid/src/docs/syntax/wardley.md) and the generated top-leveldocs/syntax/wardley.mdare updated together, which suggests the docs build was run.
Things to address
🟡 [important] Hardcoded colors bypass the existing wardley theming pattern
The existing wardley renderer follows themeVariables.wardley?.<key> ?? '<default>' (see wardleyRenderer.ts:28-42 for backgroundColor, componentStroke, linkStroke, etc.). The new code introduces hardcoded hex values that won't react to user theme overrides:
- Attitude zones (
wardleyRenderer.ts:184-189):pioneers: { stroke: '#3490dd', fill: '#3ccaf8', … }, same forsettlersandtownplanners - Ecosystem decorator (
wardleyRenderer.ts:802-845): outer'#d7d7d7', middle/inner'white'
The OWM palette is canonical for PST, which is a perfectly valid reason to keep these as defaults — but ideally as theme variables that users can override (e.g., for dark-mode compositions, or accessibility-tweaked palettes). Could you wire them through the same themeVariables.wardley?.X pattern? Something like:
pioneers: {
stroke: themeVariables.wardley?.pioneersStroke ?? '#3490dd',
fill: themeVariables.wardley?.pioneersFill ?? '#3ccaf8',
label: 'Pioneers',
},Same shape for settlers, townplanners, and the ecosystem outer/middle/inner fills. The hatch stroke already uses theme.componentStroke — that's the model.
🟡 [important] The "drops a dead link" claim doesn't hold — learnwardleymapping.com is live
The PR removes https://learnwardleymapping.com/ from the Resources section in both docs/syntax/wardley.md and packages/mermaid/src/docs/syntax/wardley.md, and the PR description says this drops "a dead link". I checked the URL just now and the site is reachable, serves a valid page (title "Learn Wardley Mapping"), and looks actively maintained. Could you either restore it or share the evidence that it's broken (intermittent outage? geo-block? deprecation announcement?) so we can keep the PR description accurate?
🟢 [nit] OWM URL change — onlinewardleymaps.com → create.wardleymaps.ai
Both URLs currently load (the original responds, just with a SPA loading shell). If create.wardleymaps.ai is the new home of the same OWM project under a different domain, totally fine — could you add a note to the PR description confirming the migration? If they are different tools, "Create Wardley Maps" should probably sit alongside "OnlineWardleyMaps" rather than replace it. You're closer to that ecosystem than I am, so I'll defer to your call — just want to make sure the rename is intentional.
🟢 [nit] "Maturity" vs "evolution" terminology inconsistency in docs
The Coordinate System section in packages/mermaid/src/docs/syntax/wardley.md:59-65 describes the X-axis as "Evolution", but the new Attitude Zones section at packages/mermaid/src/docs/syntax/wardley.md:172 describes corners as [visibility1, maturity1, visibility2, maturity2]. The grammar uses evolution/evolution2. They're synonyms in Wardley parlance, but for someone reading the docs front-to-back the switch is jarring. Worth picking one term and using it everywhere.
🟢 [nit] Attitude label vertical positioning
wardleyRenderer.ts:213 places the zone label at rectY + 16 (a fixed offset from the top of the rect). For very thin vertical zones this will land outside or below the rect. Not blocking — the example zones have plenty of room — but a Math.min(rectY + 16, rectY + rectH - someMargin) clamp would future-proof the layout if anyone defines a tall but short zone. Optional.
Notes / verifications
- Generated parser files (
packages/parser/src/language/generated/*) are gitignored, so the langium grammar change inwardley.langiumwill be regenerated bypnpm --filter parser langium:generateat build time — that's correct, no drift to worry about. - No cross-diagram imports introduced; isolation rules are respected.
- No XSS surface in the new code: all SVG attributes are set via D3
.attr()with numbers from coordinate conversion or labels from the hardcodedattitudeStylesrecord.attitude.kindis constrained to enum values via the grammar. - Changeset (
mermaidminor) and version bump look correct for a feature add to a beta diagram.
Summary
This is close — the main ask is wiring the new colors through the existing themeVariables.wardley?.X pattern, and double-checking the two doc-link claims. Happy to re-review as soon as those are addressed.
Severity tally: 🔴 0 · 🟡 2 · 🟢 3 · 🎉 6
…s, docs - Wire pioneers/settlers/townplanners stroke+fill and ecosystem outer/middle/inner fills through `themeVariables.wardley?.X` with OWM hex defaults, matching the existing wardley theming pattern. - Restore learnwardleymapping.com link to Resources alongside create.wardleymaps.ai. - Use "evolution" consistently instead of "maturity" in docs. - Clamp attitude zone label Y so it can't fall outside very thin rectangles. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
Summary
Extends the
wardley-betadiagram to match more of the OWM (OnlineWardleyMaps) syntax:(ecosystem)source-strategy decorator — drawn as concentric circles with a diagonal-hatch ring, matching the OWM ecosystem-play symbol.keyword [v1, e1, v2, e2](top-left and bottom-right corners). Renders as a translucent labelled rectangle in OWM's colour palette:pioneers— light bluesettlers— medium bluetownplanners— purpleexplorers→pioneers,villagers→settlers.Example:
Also corrects misleading shape descriptions in the existing Sourcing Strategy docs section (build/buy/outsource/market were described as "Triangle/Diamond/Square/Circle" but render as differentiated overlay circles), and adds create.wardleymaps.ai to the Resources list (the active OWM-successor mapping tool) alongside the existing entries.
Review follow-ups (5ab7454)
themeVariables.wardley?.Xdefaults so users can override per theme.learnwardleymapping.comto Resources (the original PR description incorrectly described it as a dead link — it is live).Test plan
packages/parser/tests/wardley.test.ts): 18 tests covering all 5 strategy decorators, alias normalization, multi-zone parsing, reverse-corner ordering, malformed-attitude rejectionwardleyParser.spec.ts,wardleyBuilder.spec.ts): 27 tests covering coord conversion, alias normalization, builder/build/clear cycle for attitudestownplanners)🤖 Generated with Claude Code