@yaks/topic 0.0.0-stage → 0.2.36

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.
Files changed (62) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +256 -2
  3. package/_dist/context.d.ts +74 -0
  4. package/_dist/context.d.ts.map +1 -0
  5. package/_dist/graph.d.ts +5 -0
  6. package/_dist/graph.d.ts.map +1 -0
  7. package/_dist/mod.d.ts +33 -0
  8. package/_dist/mod.d.ts.map +1 -0
  9. package/_dist/share.d.ts +61 -0
  10. package/_dist/share.d.ts.map +1 -0
  11. package/_dist/shelves.d.ts +24 -0
  12. package/_dist/shelves.d.ts.map +1 -0
  13. package/_dist/tools.d.ts +5 -0
  14. package/_dist/tools.d.ts.map +1 -0
  15. package/_dist/topic.d.ts +50 -0
  16. package/_dist/topic.d.ts.map +1 -0
  17. package/_dist/views.d.ts +23 -0
  18. package/_dist/views.d.ts.map +1 -0
  19. package/_dist/vocab.d.ts +6 -0
  20. package/_dist/vocab.d.ts.map +1 -0
  21. package/catalogue.js +155 -0
  22. package/catalogue.js.map +1 -0
  23. package/catalogue.ts +218 -0
  24. package/context.js +289 -0
  25. package/context.js.map +1 -0
  26. package/context.ts +318 -0
  27. package/deno.json +1 -0
  28. package/graph.js +32 -0
  29. package/graph.js.map +1 -0
  30. package/graph.ts +26 -0
  31. package/inspect.js +48 -0
  32. package/inspect.js.map +1 -0
  33. package/inspect.ts +25 -0
  34. package/mod.js +33 -0
  35. package/mod.js.map +1 -0
  36. package/mod.ts +56 -0
  37. package/package.json +50 -4
  38. package/page.js +247 -0
  39. package/page.js.map +1 -0
  40. package/page.ts +297 -0
  41. package/share.js +104 -0
  42. package/share.js.map +1 -0
  43. package/share.ts +115 -0
  44. package/shelves.js +99 -0
  45. package/shelves.js.map +1 -0
  46. package/shelves.ts +93 -0
  47. package/tools.js +114 -0
  48. package/tools.js.map +1 -0
  49. package/tools.ts +122 -0
  50. package/topic.js +97 -0
  51. package/topic.js.map +1 -0
  52. package/topic.ts +128 -0
  53. package/tree.js +77 -0
  54. package/tree.js.map +1 -0
  55. package/tree.ts +93 -0
  56. package/views.js +30 -0
  57. package/views.js.map +1 -0
  58. package/views.ts +26 -0
  59. package/vocab.js +16 -0
  60. package/vocab.js.map +1 -0
  61. package/vocab.json +186 -0
  62. package/vocab.ts +17 -0
