Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b584df647 | ||
|
|
e887996105 | ||
|
|
4221f2d176 | ||
|
|
fd47da3a98 | ||
|
|
65761a1da5 | ||
|
|
b1cdb74e75 | ||
|
|
d25d46557e | ||
|
|
8cf472636d | ||
|
|
b64b80efd5 |
No files matched your search
@@ -14,6 +14,8 @@ Code](https://code.claude.com/docs/en/skills) and
|
|||||||
|
|
||||||
## writing code
|
## writing code
|
||||||
|
|
||||||
|
- [pola](pola/SKILL.md) — organize all code, tests included, by
|
||||||
|
the flow of authority: each part gets only what its task needs.
|
||||||
- [no-ambient-authority](no-ambient-authority/SKILL.md) — clocks,
|
- [no-ambient-authority](no-ambient-authority/SKILL.md) — clocks,
|
||||||
RNGs, `fetch`, and the filesystem come in as parameters.
|
RNGs, `fetch`, and the filesystem come in as parameters.
|
||||||
- [io-between-turns](io-between-turns/SKILL.md) — sync I/O is a pointy
|
- [io-between-turns](io-between-turns/SKILL.md) — sync I/O is a pointy
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: citation-needed
|
name: citation-needed
|
||||||
description: Provide live, verifiable links when a factual claim is challenged with "citation needed", or when asserting a fact likely to be challenged. Formats citations as blockquote markup with the page title as the link and a date. Not for code references or repo-local docs.
|
description: Provide live, verifiable links when a factual claim is challenged with "citation needed", or when asserting a fact likely to be challenged; when writing an outline or article that may be published, with a References or sources section, a CSL-JSON sidecar, or a Zotero collection. Formats citations as blockquote markup with the page title as the link and a date. Not for code references or repo-local docs.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Citation Needed
|
# Citation Needed
|
||||||
@@ -34,6 +34,54 @@ raw in-your-face URLs.
|
|||||||
> — [Source Page Title](https://example.com/path), Site Name, Sep 23, 2026
|
> — [Source Page Title](https://example.com/path), Site Name, Sep 23, 2026
|
||||||
```
|
```
|
||||||
|
|
||||||
|
In madmode.com posts, the dash is `--`:
|
||||||
|
`> -- [Page Title](https://example.com/path), Author or Site, Mon YYYY`.
|
||||||
|
|
||||||
|
## Writing for publication
|
||||||
|
|
||||||
|
Anything that may be shared publicly cites public sources only: never
|
||||||
|
unpublished notes, private LLM chats, or local-only links such as
|
||||||
|
`zotero://select`. A claim that rests on one of those either becomes the
|
||||||
|
author's own words or gets flagged ⚠️ until a real source turns up.
|
||||||
|
|
||||||
|
- **Primary sources first.** Cite the W3C workshop paper, not a post about
|
||||||
|
it. The author's own blog post on the topic goes in parentheses after
|
||||||
|
it, as an inline link.
|
||||||
|
- **Every reference gets a date**, so none pile up undated at the end of
|
||||||
|
a newest-first list: software by a release from around when it became
|
||||||
|
well known, web pages "as of" the month you read them, statutes by
|
||||||
|
enactment.
|
||||||
|
- **Outlines:** use Markdown footnotes (`[^key]`) collected in one
|
||||||
|
`## References` section at the end, newest first, with no subheadings
|
||||||
|
(Obsidian moves footnote definitions to the bottom, leaving
|
||||||
|
subheadings empty).
|
||||||
|
- **CSL-JSON sidecar:** keep `<name> - references.json` next to the
|
||||||
|
outline, in the same order, with `id` equal to the footnote key. It's
|
||||||
|
the data behind everything else.
|
||||||
|
- **Published posts:** don't hand-write the sources list. Put
|
||||||
|
`bib: <name> - references.json` in the post's front matter, and the
|
||||||
|
madmode site renders it with the xhlt91 bibliography conventions
|
||||||
|
(`templates/_bib.html`, `tools/csl_bib.py`). Notes starting "TODO" or
|
||||||
|
"placeholder" stay out of the published list.
|
||||||
|
- **Zotero:** `tools/zotero_import_csl.py` in madmode-blog imports the
|
||||||
|
sidecar into a collection named for the post (precedent: fs86,
|
||||||
|
ai-scrape26). The public library syncs, so importing is publishing.
|
||||||
|
Follow the library's existing conventions for each item type; RFCs, for
|
||||||
|
example, are reports with type "Request for Comments" and institution
|
||||||
|
"Internet Engineering Task Force", so the IETF RFCs saved search
|
||||||
|
finds them.
|
||||||
|
- **Links the fetcher can't read** (403, bot wall, JS-only): mark them 🙋
|
||||||
|
in the draft with the link; the author fetches the page by hand and
|
||||||
|
saves a Zotero snapshot, which can then be read from `~/Zotero/storage`.
|
||||||
|
- **Keep a copy of anything you quote, starting with the first fetch.**
|
||||||
|
Checking exact wording later means fetching again, and fetches fail:
|
||||||
|
PDFs come back as undecodable bytes, sites return 202 or 403. Save the
|
||||||
|
fetched file (e.g. under `.tmp/snapshots/`) and queue it for the author
|
||||||
|
in a 🙋 checklist (`<name> - snapshots.md`) with each source's link and
|
||||||
|
the words quoted from it. The author, acting as a human HTTP proxy,
|
||||||
|
attaches it in Zotero or saves a snapshot. Agents can't attach files to
|
||||||
|
existing Zotero items without a local API key.
|
||||||
|
|
||||||
## Search hygiene
|
## Search hygiene
|
||||||
|
|
||||||
If you are the one asserting a fact, do a quick search before stating it as
|
If you are the one asserting a fact, do a quick search before stating it as
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
name: hypertext-links
|
name: hypertext-links
|
||||||
description: Writing style for links in markdown docs — use when writing or reviewing any doc with URLs to external pages, repo files, or intra-repo documents; enforces descriptive link text over bare/generic links.
|
description: Writing style for links in markdown docs and chat (Discord supports `[text](<url>)`) — use when writing or reviewing any doc or Discord message with URLs to external pages, repo files, or intra-repo documents; enforces descriptive link text over bare/generic links.
|
||||||
---
|
---
|
||||||
|
|
||||||
# Hypertext Links
|
# Hypertext Links
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: no-ambient-authority
|
name: no-ambient-authority
|
||||||
description: >-
|
description: >-
|
||||||
Use when writing or reviewing code whose functions touch I/O, clocks, random number generators, process.env, fetch, or filesystem; when someone says "ambient authority", "wash your mouth out", or "that function shouldn't reach for that"; when debating dependency injection or default-arg seams; when asked what OCap discipline is. Source: the Agoric wiki's OCap Discipline page.
|
Use when writing or reviewing code whose functions touch I/O, clocks, random number generators, process.env, fetch, or filesystem; before writing or refactoring any Python script (DisciplinedPython style guide and checker); when someone says "ambient authority", "wash your mouth out", or "that function shouldn't reach for that"; when debating dependency injection or default-arg seams; when asked what OCap discipline is. Source: the Agoric wiki's OCap Discipline page.
|
||||||
---
|
---
|
||||||
|
|
||||||
# OCap Discipline
|
# OCap Discipline
|
||||||
@@ -42,6 +42,30 @@ capability-based languages, systems, papers, and talks.
|
|||||||
authority they need, then *delegate* it downward.
|
authority they need, then *delegate* it downward.
|
||||||
3. **Test scripts** are named `test-*.js`; tests export nothing.
|
3. **Test scripts** are named `test-*.js`; tests export nothing.
|
||||||
|
|
||||||
|
## Python: DisciplinedPython
|
||||||
|
|
||||||
|
For Python, the rules above are spelled out in the DisciplinedPython style
|
||||||
|
guide in awesome-ocap (local checkout `~/projects/awesome-ocap`). Read it
|
||||||
|
before writing or refactoring a Python script; don't invent conventions.
|
||||||
|
|
||||||
|
- [ocap-py-style-guide.md](https://codeberg.org/dckc/awesome-ocap/src/branch/master/style-guide/ocap-py-style-guide.md):
|
||||||
|
the script recipe (`main(...)` plus `_script_io()` under the `__main__`
|
||||||
|
guard, authorities passed by name), standard authority names (`argv`,
|
||||||
|
`cwd`, `stdout`, `connect`, `run`, `urlopen`, `now`), prompt attenuation
|
||||||
|
in `main`, and **status goes through `logging.info(...)` directly**: not
|
||||||
|
`print`, not `stderr` writes, not an injected logger.
|
||||||
|
- [disciplined-python-attenuation.md](https://codeberg.org/dckc/awesome-ocap/src/branch/master/style-guide/disciplined-python-attenuation.md):
|
||||||
|
narrowing authority function by function.
|
||||||
|
- Checker: run `~/projects/awesome-ocap/tools/disciplined_python_check.py path/to/script.py`
|
||||||
|
and treat each finding as a bug. It points at matching before/after
|
||||||
|
examples in `tests/fixtures/disciplined_python/{errors,fixed}/`.
|
||||||
|
- Calibration: Python can't enforce a capability boundary (name mangling
|
||||||
|
and introspection get around any wrapper), so for a small script,
|
||||||
|
attenuation that lives mostly in names is fine. An example: a read-only
|
||||||
|
library view whose path object could still POST. GET-only is ideal;
|
||||||
|
note the gap honestly and move on. Robustness against adversaries
|
||||||
|
means leaving Python (e.g. for Hardened JavaScript).
|
||||||
|
|
||||||
## how this shows up in review
|
## how this shows up in review
|
||||||
|
|
||||||
- `crypto.getRandomValues()` called inside an exported function →
|
- `crypto.getRandomValues()` called inside an exported function →
|
||||||
|
|||||||
@@ -0,0 +1,59 @@
|
|||||||
|
---
|
||||||
|
name: pola
|
||||||
|
description: >-
|
||||||
|
Principle of Least Authority as the way to organize all code: trace the flow of authority, give each component only what its task needs, design APIs around attenuation. Use when writing or reviewing any code, tests included: makers and their parameters, module imports and exports, which objects share a scope, what a facet exposes; when someone says "POLA", "least authority", "who can reach that?", "Bob shouldn't see Alice's purse", or "makeFoo-style actors". The table stakes (no clocks, fetch, or env reached for inside logic) are no-ambient-authority; this is the organizing principle on top.
|
||||||
|
---
|
||||||
|
|
||||||
|
# POLA: organize code by the flow of authority
|
||||||
|
|
||||||
|
Mark Miller, [SOSP 50th anniversary panel](https://www.youtube.com/watch?v=br9DwtjqmVI) (3 min):
|
||||||
|
|
||||||
|
> we design abstraction boundaries so that a component's interface only requires arguments that are somehow relevant to its task. If such argument passing were the only source of authority, we would have taken a huge step towards least authority.
|
||||||
|
|
||||||
|
Every reference to anything but immutable data is authority: a purse is the right to spend some assets; a mint, the right to create them; a seat, the right to take part in one deal; a DB handle, every row. Ask of every reference: who holds it, who gave it to them, and does their task need all of it?
|
||||||
|
|
||||||
|
## Recursively, at every level
|
||||||
|
|
||||||
|
[Navigating the Attack Surface](https://www.youtube.com/watch?v=wW9-KuezPp8) (15 min): the same move repeats at each level of composition (OS accounts, apps, modules, objects), and the benefit multiplies, like a Menger sponge. CapMail's main module "receives all of that authority … wiring them together, subdividing the authority … and handing it out piecemeal … written knowing that the address book does not need access to the PGP keyring, so the main module simply doesn't give it that access."
|
||||||
|
|
||||||
|
So at each level, code has two roles:
|
||||||
|
|
||||||
|
- **A wiring layer** (entry point, `main`, test setup, a maker) holds a lot of authority, and its job is to split it and hand out pieces. Keep it small and obvious: it is the TCB at its level.
|
||||||
|
- **Everything else** gets only the pieces its task needs, as arguments, and can't reach more.
|
||||||
|
|
||||||
|
## In practice
|
||||||
|
|
||||||
|
- **Makers take only what their task needs.** `makeAlice({ usdcPurse, stockDepositFacet })`, not `makeAlice({ ledger })`.
|
||||||
|
- **Attenuate at API boundaries.** Hand out the narrowest facet that works: a deposit facet rather than the purse; a seat rather than the escrow's admin; a read-only view rather than the DB. When designing an API, decide which facets it has and who should get each.
|
||||||
|
- **Separate parties get separate scopes.** If two parties' authority shares a scope, a bug or a careless line lets one act as the other. A scope holding both Alice's and Bob's purses is a design error.
|
||||||
|
- **Tests too.** Tests are where the code's intended authority flow is first written down. Write each party as a `makeFoo`-style actor holding its own authority privately; the test's top level is the wiring layer that creates the parties and introduces them ([sequence-diagram-actor-sim](https://github.com/Agoric/agoric-sdk/blob/master/.agents/skills/sequence-diagram-actor-sim/SKILL.md)).
|
||||||
|
- **The test takes the spontaneous step; actors carry out the consequences.** Give an actor what it knows at construction and let it decide how to act: `alice.run()`, or `alice.tradeWith(bob)` to introduce a counterparty. Don't drive it with arguments that decide for it, like `alice.pay(to, amount)`: that is the test acting with Alice's authority, as if it held her purse. What an actor hands others (a deposit facet, a shop) carries no authority to spend for it.
|
||||||
|
- **Modules decide what authority enters through imports and leaves through exports.** Export makers, not instances that close over power ([no-ambient-authority](../no-ambient-authority/SKILL.md)).
|
||||||
|
|
||||||
|
```ts
|
||||||
|
// wrong: one scope holds everyone's purses; Bob's code could spend Alice's
|
||||||
|
const alice = { usdc: await E(usdc.issuer).makeEmptyPurse(), ... };
|
||||||
|
const bob = { usdc: await E(usdc.issuer).makeEmptyPurse(), ... };
|
||||||
|
await E(seatB).offer(await E(bob.stock).withdraw(shares(3n)), ...);
|
||||||
|
|
||||||
|
// right: each party holds its own; the test wires, drives, and observes
|
||||||
|
const makeAlice = async ({ usdcIssuer, stockIssuer, dollars }) => {
|
||||||
|
const usdc = await E(usdcIssuer).makeEmptyPurse(); // Alice's alone
|
||||||
|
...
|
||||||
|
return harden({
|
||||||
|
// Alice decides what to pay; Bob shows only his shop
|
||||||
|
tradeWith: async bob => E(bob.shop).sell(await E(usdc).withdraw(price), ...),
|
||||||
|
getBalances,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
await alice.tradeWith(bob); // the one spontaneous step
|
||||||
|
```
|
||||||
|
|
||||||
|
## Review checklist
|
||||||
|
|
||||||
|
Before committing, for each new maker, scope, and export:
|
||||||
|
|
||||||
|
1. Draw (in your head or as a [wiring-diagram](../wiring-diagram/SKILL.md)) who holds what after this change.
|
||||||
|
2. Does any non-wiring scope hold two parties' authority, or more than its task needs?
|
||||||
|
3. Could a narrower facet replace what's passed? Does any facet let a caller spend for its owner, or does the test decide what an actor does?
|
||||||
|
4. Name the wiring layer at this level. Is it small?
|
||||||
+42
-3
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
name: wiring-diagram
|
name: wiring-diagram
|
||||||
description: >-
|
description: >-
|
||||||
Capability wiring diagram, "who holds what" — use when asked for a wiring diagram, a picture of who holds what, a capability diagram, or "a diagram like the cookie-rotation one"; when reviewing a design for POLA and wanting to see the reference graph. MarkM ERTP-slide style: actors are balls, makers pale regions, objects rounded squares, state ledger tables, references dot-to-arrowhead; HTML/SVG plus a headless-Chromium PNG. Not for message order over time: that's a sequence diagram (sequence-diagram-actor-sim in agoric-sdk).
|
Capability wiring diagram, "who holds what" — use when asked for a wiring diagram, a picture of who holds what, a capability diagram, "a diagram like the cookie-rotation one", or an "algorithm animation" stepping a diagram through state changes (create, checkpoint, crash, revive); when reviewing a design for POLA and wanting to see the reference graph. MarkM ERTP-slide style: actors are balls, makers pale regions, objects rounded squares, state ledger tables, references dot-to-arrowhead; HTML/SVG plus a headless-Chromium PNG. Not for message order over time: that's a sequence diagram (sequence-diagram-actor-sim in agoric-sdk).
|
||||||
---
|
---
|
||||||
|
|
||||||
# Capability wiring diagram
|
# Capability wiring diagram
|
||||||
@@ -19,9 +19,12 @@ Exemplars:
|
|||||||
(+ `.png`): the original.
|
(+ `.png`): the original.
|
||||||
- `~/qtrx/packages/umb-download/docs/wiring.html` (+ `.png`): three
|
- `~/qtrx/packages/umb-download/docs/wiring.html` (+ `.png`): three
|
||||||
makers, two outside parties, and an adversary holding a webkey.
|
makers, two outside parties, and an adversary holding a webkey.
|
||||||
|
- `~/oros-bots/capsite-toybox-kernel/docs/sugarmint-sturdyrefs.html`: a step-through (see below) of E's sugarMint making sturdyrefs, crashing, and reviving. Nested panes, facets on shared state, weak tables, cross-vat proxies.
|
||||||
|
|
||||||
Start from [`template.html`](template.html), next to this file. It has
|
Start from [`template.html`](template.html), next to this file. It has
|
||||||
the drawing helpers and a small example scene to replace.
|
the drawing helpers and a small example scene to replace. For a step-through, start from the sugarMint page instead.
|
||||||
|
|
||||||
|
The deliverable is a local HTML file in the repo's `docs/`, like the exemplars, not a claude.ai artifact, unless asked.
|
||||||
|
|
||||||
## Read the graph from the code, not the story
|
## Read the graph from the code, not the story
|
||||||
|
|
||||||
@@ -37,6 +40,25 @@ that mints an instance, hands its id to one holder and forgets it).
|
|||||||
That's often the point of the design. Say so in a caption, or just
|
That's often the point of the design. Say so in a caption, or just
|
||||||
leave the arrow out.
|
leave the arrow out.
|
||||||
|
|
||||||
|
Read each object's fields before you characterize it. E's SturdyRef looks like plain data (vatID, swiss number) but also holds a LocatorUnum presence, which is its lookup authority. A table keyed by data can't be weak-keyed: say which side is weak (E's swissTable is a WeakValueMap) and draw the weak arrow dashed.
|
||||||
|
|
||||||
|
When a frame claims something surprising (balances don't survive a revival), cite the line that proves it, and keep what the code shows apart from what you infer. If the code is lost, say so and draw no arrows into it.
|
||||||
|
|
||||||
|
## Multiplicity: one pane per maker call
|
||||||
|
|
||||||
|
In MarkM's makeMint slide, each stacked pane is one call to `makeMint`, and inside it is what that one call made: one issuer, mint, brand and ledger, and a stack of purses because `makePurse` runs many times per mint. For each box, ask: *a new one per what call?*
|
||||||
|
|
||||||
|
- Stack a box only when its scope makes many of them. `store.readOnly()` returns the same object every time, so readOnly is 1:1 with its store and not stacked.
|
||||||
|
- Put state where the code keeps it. If one Durable Object holds many stores in one kv, the kv is one table in the DO's pane (like makeMint's ledger), not one per store.
|
||||||
|
- Name a pane by the real maker (the class or function in the code), not an invented `makeFoo`.
|
||||||
|
- Nested scopes nest panes: issuer ⊃ account ⊃ hold.
|
||||||
|
- Facets that close over shared state go in one pane for the record, each facet a box, with arrows to a shared state table (an ERTP mint/issuer/brand, an account and its revoker).
|
||||||
|
- A stack can be over time: one vat pane per incarnation.
|
||||||
|
|
||||||
|
## Between vats
|
||||||
|
|
||||||
|
A reference to an object in another vat is a proxy in the holder's vat that forwards over CapTP (or Cap'n Web). Draw the holder's vat as a small pane with the proxy in it, and the arrow from the proxy onward. That proxy is where a crash shows up as a broken reference.
|
||||||
|
|
||||||
## Vocabulary
|
## Vocabulary
|
||||||
|
|
||||||
| element | helper | means |
|
| element | helper | means |
|
||||||
@@ -75,6 +97,17 @@ argument, and Mallory makes them visible.
|
|||||||
clears tables and objects. The control point is the midpoint offset
|
clears tables and objects. The control point is the midpoint offset
|
||||||
by `bend × (−dy, dx)`.
|
by `bend × (−dy, dx)`.
|
||||||
|
|
||||||
|
## Step-through (algorithm animation)
|
||||||
|
|
||||||
|
When the story is a sequence of state changes (create, checkpoint, crash, revive), keep one fixed layout and step through frames, like slides:
|
||||||
|
|
||||||
|
- Each frame is one message. The bubble shows it, with its tail at the sender; a step internal to some object gets a dashed bubble with no tail.
|
||||||
|
- Orange marks what that message changed: new objects and tables get a halo, new rows a fill, new references an orange arrow.
|
||||||
|
- Below the picture: a short heading, a sentence saying what the message did and why, and a cite line (`file:line`).
|
||||||
|
- Dead things fade (opacity 0.25); broken references are red, dashed, with a ✕.
|
||||||
|
- Controls: Prev/Next, arrow keys, a slider, and `#sN` deep links.
|
||||||
|
- In code, name frames (`F.save`, `F.revive`) and derive visibility from them (`on(F.sturdy, F.rebuild)`, `fresh(F.save)`), so inserting a frame doesn't shift every index.
|
||||||
|
|
||||||
## Accessibility
|
## Accessibility
|
||||||
|
|
||||||
Keep `<title>` short. Write `<desc>` as prose that names every actor and
|
Keep `<title>` short. Write `<desc>` as prose that names every actor and
|
||||||
@@ -99,6 +132,10 @@ arrows through tables, text clipped at the bottom. Expect two or three
|
|||||||
rounds. Commit the HTML (source) and the PNG separately, so the source
|
rounds. Commit the HTML (source) and the PNG separately, so the source
|
||||||
diff stays readable.
|
diff stays readable.
|
||||||
|
|
||||||
|
QA screenshots in a scratch directory are fine at any point; add `--force-prefers-reduced-motion` so highlights aren't caught mid-fade. Don't make PNG deliverables until the user confirms the diagram is right. A step-through gets no PNG unless asked.
|
||||||
|
|
||||||
|
If arrowheads vanish, look for an id collision: SVG marker ids share the page's id namespace, and an `<h2 id="head">` once hijacked `url(#head)`. The template's marker is `arrow`.
|
||||||
|
|
||||||
## Review checklist
|
## Review checklist
|
||||||
|
|
||||||
- Does every arrow cite something in the code? Is any real reference
|
- Does every arrow cite something in the code? Is any real reference
|
||||||
@@ -106,7 +143,9 @@ diff stays readable.
|
|||||||
- Does each actor hold only what its job needs (POLA)? If the picture
|
- Does each actor hold only what its job needs (POLA)? If the picture
|
||||||
shows an actor holding more, that's a finding about the design, not a
|
shows an actor holding more, that's a finding about the design, not a
|
||||||
drawing problem.
|
drawing problem.
|
||||||
- Are facets drawn apart where they differ in authority?
|
- Are facets drawn apart where they differ in authority, and pointed at shared state where they share it?
|
||||||
|
- For each stacked box: is a new one really made per instance? For each unstacked box: is there really only one?
|
||||||
|
- Do references into another vat go through a proxy in the holder's vat?
|
||||||
- Does the adversary's caption match what the arrows show?
|
- Does the adversary's caption match what the arrows show?
|
||||||
- Does `<desc>` tell the same story in prose?
|
- Does `<desc>` tell the same story in prose?
|
||||||
- Is any secret value drawn? Elide values (`session=…`, `{…}`): the
|
- Is any secret value drawn? Elide values (`session=…`, `{…}`): the
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ adversary can and cannot reach.</desc>
|
|||||||
<stop offset="0%" stop-color="#6cbcf4"/>
|
<stop offset="0%" stop-color="#6cbcf4"/>
|
||||||
<stop offset="100%" stop-color="#4aa8ec"/>
|
<stop offset="100%" stop-color="#4aa8ec"/>
|
||||||
</linearGradient>
|
</linearGradient>
|
||||||
<marker id="head" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" orient="auto-start-reverse">
|
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="9" markerHeight="9" orient="auto-start-reverse">
|
||||||
<path d="M0,0 L10,5 L0,10 z" fill="#1d4f7a"/>
|
<path d="M0,0 L10,5 L0,10 z" fill="#1d4f7a"/>
|
||||||
</marker>
|
</marker>
|
||||||
</defs>
|
</defs>
|
||||||
@@ -54,7 +54,7 @@ const dot = (x, y) => el("circle", { cx: x, cy: y, r: 4.5, fill: INK });
|
|||||||
const ref = (x1, y1, x2, y2, bend = 0, extra = {}) => {
|
const ref = (x1, y1, x2, y2, bend = 0, extra = {}) => {
|
||||||
dot(x1, y1);
|
dot(x1, y1);
|
||||||
const mx = (x1 + x2) / 2 - (y2 - y1) * bend, my = (y1 + y2) / 2 + (x2 - x1) * bend;
|
const mx = (x1 + x2) / 2 - (y2 - y1) * bend, my = (y1 + y2) / 2 + (x2 - x1) * bend;
|
||||||
el("path", { d: `M${x1},${y1} Q${mx},${my} ${x2},${y2}`, fill: "none", stroke: INK, "stroke-width": 2, "marker-end": "url(#head)", ...extra });
|
el("path", { d: `M${x1},${y1} Q${mx},${my} ${x2},${y2}`, fill: "none", stroke: INK, "stroke-width": 2, "marker-end": "url(#arrow)", ...extra });
|
||||||
};
|
};
|
||||||
|
|
||||||
// maker box: a pale rounded region, with stacked instances inside
|
// maker box: a pale rounded region, with stacked instances inside
|
||||||
|
|||||||
Reference in new issue
Block a user