yamlover 0.3.25 → 0.3.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -21
- package/bin/ga4.js +77 -0
- package/bin/yamlover.js +70 -24
- package/dist/agent-docs/AGENTS.md +109 -48
- package/dist/agent-docs/CLAUDE.md +1 -1
- package/dist/builtin-taxonomy/$defs/{.yamlover/meta.yamlover → .yo/meta.yo} +6 -0
- package/dist/builtin-taxonomy/$defs/board +1 -1
- package/dist/builtin-taxonomy/$defs/bullets +12 -0
- package/dist/builtin-taxonomy/$defs/chapter +20 -15
- package/dist/builtin-taxonomy/$defs/chunk +1 -1
- package/dist/builtin-taxonomy/$defs/config +1 -1
- package/dist/builtin-taxonomy/$defs/numbered +12 -0
- package/dist/builtin-taxonomy/$defs/table +17 -10
- package/dist/builtin-taxonomy/$defs/task +4 -3
- package/dist/builtin-taxonomy/tags/{.yamlover/body.yamlover → .yo/body.yo} +1 -1
- package/dist/client/assets/decoded-D_YQdg1-.js +1 -0
- package/dist/client/assets/djvu-Di4fPA-J.js +1 -0
- package/dist/client/assets/{docx-C3gzsgKj.js → docx-BSduN32X.js} +1 -1
- package/dist/client/assets/{heic-CZ82O7cO.js → heic-DOAG7EsW.js} +2 -2
- package/dist/client/assets/imagemap-B8RthxNE.js +1 -0
- package/dist/client/assets/index-Bf2L7I9e.js +752 -0
- package/dist/client/assets/index-N41EyNG2.css +1 -0
- package/dist/client/assets/map-Cf7ar1_U.js +1 -0
- package/dist/client/assets/openable-CCBlc-Ws.js +4 -0
- package/dist/client/assets/paged-bLurvatj.js +1 -0
- package/dist/client/assets/{pdf-DYI9E6LP.js → pdf-D1ox8M9A.js} +5 -5
- package/dist/client/assets/psd-AT50x-YR.js +11 -0
- package/dist/client/assets/{spreadsheet-DQ1DIIfm.js → spreadsheet-DeQh5CNF.js} +1 -1
- package/dist/client/assets/tiff-B3-awhzQ.js +1 -0
- package/dist/client/assets/xyflow-BnuhLJ6X.css +1 -0
- package/dist/client/assets/xyflow-DuQ4jjaq.js +23 -0
- package/dist/client/index.html +6 -2
- package/dist/client/yo-favicon.svg +16 -0
- package/dist/server.js +4013 -1300
- package/package.json +12 -4
- package/dist/client/assets/decoded-BfD5vW9k.js +0 -1
- package/dist/client/assets/djvu-DNElocuz.js +0 -1
- package/dist/client/assets/imagemap-B0by6U04.js +0 -1
- package/dist/client/assets/index-C3Raqez8.css +0 -1
- package/dist/client/assets/index-DHpG_wBG.js +0 -665
- package/dist/client/assets/map-Byy6U5tc.js +0 -1
- package/dist/client/assets/openable-d9huG_69.js +0 -4
- package/dist/client/assets/paged-DFA2Muzj.js +0 -1
- package/dist/client/assets/psd-CmNn7r6o.js +0 -11
- package/dist/client/assets/tiff-BoTWsGfS.js +0 -1
|
@@ -6,9 +6,10 @@ yamlover web UI (`npx yamlover .`) while you read and edit the files on disk. Th
|
|
|
6
6
|
tells you how to manipulate these files **correctly** so you don't corrupt the data or break the
|
|
7
7
|
human's live view.
|
|
8
8
|
|
|
9
|
-
> This file is self-contained. You do **not** need any other spec to follow it.
|
|
10
|
-
>
|
|
11
|
-
>
|
|
9
|
+
> This file is self-contained. You do **not** need any other spec to follow it. The full,
|
|
10
|
+
> authoritative spec is the yamlover documentation book (the `docs/` tree of the yamlover
|
|
11
|
+
> project itself — the language under `docs/language/`, the document model under
|
|
12
|
+
> `docs/documents/`); consult it for edge cases.
|
|
12
13
|
|
|
13
14
|
---
|
|
14
15
|
|
|
@@ -19,13 +20,13 @@ yamlover is a **distinct, YAML-like language** — close to YAML and mostly read
|
|
|
19
20
|
document that uses aliases/anchors does **not** round-trip identically. On top of a YAML-style
|
|
20
21
|
surface it adds a small **pointer layer** so that data forms a graph, not just a tree:
|
|
21
22
|
|
|
22
|
-
- **`*` pointers** — a value that *refers to* another node (a
|
|
23
|
+
- **`*` pointers** — a value that *refers to* another node (a ref edge, not a copy).
|
|
23
24
|
- **`&` path anchors** — declare that "this node also lives over there" (the push side of `*`).
|
|
24
25
|
- **`!!` tags** — type/schema markers, including inline schema references `!!<…>`.
|
|
25
26
|
|
|
26
27
|
There is a sibling brace surface called **json5p** (`.json5p` files) — the same pointer layer
|
|
27
|
-
expressed in JSON5 syntax. Most projects use `.
|
|
28
|
-
twin (pointers are written as quoted strings, e.g. `*": pets
|
|
28
|
+
expressed in JSON5 syntax. Most projects use `.yo`; treat `.json5p` as the JSON-flavored
|
|
29
|
+
twin (pointers are written as quoted strings, e.g. `*": pets: 1"`).
|
|
29
30
|
|
|
30
31
|
**Important:** because `*` and `&` mean something different than in stock YAML (a `*` is a path
|
|
31
32
|
pointer, **not** a YAML alias), these files require the yamlover parser. Do not "fix" them with
|
|
@@ -37,29 +38,30 @@ a generic YAML formatter — you will destroy the pointers and anchors.
|
|
|
37
38
|
|
|
38
39
|
Plain YAML forces a node to be **either** a sequence (all `- item`) **or** a mapping (all
|
|
39
40
|
`key: value`). yamlover unifies them: there is **one ordered container**. Every entry has an
|
|
40
|
-
integer **position** (
|
|
41
|
+
integer **position** (0, 1, …) and **may also** carry a string key. Keyless (positional)
|
|
41
42
|
and keyed entries coexist in one node — this is the default ("omni"):
|
|
42
43
|
|
|
43
44
|
```yamlover
|
|
44
45
|
playlist:
|
|
45
|
-
- Intro #
|
|
46
|
-
- Verse #
|
|
47
|
-
title: Greatest Hits #
|
|
48
|
-
- Chorus #
|
|
49
|
-
encore: *: pets
|
|
46
|
+
- Intro # position 0 keyless / positional
|
|
47
|
+
- Verse # position 1 keyless
|
|
48
|
+
title: Greatest Hits # position 2, key=title keyed — AND still positioned
|
|
49
|
+
- Chorus # position 3 keyless
|
|
50
|
+
encore: *: pets: 0 # position 4, key=encore a keyed pointer, still in order
|
|
50
51
|
```
|
|
51
52
|
|
|
52
53
|
A node can even carry a **scalar value AND fields at once**:
|
|
53
54
|
|
|
54
55
|
```yamlover
|
|
55
56
|
rating: 5 # the node's own scalar value …
|
|
56
|
-
- solid #
|
|
57
|
-
scale: 10 #
|
|
57
|
+
- solid # position 0 positional field
|
|
58
|
+
scale: 10 # position 2 keyed field
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
(You may see optional `!!mix`
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
(You may see an optional `!!mix` tag marking these shapes. It is a **no-op readability marker**
|
|
62
|
+
— mixing and scalar-plus-fields are the default. Don't add or remove it to change meaning; it
|
|
63
|
+
doesn't carry any. `!!yo` — whose deprecated aliases `!!var` / `!!omni` still parse — is a
|
|
64
|
+
DIFFERENT thing and is **semantic**: see §6.)
|
|
63
65
|
|
|
64
66
|
---
|
|
65
67
|
|
|
@@ -70,8 +72,8 @@ key c". Canonical style writes `: ` (colon + space) after each step; a colon wit
|
|
|
70
72
|
also parses.
|
|
71
73
|
|
|
72
74
|
`/` is an **ordinary character** now — MIME-type keys (`text/html`), date keys (`01/02/2026`)
|
|
73
|
-
and URL-ish keys ride bare in a path. (
|
|
74
|
-
|
|
75
|
+
and URL-ish keys ride bare in a path. (The old `/`-separator form is DEAD — it no longer
|
|
76
|
+
parses as a path: `*/pets` is a dangling reference to the literal key "/pets". Author `:` only.)
|
|
75
77
|
|
|
76
78
|
### The scope ladder — more colons, wider scope
|
|
77
79
|
|
|
@@ -82,26 +84,45 @@ current: object: path # bare — current scope (si
|
|
|
82
84
|
::: yamlover.inthemoon.net: $defs: tag # ::: — the world (an external project)
|
|
83
85
|
```
|
|
84
86
|
|
|
85
|
-
- `*pets
|
|
86
|
-
- `*: pets
|
|
87
|
+
- `*pets: 1` — bare: a **sibling** named `pets`, position 1.
|
|
88
|
+
- `*: pets: 0` — `:` document root.
|
|
87
89
|
- `*:: tags: genre` — `::` this project's root.
|
|
88
90
|
- `*::: host.example: $defs: tag` — `:::` a world/external reference.
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
+
### The bare-token rule — what a portion means
|
|
93
|
+
|
|
94
|
+
Every portion is typed **by its own form**:
|
|
95
|
+
|
|
96
|
+
- **pure digits** = the integer key, i.e. a **position**: `*: pets: 1: name` = root → position 1
|
|
97
|
+
→ key `name`.
|
|
98
|
+
- **a bare `~`** = the **null key** (`~: value`; `: v` is the same entry). The *string* key
|
|
99
|
+
`"null"` is written `null:`.
|
|
100
|
+
- **anything else bare, and any quoted portion** = a **string key**: `: '1'` is the numeric
|
|
101
|
+
string key, `: '~'` the literal tilde.
|
|
102
|
+
|
|
103
|
+
A key whose bare form would read as something else MUST be quoted: empty, pure digits, `~`,
|
|
104
|
+
`-`+digits, or a key containing a space. In a document, a plain `1:` is a **parse error** —
|
|
105
|
+
author `'1':` for the numeric string key.
|
|
106
|
+
|
|
107
|
+
> **The retired bracket index.** The old `[n]` position form (`*pets[1]`) still *reads* — it is
|
|
108
|
+
> a permanent alias — but it is **written never**. Author the bare-integer segment. The one
|
|
109
|
+
> surviving bracket operator is `[.±k]` (a position relative to the pointer's own host). The
|
|
110
|
+
> former `[]` (append) and `[?]` (any position) brackets were REMOVED — both are now the `-`
|
|
111
|
+
> segment: a trailing `: -` on a bookmark appends (§5), and `-` in a query matches any
|
|
112
|
+
> position. A literal `-` key must be quoted (`'-'`).
|
|
92
113
|
|
|
93
114
|
---
|
|
94
115
|
|
|
95
116
|
## 4. Pointers `*` (the pull side)
|
|
96
117
|
|
|
97
|
-
A `*` value dereferences a path to another node and creates a **
|
|
118
|
+
A `*` value dereferences a path to another node and creates a **ref edge** (not a copy):
|
|
98
119
|
|
|
99
120
|
```yamlover
|
|
100
121
|
humans:
|
|
101
122
|
- name: Alice
|
|
102
|
-
manager: *: pets
|
|
103
|
-
feline: *pets
|
|
104
|
-
topDog: *: pets
|
|
123
|
+
manager: *: pets: 1 # Alice.manager IS the node at root → pets → position 1
|
|
124
|
+
feline: *pets: 1 # bare → a sibling
|
|
125
|
+
topDog: *: pets: 0 # : → document root
|
|
105
126
|
```
|
|
106
127
|
|
|
107
128
|
Pointers are **lazy** and **cycle-safe** — pointing two nodes at each other is fine. Editing the
|
|
@@ -118,7 +139,7 @@ target changes everything that points at it.
|
|
|
118
139
|
boss: &: chief # this node is ALSO reachable as the document-root key `chief`
|
|
119
140
|
name: Rex
|
|
120
141
|
team:
|
|
121
|
-
lead: *: chief # same node as `boss` — a
|
|
142
|
+
lead: *: chief # same node as `boss` — a ref edge, not a copy
|
|
122
143
|
```
|
|
123
144
|
|
|
124
145
|
Reverse relations are spelled as anchors. `&: parent: child` means "parent holds me as child":
|
|
@@ -129,17 +150,20 @@ adam:
|
|
|
129
150
|
&: eve: cain # "eve holds me as cain" — the reverse of eve's cain-edge
|
|
130
151
|
```
|
|
131
152
|
|
|
132
|
-
`&: container
|
|
153
|
+
`&: container: -` (a trailing `-` segment) means **positional membership**: "that container also
|
|
133
154
|
holds me", appended after the container's own entries:
|
|
134
155
|
|
|
135
156
|
```yamlover
|
|
136
157
|
fan:
|
|
137
158
|
name: Bob
|
|
138
|
-
&: favorites
|
|
159
|
+
&: favorites: - # Bob appends himself to `favorites`
|
|
139
160
|
```
|
|
140
161
|
|
|
141
|
-
Anchor paths must be **unambiguous** (no wildcards, no trailing
|
|
142
|
-
create real keys, so they must resolve to exactly one
|
|
162
|
+
Anchor paths must be **unambiguous** (no wildcards, no trailing position claim — neither a bare
|
|
163
|
+
integer nor a relative `[.±k]`) — they create real keys, so they must resolve to exactly one
|
|
164
|
+
place. The trailing `-` is an append, not a claim; a `-` anywhere else in an anchor path is
|
|
165
|
+
reserved (a parse error today). The old `&: container[]` bracket spelling was removed and no
|
|
166
|
+
longer parses.
|
|
143
167
|
|
|
144
168
|
> You may encounter the older `~key: *path` back-edge syntax in legacy files. It still parses but
|
|
145
169
|
> is deprecated; author new reverse edges as `&` anchors.
|
|
@@ -148,8 +172,13 @@ create real keys, so they must resolve to exactly one place.
|
|
|
148
172
|
|
|
149
173
|
## 6. Tags `!!` and `$defs` schemas
|
|
150
174
|
|
|
151
|
-
- `!!type` — a YAML-style tag.
|
|
152
|
-
|
|
175
|
+
- `!!type` — a YAML-style tag. `!!mix` is the one no-op marker (see §2). The rest are
|
|
176
|
+
**semantic** and must not be added or dropped casually:
|
|
177
|
+
- `!!set` marks a container whose membership is by identity (duplicates collapse);
|
|
178
|
+
- `!!yo` (deprecated aliases `!!var` / `!!omni`) marks a node as **plain yamlover, exempt
|
|
179
|
+
from the enclosing document's schema** — a *data island*. Inside a structured document (a
|
|
180
|
+
chapter, say) a `!!yo` node is never interpreted by that schema: it is data, drawn by the
|
|
181
|
+
generic renderer.
|
|
153
182
|
- **Inline schema reference** `!!<…>` binds a node to a reusable schema definition:
|
|
154
183
|
```yamlover
|
|
155
184
|
mychapter: !!<*:: yamlover: $defs: chapter>
|
|
@@ -165,17 +194,43 @@ create real keys, so they must resolve to exactly one place.
|
|
|
165
194
|
|
|
166
195
|
A node can be materialized two ways:
|
|
167
196
|
|
|
168
|
-
1. **Single-file concrete** — a whole document in one `.
|
|
197
|
+
1. **Single-file concrete** — a whole document in one `.yo` (or `.json5p`) file.
|
|
169
198
|
2. **Directory concrete** — a directory **is** the node; its files/subdirs are its entries, and
|
|
170
|
-
two optional overlay files inside a hidden `.
|
|
171
|
-
- `.
|
|
199
|
+
two optional overlay files inside a hidden `.yo/` subdir add data and schema:
|
|
200
|
+
- `.yo/body.yo` — **instance** overlay: scalar values, ordering, pointers,
|
|
172
201
|
extra keyed/keyless entries layered onto the directory's contents.
|
|
173
|
-
- `.
|
|
202
|
+
- `.yo/meta.yo` — **schema** overlay: typing, format, validation.
|
|
174
203
|
|
|
175
204
|
So to add a pointer or a value "to a folder", you edit (or create) that folder's
|
|
176
|
-
`.
|
|
205
|
+
`.yo/body.yo`. Plain files inside the directory are its members; a `.yo/`
|
|
177
206
|
subdir does not appear as a member — it's the overlay.
|
|
178
207
|
|
|
208
|
+
A pure pointer-array body (`- *file1` …) is the ORDER overlay: it grants positions to the
|
|
209
|
+
members it names (the projection shows each consumed key as a dimmed derived `&` anchor,
|
|
210
|
+
`- &file1 value`); a member the body never names stays keyed-only, after the ordered block.
|
|
211
|
+
Editing derives storage for NEW children by the INHERITANCE RULES (`concrete-rules.ts` — one
|
|
212
|
+
pure module, an explicit `concrete:` always wins): a directory-concrete parent keeps children
|
|
213
|
+
directory-concrete; a keyed container child becomes a nested real directory; an untagged
|
|
214
|
+
keyless (ordinal) container child becomes an order-numbered subdirectory (`item01`,
|
|
215
|
+
`item02`, …) referenced by a `- *: itemNN` pointer-array element; scalars and tagged containers
|
|
216
|
+
(tables, typographical lists) go inline into `body.yo`. Title-born subchapter members are
|
|
217
|
+
numbered too (`01-Введение`). The numbers are COSMETIC listing order — the body pointer-array is
|
|
218
|
+
the order's data, and an existing member is NEVER renamed: an insert between neighbors slots a
|
|
219
|
+
sub-number (`item01-1`, `01-1-Новая`). Content inside a file document speaks that file's
|
|
220
|
+
language (a `.json5p` interior never switches to yaml).
|
|
221
|
+
|
|
222
|
+
**Collapse / expand / promotion — the same node, two shapes.** The two concretes are
|
|
223
|
+
freely interconvertible without changing what the data means: a child stored as
|
|
224
|
+
`child.yo` (collapsed) and the same child stored as `child/` with a
|
|
225
|
+
`.yo/body.yo` (expanded) are equivalent. Converting a single-file node **into**
|
|
226
|
+
a directory is called **directory promotion** (the UI's action; the engine keeps inbound
|
|
227
|
+
pointers valid across it, like `mv`). If you do it by hand, it is a two-step move: create the
|
|
228
|
+
`child/` directory, move the file's contents into `child/.yo/body.yo` (plus any
|
|
229
|
+
members as files), and delete the old `child.yo` — then let the engine reindex. Because
|
|
230
|
+
it is a move, treat it with the same care as any rename: pointers that addressed the old file
|
|
231
|
+
path must still resolve (prefer the mediated `mv`/promotion in the UI, which rewrites them —
|
|
232
|
+
see §10).
|
|
233
|
+
|
|
179
234
|
---
|
|
180
235
|
|
|
181
236
|
## 8. Annotations & fragments (tags applied to content)
|
|
@@ -190,9 +245,12 @@ The human marks up documents in the UI. These live **on the target node**, not i
|
|
|
190
245
|
```yamlover
|
|
191
246
|
yamlover-annotations:
|
|
192
247
|
- *:: tags: genre: brevity # parameterless
|
|
193
|
-
- {description: A math block, tag: *:: tags: topic: math} # parametrized
|
|
248
|
+
- {description: 'A math block', tag: *:: tags: topic: math} # parametrized
|
|
194
249
|
```
|
|
195
250
|
|
|
251
|
+
(A flow scalar carrying a SPACE must be quoted — an unquoted `A math block` inside `{…}` is a
|
|
252
|
+
parse error.)
|
|
253
|
+
|
|
196
254
|
Prefer letting the human create these through the UI. If you must touch them by hand, keep the
|
|
197
255
|
exact key names (`yamlover-fragments`, `yamlover-annotations`) and the tag-pointer form, and do
|
|
198
256
|
not renumber or reorder fragment slugs.
|
|
@@ -227,10 +285,10 @@ pushes the change to the human's browser over a live event stream — so your ed
|
|
|
227
285
|
UI within a moment, and theirs appear to you on disk. Work with that, not against it:
|
|
228
286
|
|
|
229
287
|
- **Make small, valid saves.** A half-written file will reindex as broken. Prefer complete edits.
|
|
230
|
-
- **NEVER touch `.
|
|
288
|
+
- **NEVER touch `.yo/index.db`** (nor its `-wal` / `-shm` companions). It is the server's
|
|
231
289
|
generated SQLite index — it regenerates itself from the source files. Editing or deleting it
|
|
232
|
-
does nothing useful and can confuse a running server. It is the *only* thing in `.
|
|
233
|
-
you must not edit; `body.
|
|
290
|
+
does nothing useful and can confuse a running server. It is the *only* thing in `.yo/`
|
|
291
|
+
you must not edit; `body.yo` / `meta.yo` overlays (§7) are normal editable data.
|
|
234
292
|
- **Renames and moves break inbound pointers.** Other files may point at a node by its path
|
|
235
293
|
(`*: some: node`). If you move or rename it with a plain `mv`, those pointers dangle. The
|
|
236
294
|
running server exposes a **mediated move** (`POST /api/mv`) that surgically rewrites inbound
|
|
@@ -238,10 +296,11 @@ UI within a moment, and theirs appear to you on disk. Work with that, not agains
|
|
|
238
296
|
project for pointers to the old path (`*` followed by the path) and update them too.
|
|
239
297
|
- **Don't reformat with a generic YAML/JSON tool.** It will mangle `*`, `&`, `!!<…>`, the
|
|
240
298
|
colon paths, and the mixed keyed/keyless ordering. Edit the text directly and preserve style.
|
|
241
|
-
- **Settings live in `.
|
|
299
|
+
- **Settings live in `.yo/settings.yo`** at the project root (e.g. where new tags and
|
|
242
300
|
annotations are written). Treat it as configuration; change it only when asked.
|
|
243
301
|
- **When unsure of a path, query it.** The server answers `GET /api/query?...` using the path
|
|
244
|
-
grammar above, and serves the tree at `GET /api/tree` / a node at
|
|
302
|
+
grammar above, and serves the tree at `GET /api/tree` / a node's yamlover at
|
|
303
|
+
`GET /api/content/a/b` (slash-spelled path; digits are positions, `~` the null key).
|
|
245
304
|
Use these to confirm a path resolves before you author a pointer to it.
|
|
246
305
|
|
|
247
306
|
---
|
|
@@ -250,15 +309,17 @@ UI within a moment, and theirs appear to you on disk. Work with that, not agains
|
|
|
250
309
|
|
|
251
310
|
```yamlover
|
|
252
311
|
# pointers (pull) — colon paths, the scope ladder
|
|
253
|
-
sibling: *pets
|
|
254
|
-
rooted: *: humans
|
|
312
|
+
sibling: *pets: 1 # current scope, by position (bare digits = the position)
|
|
313
|
+
rooted: *: humans: 0: name # document root → position 0 → key name
|
|
314
|
+
strkey: *: counts: '1' # QUOTED digits = the numeric STRING key
|
|
315
|
+
nullkey: *: doc: ~ # the null key
|
|
255
316
|
projscope: *:: tags: genre # this project's root
|
|
256
317
|
world: *::: host.example: $defs: tag
|
|
257
318
|
|
|
258
319
|
# anchors (push) — "I also live there"; real keys; unambiguous only
|
|
259
320
|
here: &: chief # also at document-root key `chief`
|
|
260
321
|
rev: &: parent: child # parent holds me as `child`
|
|
261
|
-
mem: &: favorites
|
|
322
|
+
mem: &: favorites: - # appended member of `favorites`
|
|
262
323
|
|
|
263
324
|
# tags / schema
|
|
264
325
|
node: !!<*:: $defs: chapter> # bind a reusable schema
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
This is a **yamlover** project. The authoring rules, the pointer/anchor syntax, and the rules for
|
|
4
4
|
safely co-editing the tree while the yamlover web UI is running are in **`AGENTS.md`** — read it
|
|
5
|
-
before editing any `.
|
|
5
|
+
before editing any `.yo` / `.json5p` file.
|
|
6
6
|
|
|
7
7
|
@AGENTS.md
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# $defs/board — marks a DIRECTORY of tasks as an agile/kanban board. Attach it to the directory's
|
|
2
|
-
# `.
|
|
2
|
+
# `.yo/body.yo` overlay; the `workflow:` ref names which $defs/workflow supplies the
|
|
3
3
|
# lanes (its states, in order). The board renderer then groups the directory's task members into
|
|
4
4
|
# those lanes by each task's current state annotation, and a drag between lanes rewrites that
|
|
5
5
|
# annotation (re-tags the state). format `x-yamlover-board`. Attach with !!<*yamlover:$defs:board>.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# $defs/bullets — a typographical UNORDERED (bullet) list: an ordinary yamlover list whose
|
|
2
|
+
# keyless entries are the items. An item is marklower prose (a chunk) or — when it is an
|
|
3
|
+
# UNTAGGED container — a nested bullets list: unlike table's two-level budget, the list
|
|
4
|
+
# schema applies at ANY depth, until an explicit !!<…> tag switches to something else.
|
|
5
|
+
# A titled list is a chapter holding a list — no keyed properties here on purpose.
|
|
6
|
+
# Attach with !!<*yamlover: $defs: bullets>.
|
|
7
|
+
# No explicit `format:` — `type: variant` derives x-yamlover-bullets. Spec: docs/documents/marklower.
|
|
8
|
+
type: variant
|
|
9
|
+
items:
|
|
10
|
+
anyOf:
|
|
11
|
+
- *:: yamlover: $defs: bullets # an untagged container item = a nested sublist, SAME kind
|
|
12
|
+
- *:: yamlover: $defs: chunk # a list item — marklower prose
|
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
# $defs/chapter — a document node:
|
|
2
|
-
#
|
|
3
|
-
#
|
|
1
|
+
# $defs/chapter — a document node: a FULLY OMNI node. The node's own scalar SELF-VALUE is the
|
|
2
|
+
# TITLE — there is no `title:` key; `description` stays keyed; every keyless entry is a
|
|
3
|
+
# positional body element, read top to bottom: EITHER a nested chapter (the recursion) OR a
|
|
4
|
+
# chunk (a renderable block).
|
|
4
5
|
#
|
|
5
6
|
# There is no `chunks` array and no `children` array — prose, media, diagrams, and
|
|
6
7
|
# subchapters are siblings in ONE ordered stream. Attach it to a yamlover node with the
|
|
7
|
-
# tag !!<*yamlover/$defs/chapter>. Spec:
|
|
8
|
+
# tag !!<*yamlover/$defs/chapter>. Spec: docs/documents/chapter, docs/meta.
|
|
8
9
|
#
|
|
9
|
-
# `type: variant` is the omni node:
|
|
10
|
-
# elements (the body) at once. The body element type
|
|
11
|
-
# the two are told apart structurally (a chapter is a
|
|
12
|
-
#
|
|
13
|
-
#
|
|
10
|
+
# `type: variant` is the omni node: a scalar self-value (the title, given as `value:`) AND
|
|
11
|
+
# keyed fields (description) AND positional elements (the body) at once. The body element type
|
|
12
|
+
# is a union — a chapter OR a chunk; the two are told apart structurally (a chapter is a
|
|
13
|
+
# container, a chunk is a leaf). A BARE SCALAR body element is therefore both "a chunk" and
|
|
14
|
+
# "a title-only subchapter" — the same thing, by design (docs/documents/chapter).
|
|
15
|
+
# NOTE: `value` (scalar) + `properties` (keyed) + `items` (ordinal) is the JSON-Schema encoding
|
|
16
|
+
# of an omni node's facets; docs/meta proposes a native `elements`/`additionalElements`.
|
|
14
17
|
type: variant
|
|
18
|
+
value: # the self-value — the chapter's TITLE
|
|
19
|
+
type: string
|
|
20
|
+
format: text/marklower
|
|
15
21
|
properties:
|
|
16
|
-
|
|
17
|
-
type: string
|
|
18
|
-
format: text/marklower
|
|
19
|
-
description: # optional subtitle / heading annotation
|
|
22
|
+
description: # optional subtitle / heading annotation — stays keyed
|
|
20
23
|
type: string
|
|
21
24
|
format: text/marklower
|
|
22
25
|
items: # the body — a positional sequence, read top to bottom
|
|
23
26
|
anyOf:
|
|
24
|
-
- *:: yamlover: $defs: chapter # a nested subchapter (
|
|
25
|
-
- *:: yamlover: $defs: table # a table — enters only by its EXPLICIT tag (
|
|
27
|
+
- *:: yamlover: $defs: chapter # a nested subchapter (a container) — the recursion
|
|
28
|
+
- *:: yamlover: $defs: table # a table — enters only by its EXPLICIT tag (docs/documents/marklower)
|
|
29
|
+
- *:: yamlover: $defs: bullets # a bullet list — enters only by its explicit tag
|
|
30
|
+
- *:: yamlover: $defs: numbered # a numbered list — enters only by its explicit tag
|
|
26
31
|
- *:: yamlover: $defs: chunk # a content block — a leaf
|
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
# A chunk is a typed value; its (type, format) selects the renderer. The default is
|
|
4
4
|
# markdown prose; a chunk overrides type/format/concrete to be a diagram, image, LaTeX,
|
|
5
5
|
# CSV, a file pointer, etc. `binary` covers image/pdf/… chunks (a `*` pointer to a file).
|
|
6
|
-
# Spec:
|
|
6
|
+
# Spec: docs/documents/chapter.
|
|
7
7
|
type: [string, binary]
|
|
8
8
|
format: text/marklower
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# $defs/config — the project configuration schema for `<root>/.
|
|
1
|
+
# $defs/config — the project configuration schema for `<root>/.yo/settings.yo`
|
|
2
2
|
# (settings.ts, IMPORTS.md). Settings are DEFAULTS, never constraints; reading is location-
|
|
3
3
|
# independent. The format `x-yamlover-config` lets the server render the (hidden but accessible)
|
|
4
4
|
# config file with the SETTINGS EDITOR — opened by the gear button, in the main pane. Locations are
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# $defs/numbered — a typographical ORDERED (numbered) list: an ordinary yamlover list whose
|
|
2
|
+
# keyless entries are the items. An item is marklower prose (a chunk) or — when it is an
|
|
3
|
+
# UNTAGGED container — a nested numbered list: unlike table's two-level budget, the list
|
|
4
|
+
# schema applies at ANY depth, until an explicit !!<…> tag switches to something else.
|
|
5
|
+
# A titled list is a chapter holding a list — no keyed properties here on purpose.
|
|
6
|
+
# Attach with !!<*yamlover: $defs: numbered>.
|
|
7
|
+
# No explicit `format:` — `type: variant` derives x-yamlover-numbered. Spec: docs/documents/marklower.
|
|
8
|
+
type: variant
|
|
9
|
+
items:
|
|
10
|
+
anyOf:
|
|
11
|
+
- *:: yamlover: $defs: numbered # an untagged container item = a nested sublist, SAME kind
|
|
12
|
+
- *:: yamlover: $defs: chunk # a list item — marklower prose
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
# $defs/table — a grid node: an OMNI node whose keyless entries are the ROWS (top to
|
|
2
2
|
# bottom), each row an array of CELLS (left to right). A row keyed `header` is the header
|
|
3
3
|
# row; optional keyed `title` is the caption. The column count is inferred from the first
|
|
4
|
-
# row.
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
4
|
+
# row. The table schema consumes exactly TWO nesting levels — rows, then cells; a cell
|
|
5
|
+
# that is an untagged container switches BACK to a CHAPTER (prose, subchapters, tables —
|
|
6
|
+
# the same rules as a top chapter). A NESTED table — like a list — enters a cell only by
|
|
7
|
+
# its explicit !!<…> tag. A header cell may be an omni scalar carrying a keyed `width`
|
|
8
|
+
# sidecar — a proportional column weight (AsciiDoc `cols` style), rendered weight/sum %;
|
|
9
|
+
# `width` is deliberately schema-untyped (an omni cell must stay a LEAF for shape routing).
|
|
10
|
+
# A cell that is a `*` pointer to its adjacent previous cell (`*[.-1]` left, `*..[.-1][.]`
|
|
11
|
+
# up — relative indexes, docs/language/pointers/relative-indexes) declares a MERGED cell: colspan/rowspan. Attach with
|
|
8
12
|
# !!<*yamlover: $defs: table>.
|
|
9
|
-
# No explicit `format:` — `type: variant` derives x-yamlover-table. Spec:
|
|
13
|
+
# No explicit `format:` — `type: variant` derives x-yamlover-table. Spec: docs/documents/marklower.
|
|
10
14
|
type: variant
|
|
11
15
|
properties:
|
|
12
16
|
title: # optional caption
|
|
@@ -17,13 +21,16 @@ properties:
|
|
|
17
21
|
items: # schema is repeated literally rather than *: items)
|
|
18
22
|
anyOf:
|
|
19
23
|
- *:: yamlover: $defs: chunk
|
|
20
|
-
- *:: yamlover: $defs: table
|
|
21
24
|
- *:: yamlover: $defs: chapter
|
|
25
|
+
- *:: yamlover: $defs: table
|
|
26
|
+
- *:: yamlover: $defs: bullets
|
|
27
|
+
- *:: yamlover: $defs: numbered
|
|
22
28
|
items: # a row
|
|
23
29
|
type: array
|
|
24
30
|
items: # a cell
|
|
25
31
|
anyOf:
|
|
26
|
-
- *:: yamlover: $defs: chunk # marklower prose (the default)
|
|
27
|
-
- *:: yamlover: $defs:
|
|
28
|
-
- *:: yamlover: $defs:
|
|
29
|
-
|
|
32
|
+
- *:: yamlover: $defs: chunk # marklower prose (the default leaf)
|
|
33
|
+
- *:: yamlover: $defs: chapter # an UNTAGGED container cell IS a chapter (the first
|
|
34
|
+
- *:: yamlover: $defs: table # container branch wins shape routing); a nested
|
|
35
|
+
- *:: yamlover: $defs: bullets # table — and a list — enters a cell only by its
|
|
36
|
+
- *:: yamlover: $defs: numbered # explicit !!<…> tag
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# $defs/task — a unit of work (a ticket), or a study card. A task IS-A chapter: it EXTENDS
|
|
2
|
-
# the chapter schema (`allOf: [*chapter]`), inheriting the
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# the chapter schema (`allOf: [*chapter]`), inheriting the FULLY-OMNI shape — the scalar
|
|
3
|
+
# SELF-VALUE is the title (no `title:` key), `description` stays keyed — and the positional
|
|
4
|
+
# body, except its subchapter recursion means SUBTASKS (a task tree). On top of that it adds
|
|
5
|
+
# a few OPTIONAL structured fields for planning and automation.
|
|
5
6
|
# It carries NO `state` field: a task's lifecycle position is a TAG APPLICATION
|
|
6
7
|
# (`yamlover-annotations`) into a workflow taxonomy ($defs/workflow), so the whole tag / board
|
|
7
8
|
# machinery is reused. Every planning field is optional — defaults-never-constraints: an
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Tag taxonomy: the built-in PALETTE (colors — pure color tags, each with an explicit
|
|
2
|
-
# color) plus named tags created from the annotation picker (settings.
|
|
2
|
+
# color) plus named tags created from the annotation picker (settings.yo:
|
|
3
3
|
# tags.location). The palette ships with the yamlover project (::: yamlover.inthemoon.net);
|
|
4
4
|
# the engine grafts {$defs, tags} as the `yamlover` self-import key into every served
|
|
5
5
|
# root, so *//yamlover/tags/colors/<name> resolves from any project. Spec: ../$defs/tag.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as f,b as d,j as o}from"./index-Bf2L7I9e.js";import{StaticImageChunk as h,PanZoomImage as x}from"./imagemap-B8RthxNE.js";function E({node:t,label:a,decode:s,chunk:e}){const[r,i]=f.useState([]),[g,u]=f.useState(null);return f.useEffect(()=>{let n=!1;const c=[];return i([]),u(null),(async()=>{const l=await fetch(d(t.path)).then(m=>m.arrayBuffer()),p=await s(l);if(!n){for(const m of p)c.push(URL.createObjectURL(m));n||i(c)}})().catch(l=>!n&&u(String(l.message||l))),()=>{n=!0,c.forEach(URL.revokeObjectURL)}},[t.path]),g?o.jsxs("div",{className:"error",children:[a,": ",g]}):r.length?o.jsx(o.Fragment,{children:r.map((n,c)=>e?o.jsx(h,{src:n,path:t.path,onNavigate:e.onNavigate},c):o.jsx(x,{src:n,className:"filemap fileimagemap",fill:r.length===1},c))}):o.jsxs("div",{className:"loading",children:["decoding ",a,"…"]})}async function w(t,a,s){const e=document.createElement("canvas");e.width=a,e.height=s;const r=e.getContext("2d");if(!r)throw new Error("no 2d context");const i=r.createImageData(a,s);return i.data.set(t),r.putImageData(i,0,0),b(e)}function b(t){return new Promise((a,s)=>t.toBlob(e=>e?a(e):s(new Error("canvas export failed")),"image/png"))}export{E as D,b as c,w as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as u,u as te,a as ne,e as oe,c as re,D as W,b as se,j as d,f as ae}from"./index-Bf2L7I9e.js";import{u as ce,a as ie}from"./paged-bLurvatj.js";const le=""+new URL("djvu-Ci0lFKxE.js",import.meta.url).href;let X=null;function ue(){return window.DjVu?Promise.resolve(window.DjVu):(X??=new Promise((s,c)=>{const i=document.createElement("script");i.src=le,i.onload=()=>window.DjVu?s(window.DjVu):c(new Error("DjVu failed to load")),i.onerror=()=>c(new Error("could not load djvu.js")),document.head.appendChild(i)}),X)}let v=null,Y=null,_=null;const m=new Map,S=new Map,de=6,Q=1500;async function he(s,c){const i=await ue();return v??=new i.Worker,c!==Y&&(Y=c,m.clear(),S.clear(),_=(async()=>(await v.createDocument(s),Number(await v.doc.getPagesQuantity().run())||0))()),_}async function ge(s,c){const i=Math.max(1,Math.round(s.height*c/s.width)),w=await createImageBitmap(s,{resizeWidth:c,resizeHeight:i,resizeQuality:"medium"}),g=document.createElement("canvas");g.width=c,g.height=i;const x=g.getContext("2d");return x.drawImage(w,0,0),w.close(),x.getImageData(0,0,c,i)}function fe(s){const c=m.get(s);if(c)return m.delete(s),m.set(s,c),Promise.resolve(c);const i=S.get(s);if(i)return i;const w=(async()=>{const[g,x,y,A]=await v.run(v.doc.getPage(s).getImageData(),v.doc.getPage(s).getNormalizedTextZones(),v.doc.getPage(s).getWidth(),v.doc.getPage(s).getHeight()),b=Number(y)||g.width,N=Number(A)||g.height,j={image:b>Q?await ge(g,Q):g,zones:Array.isArray(x)?x:[],w:b,h:N};for(S.delete(s),m.set(s,j);m.size>de;)m.delete(m.keys().next().value);return j})();return S.set(s,w),w}const p=s=>Number(s)||0;function pe({image:s}){const c=u.useRef(null);return u.useLayoutEffect(()=>{const i=c.current;i&&(i.width=s.width,i.height=s.height,i.getContext("2d")?.putImageData(s,0,0))},[s]),d.jsx("canvas",{className:"djvu-page",ref:c})}function xe({node:s}){const c=u.useRef(null),[i,w]=u.useState(0),[g,x]=u.useState(1),[y,A]=u.useState(0),[b,N]=u.useState(null),[f,j]=u.useState(null),[E,B]=u.useState(()=>new Set),[D,P]=u.useState(()=>new Map),T=u.useRef(new Map),V=te(s.path),{openCreate:H,openEdit:Z,palette:q,preview:R}=ne(V,s.path),O=V.annotations.filter(e=>e.selector?.type==="djvu").map(e=>({page:p(e.selector.page)||1,x:p(e.selector.x),y:p(e.selector.y),w:p(e.selector.w),h:p(e.selector.h),title:e.description,color:re(e),ann:oe(e)?e:void 0})),U=R?.color??W;if(R?.selector.type==="djvu"){const e=R.selector;O.push({page:p(e.page)||1,x:p(e.x),y:p(e.y),w:p(e.w),h:p(e.h),color:R.color})}const C=u.useRef(new Map),z=ce(c,()=>{const e=[];for(let n=1;n<=i;n++){const t=C.current.get(n);t&&e.push(t)}return e},i>0&&y>0);ie(c);const F=u.useRef(z);F.current=z,u.useLayoutEffect(()=>{z.restoreAnchor()},[g]),u.useEffect(()=>{const e=c.current;e&&!e.closest(".chunk-body")&&e.focus({preventScroll:!0})},[]),u.useLayoutEffect(()=>{const e=c.current;if(!e)return;const n=new ResizeObserver(([t])=>A(t.contentRect.width));return n.observe(e),()=>n.disconnect()},[]);const k=Math.min(y,1e3)*g;u.useEffect(()=>{const e=c.current;if(!e)return;let n=!1,t=0;const o=a=>{(a.ctrlKey||a.altKey||a.metaKey)&&(a.preventDefault(),n||(F.current.captureAnchor(),n=!0),clearTimeout(t),t=window.setTimeout(()=>n=!1,250),x(h=>Math.min(5,Math.max(.4,h*(a.deltaY<0?1.1:1/1.1)))))};return e.addEventListener("wheel",o,{passive:!1}),()=>{e.removeEventListener("wheel",o),clearTimeout(t)}},[]),u.useEffect(()=>{let e=!1;return w(0),N(null),B(new Set),P(new Map),C.current.clear(),T.current.clear(),(async()=>{const n=await fetch(se(s.path)).then(o=>o.arrayBuffer()),t=await he(n,s.path);e||w(t)})().catch(n=>!e&&N(String(n.message||n))),()=>{e=!0}},[s.path]),u.useEffect(()=>{if(!i)return;const e=new IntersectionObserver(n=>{B(t=>{const o=new Set(t);for(const a of n){const h=Number(a.target.dataset.page);a.isIntersecting?o.add(h):o.delete(h)}return o.size===t.size&&[...o].every(a=>t.has(a))?t:o})},{root:c.current,rootMargin:"2000px 0px"});for(const n of C.current.values())e.observe(n);return()=>e.disconnect()},[i,y>0]),u.useEffect(()=>{let e=!0;return E.forEach(n=>{D.has(n)||fe(n).then(t=>{T.current.set(n,{w:t.w,h:t.h}),e&&P(o=>new Map(o).set(n,t))}).catch(()=>{})}),P(n=>{let t=!1;const o=new Map(n);for(const a of o.keys())E.has(a)||(o.delete(a),t=!0);return t?o:n}),()=>{e=!1}},[E]);const G=()=>{const e=window.getSelection();if(!e||e.isCollapsed||!e.anchorNode)return;const t=(e.anchorNode.nodeType===1?e.anchorNode:e.anchorNode.parentElement)?.closest(".djvu-page-wrap");if(!t||!c.current?.contains(t))return;const o=Number(t.dataset.page),a=t.getBoundingClientRect(),h=a.width/(D.get(o)?.w||1);if(!h)return;const l=e.getRangeAt(0).getBoundingClientRect();l.width<2||l.height<2||H({type:"djvu",page:o,x:Math.round((l.left-a.left)/h),y:Math.round((l.top-a.top)/h),w:Math.round(l.width/h),h:Math.round(l.height/h)},{x:l.left,y:l.bottom+6})},I=(e,n)=>n.getBoundingClientRect().width/(D.get(e)?.w||1),J=(e,n)=>{const t=n.currentTarget.getBoundingClientRect(),o=I(e,n.currentTarget);j({page:e,x0:(n.clientX-t.left)/o,y0:(n.clientY-t.top)/o,x1:(n.clientX-t.left)/o,y1:(n.clientY-t.top)/o})},$=(e,n)=>{const t=n.currentTarget.getBoundingClientRect(),o=I(e,n.currentTarget);j(a=>a&&{...a,x1:(n.clientX-t.left)/o,y1:(n.clientY-t.top)/o})},ee=(e,n)=>{const t=f;if(j(null),!t||t.page!==e)return;const o=I(e,n.currentTarget),a=Math.min(t.x0,t.x1),h=Math.min(t.y0,t.y1),l=Math.abs(t.x1-t.x0),r=Math.abs(t.y1-t.y0);if(l*o<3||r*o<3)return;const M=n.currentTarget.getBoundingClientRect();H({type:"djvu",page:e,x:Math.round(a),y:Math.round(h),w:Math.round(l),h:Math.round(r)},{x:M.left+a*o,y:M.top+(h+r)*o+6})};return b?d.jsxs("div",{className:"error",children:["djvu: ",b]}):d.jsxs(d.Fragment,{children:[d.jsxs("div",{className:"filedjvu yo-zoomable",ref:c,tabIndex:0,onMouseUp:G,children:[i===0&&d.jsx("div",{className:"loading",children:"opening djvu…"}),y>0&&Array.from({length:i},(e,n)=>{const t=n+1,o=E.has(t)?D.get(t):void 0,a=T.current.get(t),h=k*(a?a.h/a.w:Math.SQRT2),l=o?k/o.w:0;return d.jsx("div",{className:"djvu-page-wrap","data-page":t,ref:r=>{r?C.current.set(t,r):C.current.delete(t)},style:{width:k,height:o?void 0:h},children:o?d.jsxs(d.Fragment,{children:[d.jsx(pe,{image:o.image}),o.zones.length>0?d.jsx("div",{className:"djvu-textlayer",children:o.zones.map((r,M)=>d.jsx("span",{style:{left:r.x*l,top:r.y*l,width:r.width*l,height:r.height*l,fontSize:r.height*l},children:r.text},M))}):d.jsx("div",{className:"djvu-marquee",onMouseDown:r=>J(t,r),onMouseMove:r=>$(t,r),onMouseUp:r=>ee(t,r),children:f?.page===t&&d.jsx("div",{className:"djvu-region",style:{left:Math.min(f.x0,f.x1)*l,top:Math.min(f.y0,f.y1)*l,width:Math.abs(f.x1-f.x0)*l,height:Math.abs(f.y1-f.y0)*l,borderColor:U,background:U+"2e"}})}),O.filter(r=>r.page===t).map((r,M)=>{const K=r.color||W;return d.jsx("div",{id:r.ann?.fragmentSlug?ae(s.path,r.ann.fragmentSlug):void 0,className:"djvu-region"+(r.ann?" editable":""),title:r.ann?r.title||"click to recolor or delete":r.title,onClick:r.ann?L=>{L.stopPropagation(),Z(r.ann,{x:L.clientX,y:L.clientY})}:void 0,style:{left:r.x*l,top:r.y*l,width:r.w*l,height:r.h*l,borderColor:K,background:K+"2e"}},M)})]}):d.jsx("div",{className:"djvu-placeholder",children:E.has(t)?"decoding…":""})},n)})]}),q]})}export{xe as DjvuView};
|