package/graph.ts ADDED
@@ -0,0 +1,26 @@
1
+ // The write-time half: the `@yaks/topic/graph` entry point. A topic's name is
2
+ // folded by `named()` in the `normalize` phase, the earliest there is, so
3
+ // every door that writes one (topic_new, graph_apply, a seed file, a page's
4
+ // form) stores it in one form, and "Breads" and "breads" meet on
5
+ // `topic.name`'s unique index as one topic.
6
+
7
+ import { type Bundle, type Comp, hook, type Plugin } from '@yaks/graph'
8
+ import { named, TOPIC } from './topic.js'
9
+
10
+ /** A bundle with its topic's name folded, or as it came. */
11
+ /// fold({ entity: { eid: 'q' }, topic: { name: ' Breads ' } }) -> { entity: { eid: 'q' }, topic: { name: 'breads' } }
12
+ /// fold({ entity: { eid: 'q' }, topic: null }) -> { entity: { eid: 'q' }, topic: null }
13
+ export let fold = (b: Bundle): Bundle => {
14
+ let t = b[TOPIC] as Comp | null | undefined
15
+ if (typeof t?.name != 'string' || named(t.name) == t.name) return b
16
+ return { ...b, [TOPIC]: { ...t, name: named(t.name) } }
17
+ }
18
+
19
+ /** The topic plugin: a name folded on the way in. */
20
+ export let topics = (): Plugin => ({
21
+ name: '@yaks/topic',
22
+ hooks: { normalize: hook([TOPIC], (bundles) => bundles.map(fold)) },
23
+ })
24
+
25
+ /** The graph plugins this package contributes. */
26
+ export let plugins = (): Plugin[] => [topics()]
package/inspect.js ADDED
@@ -0,0 +1,48 @@
1
+ // What this package draws, as @yaks/render registrations: the shelves of
2
+ // every topic (`Topics.Page`, the page the sidebar offers); a topic's page
3
+ // beside them (`Topic`, the tab it opens on), and alone wherever a page is
4
+ // asked for without the shelves (`Inspect.Page`, `Card.Topic`); its tree
5
+ // (`Tree`); and how it reads in a topic's lists (`Topic.List.Tile`). Loaded
6
+ // only by an interface that draws them (./views.ts).
7
+ import { parse } from "@yaks/query";
8
+ import { ShelvedPage, TopicsPage } from "./catalogue.js";
9
+ import { asks, TopicPage, TopicTile } from "./page.js";
10
+ import { TopicTree } from "./tree.js";
11
+ import { TOPIC } from "./topic.js";
12
+ let topic = parse(`.${TOPIC}`);
13
+ /** The views this package draws. */ export let inspectViews = [
14
+ {
15
+ view: 'Topics.Page',
16
+ match: true,
17
+ Render: TopicsPage
18
+ },
19
+ {
20
+ view: 'Topic',
21
+ match: topic,
22
+ asks,
23
+ Render: ShelvedPage
24
+ },
25
+ {
26
+ view: 'Card.Topic',
27
+ match: topic,
28
+ asks,
29
+ Render: TopicPage
30
+ },
31
+ {
32
+ view: 'Inspect.Page',
33
+ match: topic,
34
+ asks,
35
+ Render: TopicPage
36
+ },
37
+ {
38
+ view: 'Tree',
39
+ match: topic,
40
+ Render: TopicTree
41
+ },
42
+ {
43
+ view: 'Topic.List.Tile',
44
+ match: topic,
45
+ Render: TopicTile
46
+ }
47
+ ];
48
+ //# sourceMappingURL=inspect.js.map
package/inspect.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspect.js","sources":["./inspect.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,2EAA2E;AAC3E,2EAA2E;AAC3E,yEAAyE;AACzE,4EAA4E;AAC5E,qDAAqD;AAErD,SAAS,KAAK,2BAAgC;AAE9C,SAAS,WAAW,EAAE,UAAU,yBAAwB;AACxD,SAAS,IAAI,EAAE,SAAS,EAAE,SAAS,oBAAmB;AACtD,SAAS,SAAS,oBAAmB;AACrC,SAAS,KAAK,qBAAoB;AAElC,IAAI,QAAQ,MAAM,CAAC,CAAC,EAAE,OAAO;AAE7B,kCAAkC,GAClC,OAAO,IAAI,eAAuB;EAChC;IAAE,MAAM;IAAe,OAAO;IAAM,QAAQ;EAAW;EACvD;IAAE,MAAM;IAAS,OAAO;IAAO;IAAM,QAAQ;EAAY;EACzD;IAAE,MAAM;IAAc,OAAO;IAAO;IAAM,QAAQ;EAAU;EAC5D;IAAE,MAAM;IAAgB,OAAO;IAAO;IAAM,QAAQ;EAAU;EAC9D;IAAE,MAAM;IAAQ,OAAO;IAAO,QAAQ;EAAU;EAChD;IAAE,MAAM;IAAmB,OAAO;IAAO,QAAQ;EAAU;CAC5D,CAAA"}
package/inspect.ts ADDED
@@ -0,0 +1,25 @@
1
+ // What this package draws, as @yaks/render registrations: the shelves of
2
+ // every topic (`Topics.Page`, the page the sidebar offers); a topic's page
3
+ // beside them (`Topic`, the tab it opens on), and alone wherever a page is
4
+ // asked for without the shelves (`Inspect.Page`, `Card.Topic`); its tree
5
+ // (`Tree`); and how it reads in a topic's lists (`Topic.List.Tile`). Loaded
6
+ // only by an interface that draws them (./views.ts).
7
+
8
+ import { parse } from '@yaks/query'
9
+ import type { View } from 'jsr:@yaks/inspect@0.2.36'
10
+ import { ShelvedPage, TopicsPage } from './catalogue.js'
11
+ import { asks, TopicPage, TopicTile } from './page.js'
12
+ import { TopicTree } from './tree.js'
13
+ import { TOPIC } from './topic.js'
14
+
15
+ let topic = parse(`.${TOPIC}`)
16
+
17
+ /** The views this package draws. */
18
+ export let inspectViews: View[] = [
19
+ { view: 'Topics.Page', match: true, Render: TopicsPage },
20
+ { view: 'Topic', match: topic, asks, Render: ShelvedPage },
21
+ { view: 'Card.Topic', match: topic, asks, Render: TopicPage },
22
+ { view: 'Inspect.Page', match: topic, asks, Render: TopicPage },
23
+ { view: 'Tree', match: topic, Render: TopicTree },
24
+ { view: 'Topic.List.Tile', match: topic, Render: TopicTile },
25
+ ]
package/mod.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @yaks/topic — a knowledge graph of topics. A topic is a subject:
3
+ * `topic{name}` beside `doc{title, body}`, its cover, and `content{body}`,
4
+ * its contents; a project is its own topic, and a topic belongs to whatever
5
+ * contains it. Its edges say what it holds (`contains`: a subtopic, or any
6
+ * other entity), what to understand first (`requires`), what it reads and
7
+ * references, and the sources it cites (`cites{hash}`); those relations are
8
+ * @yaks/task's and @yaks/kernel's, and nothing here copies them.
9
+ *
10
+ * A topic is also a session's context: a session opened on one
11
+ * (`session.topic`) wears the {@link ORACLE} persona and starts from the
12
+ * topic's tree, read by `gather` and written as markdown by `compile`.
13
+ *
14
+ * ```ts
15
+ * import { fits, named, overlaps } from '@yaks/topic'
16
+ *
17
+ * named('Data Model') // 'data model'
18
+ * overlaps('economic market design', 'market design') // true
19
+ * fits('data modeling', 'data model') // true
20
+ * ```
21
+ *
22
+ * A topic can be given a share of each plan's week, `attended{share}`; what
23
+ * it keeps of it under its subtopics' shares is `@yaks/topic/share`.
24
+ *
25
+ * The tools, `topic_find`, `topic_new`, `topic_add` and `topic_read`, are
26
+ * `@yaks/topic/tools`.
27
+ *
28
+ * @module
29
+ */ export { about, FIND, fits, found, HOLDS, named, ORACLE, overlaps, TOPIC, TOPICS } from "./topic.js";
30
+ export { BUDGET, compile, CUT, cut, gather, GIST, LEVELS, LINES } from "./context.js";
31
+ export { shelves, within } from "./shelves.js";
32
+ export { topicDoc } from "./vocab.js";
33
+ //# sourceMappingURL=mod.js.map
package/mod.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sources":["./mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BC,GAED,SACE,KAAK,EACL,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,KAAK,EACL,MAAM,qBACW;AACnB,SAEE,MAAM,EACN,OAAO,EACP,GAAG,EACH,GAAG,EACH,MAAM,EAEN,IAAI,EACJ,MAAM,EACN,KAAK,uBACc;AACrB,SAAqB,OAAO,EAAE,MAAM,uBAAsB;AAC1D,SAAS,QAAQ,qBAAoB"}
package/mod.ts ADDED
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @yaks/topic — a knowledge graph of topics. A topic is a subject:
3
+ * `topic{name}` beside `doc{title, body}`, its cover, and `content{body}`,
4
+ * its contents; a project is its own topic, and a topic belongs to whatever
5
+ * contains it. Its edges say what it holds (`contains`: a subtopic, or any
6
+ * other entity), what to understand first (`requires`), what it reads and
7
+ * references, and the sources it cites (`cites{hash}`); those relations are
8
+ * @yaks/task's and @yaks/kernel's, and nothing here copies them.
9
+ *
10
+ * A topic is also a session's context: a session opened on one
11
+ * (`session.topic`) wears the {@link ORACLE} persona and starts from the
12
+ * topic's tree, read by `gather` and written as markdown by `compile`.
13
+ *
14
+ * ```ts
15
+ * import { fits, named, overlaps } from '@yaks/topic'
16
+ *
17
+ * named('Data Model') // 'data model'
18
+ * overlaps('economic market design', 'market design') // true
19
+ * fits('data modeling', 'data model') // true
20
+ * ```
21
+ *
22
+ * A topic can be given a share of each plan's week, `attended{share}`; what
23
+ * it keeps of it under its subtopics' shares is `@yaks/topic/share`.
24
+ *
25
+ * The tools, `topic_find`, `topic_new`, `topic_add` and `topic_read`, are
26
+ * `@yaks/topic/tools`.
27
+ *
28
+ * @module
29
+ */
30
+
31
+ export {
32
+ about,
33
+ FIND,
34
+ fits,
35
+ found,
36
+ HOLDS,
37
+ named,
38
+ ORACLE,
39
+ overlaps,
40
+ TOPIC,
41
+ TOPICS,
42
+ } from './topic.js'
43
+ export {
44
+ type Branch,
45
+ BUDGET,
46
+ compile,
47
+ CUT,
48
+ cut,
49
+ gather,
50
+ type Gathered,
51
+ GIST,
52
+ LEVELS,
53
+ LINES,
54
+ } from './context.js'
55
+ export { type Shelf, shelves, within } from './shelves.js'
56
+ export { topicDoc } from './vocab.js'
package/package.json CHANGED
@@ -1,6 +1,52 @@
1
1
  {
2
2
  "name": "@yaks/topic",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.36",
4
+ "homepage": "https://jsr.io/@yaks/topic",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./_dist/mod.d.ts",
9
+ "default": "./mod.js"
10
+ },
11
+ "./vocab": {
12
+ "types": "./_dist/vocab.d.ts",
13
+ "default": "./vocab.js"
14
+ },
15
+ "./graph": {
16
+ "types": "./_dist/graph.d.ts",
17
+ "default": "./graph.js"
18
+ },
19
+ "./share": {
20
+ "types": "./_dist/share.d.ts",
21
+ "default": "./share.js"
22
+ },
23
+ "./tools": {
24
+ "types": "./_dist/tools.d.ts",
25
+ "default": "./tools.js"
26
+ },
27
+ "./views": {
28
+ "types": "./_dist/views.d.ts",
29
+ "default": "./views.js"
30
+ }
31
+ },
32
+ "license": "Apache-2.0",
33
+ "dependencies": {
34
+ "@yaks/edge": "0.2.36",
35
+ "@yaks/graph": "0.2.36",
36
+ "@yaks/id": "0.2.36",
37
+ "@yaks/inspect": "0.2.36",
38
+ "@yaks/markdown": "0.2.36",
39
+ "@yaks/match": "0.2.36",
40
+ "@yaks/query": "0.2.36",
41
+ "@yaks/text": "0.2.36",
42
+ "@yaks/ui": "0.2.36",
43
+ "@yaks/ux": "0.2.36",
44
+ "@yaks/vocab": "0.2.36",
45
+ "@types/react": "19.3.0",
46
+ "lucide": "1.31.0",
47
+ "react": "19.3.0",
48
+ "stemmer": "2.0.1"
49
+ },
50
+ "description": "A knowledge graph of topics: each a cover, contents and edges to what it holds, needs, reads and cites, found and made under one name per subject.",
51
+ "repository": "https://github.com/yak-sh/yak.git"
52
+ }
package/page.js ADDED
@@ -0,0 +1,247 @@
1
+ /**
2
+ * A topic's page, read the way a book is: its cover (`doc{title, body}`, the
3
+ * title and a line or two saying what belongs under it, its body drawn as
4
+ * every doc's is, through `Inspect.Body`), a line to ask about it where the
5
+ * host draws a conversation (`Conversation`: a session opened on the topic,
6
+ * wearing the oracle), its contents (`content.body`, what is
7
+ * understood about it), then what it holds (`contains`), what to understand
8
+ * first (`requires`), what is related (`reads`, `references`) and its sources
9
+ * (`cites`), the beliefs about it (`belief.about`), and the comments on it,
10
+ * with a line to write one, where the host draws a thread (`Comments`); last,
11
+ * the parts any page has (`io.show`: the facts, the links, the history). Its
12
+ * head says what holds it: a topic belongs to whatever contains it.
13
+ *
14
+ * Whatever a topic holds or cites is drawn by its own renderer, asked for as
15
+ * `Topic.List.Tile`: a subtopic as its cover (`TopicTile`), a belief as what
16
+ * it states (@yaks/memory), anything else as it reads in any list. Each part
17
+ * is an ordered list edited in place: a row dragged between two others is
18
+ * put there, and opens where it stands on its title and body.
19
+ *
20
+ * An archived belief is kept, not live, so the beliefs part lists the live
21
+ * ones and opens the archived ones on a press, muted.
22
+ *
23
+ * @module
24
+ */ /* @ts-types="npm:@types/react@19.3.0" */ import { createElement as h } from "react";
25
+ import { Markdown } from "@yaks/markdown";
26
+ import * as ui from "@yaks/ui";
27
+ import { Disclosure, disclosureAt } from "@yaks/ux";
28
+ import { edited, Held, Part, usePageNotes } from "@yaks/inspect";
29
+ import { title, TOPIC } from "./topic.js";
30
+ /** How many edges from a topic its page reads. */ export let EDGES = 500;
31
+ /** How many beliefs about a topic its page lists, live or archived. */ export let BELIEFS = 200;
32
+ /** The relations a topic's page draws in parts of their own, in order, each
33
+ * under its heading. */ export let PARTS = [
34
+ [
35
+ 'Contains',
36
+ [
37
+ 'contains'
38
+ ]
39
+ ],
40
+ [
41
+ 'Understand first',
42
+ [
43
+ 'requires'
44
+ ]
45
+ ],
46
+ [
47
+ 'Related',
48
+ [
49
+ 'reads',
50
+ 'references'
51
+ ]
52
+ ],
53
+ [
54
+ 'Sources',
55
+ [
56
+ 'cites'
57
+ ]
58
+ ]
59
+ ];
60
+ // What the links part leaves to the parts above: each relation read from the
61
+ // topic's end, the topic holding it, and the beliefs about it.
62
+ let DRAWN = [
63
+ ...PARTS.flatMap(([, rels])=>rels),
64
+ 'contained by',
65
+ 'belief.about'
66
+ ];
67
+ let comp = (b, name)=>b?.[name] ?? {};
68
+ let str = (b, name, prop)=>{
69
+ let v = comp(b, name)[prop];
70
+ return typeof v == 'string' ? v : '';
71
+ };
72
+ let rows = (a)=>a?.rows ?? [];
73
+ /** What a topic's page asks: its edges, what holds it, and the beliefs about
74
+ * it where the graph keeps beliefs. What holds it comes whole, so the head
75
+ * names it as it first paints. */ export let asks = (e, io)=>{
76
+ let eid = e.entity.eid;
77
+ return {
78
+ out: `.edge.from=${eid}&*&.order=edge.ord&.limit=${EDGES}`,
79
+ within: `.contains[<=1]->${eid}&?doc&?${TOPIC}&.limit=${EDGES}`,
80
+ ...io.vocab.comp('belief') ? {
81
+ beliefs: `.belief.about=${eid}&!archived&*` + `&.order=-created.at&.limit=${BELIEFS}`,
82
+ archived: `.belief.about=${eid}&.archived&.count`
83
+ } : {}
84
+ };
85
+ };
86
+ let byTitle = (a, b)=>title(a).localeCompare(title(b), undefined, {
87
+ sensitivity: 'base'
88
+ });
89
+ // An entity by name, drawn from the answer that brought it, so no id shows
90
+ // while its name is on the way.
91
+ let named = (io, b)=>io.show(b, 'Inspect.Reference.Inline');
92
+ // Each of some entities by name, a comma between them.
93
+ let listed = (io, said, all)=>all.length ? [
94
+ said,
95
+ ...all.flatMap((b, i)=>[
96
+ i ? ', ' : null,
97
+ named(io, b)
98
+ ])
99
+ ] : null;
100
+ /** What is understood about it, as one document. */ let Contents = ({ e, io, notes })=>{
101
+ let text = str(e, 'content', 'body');
102
+ let eid = e.entity.eid;
103
+ return /*#__PURE__*/ h(Part, {
104
+ io,
105
+ eid,
106
+ subject: io.id(e),
107
+ heading: 'Contents',
108
+ notes
109
+ }, edited(io, eid) ? null : text ? /*#__PURE__*/ h(ui.Body, {}, /*#__PURE__*/ h(Markdown, {
110
+ source: text
111
+ })) : /*#__PURE__*/ h(ui.Rows.More, {}, 'nothing is written here yet'));
112
+ };
113
+ /** One part's far ends, each drawn by its own renderer, in edge order: an
114
+ * ordered list edited in place (@yaks/inspect `Held`), which an entity
115
+ * dragged from elsewhere joins where a part names one relation. */ let Relation = ({ e, io, notes, heading, rels, edges, ends })=>edges.length ? /*#__PURE__*/ h(Part, {
116
+ io,
117
+ eid: e.entity.eid,
118
+ subject: io.id(e),
119
+ heading,
120
+ count: edges.length,
121
+ notes
122
+ }, /*#__PURE__*/ h(Held, {
123
+ io,
124
+ from: e.entity.eid,
125
+ links: edges,
126
+ ends,
127
+ tile: 'Topic.List.Tile',
128
+ empty: '',
129
+ tag: rels.length == 1 ? rels[0] : undefined
130
+ })) : null;
131
+ /** The archived beliefs, asked for only once they are opened. */ let Archived = ({ e, io })=>{
132
+ let got = io.ask({
133
+ beliefs: `.belief.about=${e.entity.eid}&.archived&*` + `&.order=-created.at&.limit=${BELIEFS}`
134
+ }).beliefs;
135
+ return got?.error ? /*#__PURE__*/ h(ui.Rows.More, {}, got.error) : !got?.ready && !rows(got).length ? /*#__PURE__*/ h(ui.Loading, {}) : /*#__PURE__*/ h(ui.Rows, {
136
+ mod: 'quiet'
137
+ }, rows(got).map((b)=>io.show(b, 'Topic.List.Tile', {})));
138
+ };
139
+ /** The beliefs about it: the live ones, newest first, and the archived ones
140
+ * on a press. */ let Beliefs = ({ e, io, notes, got })=>{
141
+ if (!io.vocab.comp('belief')) return null;
142
+ let live = rows(got.beliefs);
143
+ let kept = got.archived?.count ?? 0;
144
+ let at = disclosureAt(`${e.entity.eid}/archived beliefs`);
145
+ let open = io.state(at) ?? {
146
+ entity: {
147
+ eid: at
148
+ }
149
+ };
150
+ return /*#__PURE__*/ h(Part, {
151
+ io,
152
+ eid: e.entity.eid,
153
+ subject: io.id(e),
154
+ heading: 'Beliefs',
155
+ count: got.beliefs?.ready ? live.length : undefined,
156
+ notes
157
+ }, got.beliefs?.error ? /*#__PURE__*/ h(ui.Rows.More, {}, got.beliefs.error) : !got.beliefs?.ready && !live.length ? /*#__PURE__*/ h(ui.Loading, {}) : live.length ? /*#__PURE__*/ h(ui.Rows, {}, live.map((b)=>io.show(b, 'Topic.List.Tile', {}))) : /*#__PURE__*/ h(ui.Rows.More, {}, kept ? 'none live' : 'nothing is believed about it yet'), kept ? /*#__PURE__*/ h(Disclosure, {
158
+ e: open,
159
+ onChange: (b)=>io.set([
160
+ b
161
+ ]),
162
+ summary: `${kept} archived`,
163
+ lazy: true
164
+ }, /*#__PURE__*/ h(Archived, {
165
+ e,
166
+ io
167
+ })) : null);
168
+ };
169
+ /** A line to ask about it: a session opened on the topic, wearing the oracle,
170
+ * wherever the host draws a conversation (`Conversation`); a host without one
171
+ * has no part. */ let Ask = ({ e, io })=>io.can(e, 'Conversation') ? /*#__PURE__*/ h(ui.Section, {
172
+ 'data-section': 'Ask'
173
+ }, /*#__PURE__*/ h(ui.Section.Title, {}, 'Ask'), io.show(e, 'Conversation', {})) : null;
174
+ /** What people said about it: the comment thread, with a line to say more,
175
+ * wherever the host draws one (`Comments`); a host without one has no part. */ let Comments = ({ e, io })=>io.can(e, 'Comments') ? /*#__PURE__*/ h(ui.Section, {
176
+ 'data-section': 'Comments'
177
+ }, /*#__PURE__*/ h(ui.Section.Title, {}, 'Comments'), io.show(e, 'Comments', {})) : null;
178
+ /** A topic's page. */ export let TopicPage = ({ e, io, got })=>{
179
+ let eid = e.entity.eid;
180
+ let notes = usePageNotes(io, e, [
181
+ 'Contents',
182
+ ...PARTS.map(([heading])=>heading),
183
+ 'Beliefs'
184
+ ]);
185
+ let out = rows(got.out);
186
+ let ids = [
187
+ ...new Set(out.map((b)=>str(b, 'edge', 'to')).filter(Boolean))
188
+ ];
189
+ let ends = io.ask(ids.length ? {
190
+ ends: `.entity.eid=${ids.join(',')}&*`
191
+ } : {}).ends;
192
+ return /*#__PURE__*/ h('div', {
193
+ 'data-inspect': eid
194
+ }, io.show(e, 'Inspect.Head', {
195
+ sub: listed(io, 'in ', rows(got.within).toSorted(byTitle)),
196
+ notes: notes.get('')
197
+ }), // Its cover's words, what belongs under it, as any page says what an
198
+ // entity says; a topic with no cover has its contents said below alone.
199
+ str(e, 'doc', 'body') ? io.show(e, 'Inspect.Body') : null, /*#__PURE__*/ h(Ask, {
200
+ e,
201
+ io
202
+ }), /*#__PURE__*/ h(Contents, {
203
+ e,
204
+ io,
205
+ notes
206
+ }), ...PARTS.map(([heading, rels])=>/*#__PURE__*/ h(Relation, {
207
+ key: heading,
208
+ e,
209
+ io,
210
+ notes,
211
+ heading,
212
+ rels,
213
+ edges: out.filter((b)=>rels.some((r)=>b[r])),
214
+ ends
215
+ })), /*#__PURE__*/ h(Beliefs, {
216
+ e,
217
+ io,
218
+ notes,
219
+ got
220
+ }), /*#__PURE__*/ h(Comments, {
221
+ e,
222
+ io
223
+ }), io.show(e, 'Inspect.Facts', {
224
+ notes,
225
+ skip: [
226
+ TOPIC
227
+ ]
228
+ }), io.show(e, 'Inspect.Links', {
229
+ notes,
230
+ skip: DRAWN
231
+ }), io.show(e, 'Inspect.History', {
232
+ notes
233
+ }));
234
+ };
235
+ /** A topic in a list: its cover, the title and what belongs under it, so a
236
+ * reader decides by it. */ export let TopicTile = ({ e, io })=>{
237
+ let cover = str(e, 'doc', 'body');
238
+ return /*#__PURE__*/ h(ui.Tile, {
239
+ href: io.link(e.entity.eid),
240
+ 'data-topic': e.entity.eid
241
+ }, /*#__PURE__*/ h(ui.Tile.Kind, {}, 'topic'), /*#__PURE__*/ h(ui.Tile.Title, {
242
+ mod: 'wrap'
243
+ }, title(e)), cover ? /*#__PURE__*/ h(ui.Tile.Sub, {
244
+ mod: 'wrap'
245
+ }, cover) : null);
246
+ };
247
+ //# sourceMappingURL=page.js.map
package/page.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page.js","sources":["./page.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GAED,uCAAuC,GAAG,SAAS,iBAAiB,CAAC,gBAAoD;AACzH,SAAS,QAAQ,8BAAmC;AACpD,YAAY,wBAA6B;AACzC,SAAS,UAAU,EAAE,YAAY,wBAA6B;AAC9D,SAIE,MAAM,EACN,IAAI,EAEJ,IAAI,EAEJ,YAAY,6BACmB;AACjC,SAAS,KAAK,EAAE,KAAK,qBAAoB;AAEzC,gDAAgD,GAChD,OAAO,I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