Hello @Paul744, I’m having trouble following your thoughts. I think there is a misconception, you cannot load a style and define a custom sorting, because sorting is defined by the style.
For example, by selecting the “alphanumeric” style, you would load the following CSL style hayagriva/styles/alphanumeric.csl at main · typst/hayagriva · GitHub (if I’m not wrong) which defines sorting as
<sort>
<key variable="author" />
<key variable="issued" />
</sort>
The CSL spec can be read here.
If you want author-date sorting, you need to load a style that sorts in this way, e.g., chicago-author-date. Below, they sort using three different keys “contributors”, “date-sort” and “title”.
<sort>
<key macro="contributors"/>
<key macro="date-sort"/>
<key variable="title"/>
</sort>
I also think that it’s not easy to customize bibliography layout currently in Typst, because there is no dedicated interface, but since there is a standard (CSL), I think it’s the proper way to support customization.
Also, not everything should be done in Typst.
tl;dr: best hack is to define your own sorting in the CSL file. You can use the fantastic visualEditor here! (or mash together different styles).
Hopefully, my explanation was on topic, please tell me if I misunderstood your question!
P.S.: I think a good way to support custom sorting would be to allow taking into account biblatex’s sortkey
.