@kernhq/module-quire 0.14.0 → 0.16.0

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 (74) hide show
  1. package/dist/contract/models.d.ts +209 -0
  2. package/dist/contract/models.d.ts.map +1 -1
  3. package/dist/contract/models.js +151 -0
  4. package/dist/contract/models.js.map +1 -1
  5. package/dist/contract/permissions.d.ts.map +1 -1
  6. package/dist/contract/permissions.js +32 -0
  7. package/dist/contract/permissions.js.map +1 -1
  8. package/dist/contract/properties.d.ts +3 -3
  9. package/dist/contract/router.d.ts +509 -8
  10. package/dist/contract/router.d.ts.map +1 -1
  11. package/dist/contract/router.js +211 -1
  12. package/dist/contract/router.js.map +1 -1
  13. package/dist/server/_impl.d.ts +573 -1269
  14. package/dist/server/_impl.d.ts.map +1 -1
  15. package/dist/server/_impl.js +180 -0
  16. package/dist/server/_impl.js.map +1 -1
  17. package/dist/server/export/markdown.d.ts.map +1 -1
  18. package/dist/server/export/markdown.js +84 -1
  19. package/dist/server/export/markdown.js.map +1 -1
  20. package/dist/server/render.d.ts +190 -1
  21. package/dist/server/render.d.ts.map +1 -1
  22. package/dist/server/render.js +413 -0
  23. package/dist/server/render.js.map +1 -1
  24. package/dist/server/schema.d.ts +260 -1
  25. package/dist/server/schema.d.ts.map +1 -1
  26. package/dist/server/schema.js +108 -1
  27. package/dist/server/schema.js.map +1 -1
  28. package/dist/server/services/databases.d.ts +5 -5
  29. package/dist/server/services/index.d.ts +6 -0
  30. package/dist/server/services/index.d.ts.map +1 -1
  31. package/dist/server/services/index.js +27 -3
  32. package/dist/server/services/index.js.map +1 -1
  33. package/dist/server/services/macros.d.ts +83 -0
  34. package/dist/server/services/macros.d.ts.map +1 -0
  35. package/dist/server/services/macros.js +488 -0
  36. package/dist/server/services/macros.js.map +1 -0
  37. package/dist/server/services/objects.d.ts +61 -0
  38. package/dist/server/services/objects.d.ts.map +1 -0
  39. package/dist/server/services/objects.js +110 -0
  40. package/dist/server/services/objects.js.map +1 -0
  41. package/dist/server/services/publications.d.ts +2 -1
  42. package/dist/server/services/publications.d.ts.map +1 -1
  43. package/dist/server/services/publications.js +43 -4
  44. package/dist/server/services/publications.js.map +1 -1
  45. package/dist/server/services/templates.d.ts +135 -0
  46. package/dist/server/services/templates.d.ts.map +1 -0
  47. package/dist/server/services/templates.js +897 -0
  48. package/dist/server/services/templates.js.map +1 -0
  49. package/dist/server/services/unfurl.d.ts +154 -0
  50. package/dist/server/services/unfurl.d.ts.map +1 -0
  51. package/dist/server/services/unfurl.js +593 -0
  52. package/dist/server/services/unfurl.js.map +1 -0
  53. package/dist/server/services/versions.d.ts +12 -0
  54. package/dist/server/services/versions.d.ts.map +1 -1
  55. package/dist/server/services/versions.js +3 -1
  56. package/dist/server/services/versions.js.map +1 -1
  57. package/migrations/0011_templates.sql +157 -0
  58. package/migrations/meta/_journal.json +7 -0
  59. package/package.json +5 -5
  60. package/src/client/components/NewSpaceDialog.svelte +77 -8
  61. package/src/client/components/PageEditor.svelte +80 -0
  62. package/src/client/components/PagePicker.svelte +264 -0
  63. package/src/client/components/SaveAsTemplateDialog.svelte +502 -0
  64. package/src/client/components/SidebarSpaces.svelte +33 -1
  65. package/src/client/components/TemplatePicker.svelte +437 -0
  66. package/src/client/i18n.ts +327 -0
  67. package/src/client/index.ts +19 -0
  68. package/src/client/mock.ts +274 -0
  69. package/src/client/pages/PageView.svelte +50 -0
  70. package/src/client/pages/SpacePage.svelte +20 -4
  71. package/src/client/query.ts +17 -0
  72. package/src/contract/models.ts +191 -0
  73. package/src/contract/permissions.ts +33 -0
  74. package/src/contract/router.ts +228 -0
@@ -1,7 +1,7 @@
1
1
  import { KernError, uuidv7 } from '@kernhq/kernel';
2
2
  import { and, desc, eq, inArray, lt } from 'drizzle-orm';
3
3
  import { pageDocFromBase64, pageDocFromState } from '../document.js';
4
- import { referencesIn, renderPageDoc, textFromPageDoc } from '../render.js';
4
+ import { referencesIn, renderPageDoc, textFromPageDoc, } from '../render.js';
5
5
  import { pages, pageVersions, spaces } from '../schema.js';
6
6
  import { documentNameOf } from './pages.js';
7
7
  /** How much of the prose a version list shows without loading the document. */
@@ -270,6 +270,8 @@ export function quireVersions(kernel, access) {
270
270
  return renderPageDoc(doc, {
271
271
  fileSrc: (id) => sources.get(id) ?? null,
272
272
  pageHref: (id) => hrefs.get(id) ?? null,
273
+ macros: opts.macros,
274
+ macroStrings: opts.macroStrings,
273
275
  });
274
276
  },
275
277
  };
@@ -1 +1 @@
1
- {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../src/server/services/versions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAwB,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACxE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAExD,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACpE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAE1D,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAI3C,+EAA+E;AAC/E,MAAM,OAAO,GAAG,GAAG,CAAA;AAEnB;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAAiB,CAAA;AACvD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAU,EAAE,CAAC,GAAG,sBAAsB,GAAG,MAAM,EAAE,CAAA;AAE9F,MAAM,UAAU,SAAS,CAAC,GAAe,EAAE,WAA0B;IACnE,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,WAAW,EAAE,GAAG,CAAC,WAAyC;QAC1D,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,IAAI,EAAE,GAAG,C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AAK,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI;gBACvC,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,YAAY,EAAE,IAAI,CAAC,YAAY;aAChC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,157 @@
1
+ -- A page, or a whole space, saved so it can be made again.
2
+ --
3
+ -- Hand-written rather than generated, like 0001, 0006, 0008 and 0010, because drizzle-kit writes
4
+ -- neither the policy nor the guards. Every statement is idempotent: `create table`, `create index`
5
+ -- and `create policy` throw on a replay, and a module migration that throws takes down the **whole
6
+ -- host service** rather than its own module — `core` hosts five. Drizzle keys applied migrations by
7
+ -- content hash, so regenerating the journal replays every file against a schema that already has its
8
+ -- objects. The two `check` constraints are inline in `create table if not exists` on purpose: there
9
+ -- they inherit that guard, where a separate `alter table … add constraint` would need a
10
+ -- `drop constraint if exists` in front of it and is the shape that has broken this before.
11
+ --
12
+ --
13
+ -- WHERE THE FIVE STARTERS LIVE, AND WHY IT IS NOT IN THIS TABLE
14
+ --
15
+ -- Meeting notes, decision record, requirements, retrospective and how-to are **constants in the
16
+ -- module**, not rows seeded here. Three reasons, and the first one alone settles it.
17
+ --
18
+ -- *A migration has no workspace to seed into.* Every tenant table in `mod_quire` carries
19
+ -- `workspace_id NOT NULL` and is fenced by a policy that reads `app.workspace_id`. A migration runs
20
+ -- once per **database**, before any workspace exists and then never again — so a seeded row would
21
+ -- need either a nullable `workspace_id`, which makes `templates` the one table in this schema RLS
22
+ -- does not actually cover, or a second mechanism hooked to workspace creation, which then has to be
23
+ -- re-run against every workspace that already existed each time a sixth starter is added. Both are
24
+ -- worse than the thing they solve.
25
+ --
26
+ -- *A row is frozen at the release that wrote it.* Improving the retrospective starter in 0.15 does
27
+ -- nothing for a workspace created under 0.14, and making it do something means an `UPDATE` in a
28
+ -- migration — which overwrites whatever the customer changed. A constant improves for everybody on
29
+ -- the release that ships it, and overwrites nothing, because nothing was ever copied.
30
+ --
31
+ -- *A row holds one language.* Every user-facing string in Kern goes through `t()` in five locales.
32
+ -- A seeded row's name, description and prose would be English in an Arabic workspace for ever; a
33
+ -- constant's strings are message keys resolved per reader.
34
+ --
35
+ -- What that costs is the thing the trade is usually made for: a constant cannot be edited. That is
36
+ -- what `built_in` and `key` buy back, and how they work is written on the columns below.
37
+ CREATE TABLE IF NOT EXISTS "mod_quire"."templates" (
38
+ "id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
39
+ "workspace_id" uuid NOT NULL,
40
+ -- Null is a workspace-wide template, offered wherever a page is made. A space id scopes it to one
41
+ -- space, which is what a team wanting their own "incident report" without putting it in everybody
42
+ -- else's picker actually asks for. Nullable rather than two tables because every read is the same
43
+ -- read — "what may I make here" — and a union of two tables to answer one question is how the
44
+ -- workspace-wide half ends up quietly missing from one of the three places that asks.
45
+ "space_id" uuid,
46
+ -- `page` — one page, `doc` is its body.
47
+ -- `space` — a whole space, `doc` is `{ pages: [...] }`, a tree of titles and bodies.
48
+ -- Text with no check constraint, like `spaces.visibility`, `pages.kind` and `export_jobs.scope`:
49
+ -- the enum in the contract is what closes these, and one column in the schema enforcing its domain
50
+ -- in the database while eight do not teaches nothing except that the rule is arbitrary.
51
+ "kind" text DEFAULT 'page' NOT NULL,
52
+ -- Which shipped starter this row **replaces**, or null for somebody's own template.
53
+ --
54
+ -- A starter is a constant, so it has a stable key (`meeting-notes`, `decision-record`,
55
+ -- `requirements`, `retrospective`, `how-to`) rather than a uuid — there is no row to have an id.
56
+ -- The picker reads the constants and the rows together, and a row with a key takes the place of
57
+ -- the starter it names instead of appearing beside it. So editing a starter is copy-on-write: the
58
+ -- first edit in a workspace writes one row, before that there are none, and resetting is deleting
59
+ -- that row — after which the shipped starter comes back, current and translated.
60
+ --
61
+ -- Deliberately **not** validated against the starter set, here or in the contract's row parser. A
62
+ -- release that stops shipping a starter would otherwise turn every override of it into a parse
63
+ -- failure, which is a picker that throws rather than a picker missing one entry. A key naming a
64
+ -- starter that no longer exists is an ordinary custom template, and that is the read side's rule.
65
+ "key" text,
66
+ -- True exactly when this row occupies a shipped starter's slot — see `key`. The pair is what keeps
67
+ -- the flag honest: something writes it (the first edit of a starter), something reads it (the
68
+ -- picker, deciding whether to draw the constant or the row), and the check constraint below stops
69
+ -- the two from drifting apart. A boolean nothing sets is the failure this project keeps naming
70
+ -- about capabilities and permission keys, and it is the same failure here.
71
+ "built_in" boolean DEFAULT false NOT NULL,
72
+ "name" text NOT NULL,
73
+ "description" text DEFAULT '' NOT NULL,
74
+ -- a Lucide icon name or an emoji, as everywhere else in this schema
75
+ "icon" text,
76
+ -- The body. A `PageDoc` for `kind = 'page'`; `{ pages: [ { title, icon, doc, children } ] }` for
77
+ -- `kind = 'space'`. Always a JSON *object* rather than sometimes an array, so the default is a
78
+ -- shape and not a lie, and so the two are told apart by their keys rather than by their type.
79
+ --
80
+ -- Whatever a person can write, a template can hold — which means this column is bound by the same
81
+ -- rule as everything else that stores a page: a node the editor can produce and `renderPageDoc`
82
+ -- cannot draw is a template that makes blank pages. Nothing here can check that; `render.test.ts`
83
+ -- is what does.
84
+ "doc" jsonb DEFAULT '{}'::jsonb NOT NULL,
85
+ -- `[{ name, label, type, options, default, required }]` — what somebody is asked before the page
86
+ -- is made, so `{{sprint}}` in the body becomes a sprint. `{{date}}` and `{{author}}` are not in
87
+ -- here: they are filled from the request and need declaring by nobody.
88
+ --
89
+ -- JSONB rather than a `template_variables` table for the same reason `import_jobs.report` is a
90
+ -- column: it is written whole, read whole, by one screen, nothing joins to an entry and no entry
91
+ -- outlives its template. A table would be a second tenant table with its own `workspace_id`, its
92
+ -- own policy and its own `TENANT_TABLES` entry to store a list of at most a dozen field
93
+ -- definitions that are only ever fetched by `where template_id = $1`.
94
+ "variables" jsonb DEFAULT '[]'::jsonb NOT NULL,
95
+ -- Nullable, like every other `created_by` in this schema and unlike the two job tables. A template
96
+ -- is not an artefact that flattens other people's readerships into one file, so there is nothing
97
+ -- here that has to be fenced to a person; a template whose author has left the workspace is still
98
+ -- the team's template, and nulling the author must not take it away from them.
99
+ "created_by" uuid,
100
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
101
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
102
+ -- `key` is present exactly when `built_in` is true. Written as an equality rather than as two
103
+ -- `or`ed halves because both sides are non-nullable booleans, so the constraint can never evaluate
104
+ -- to NULL and be satisfied by accident — the usual way a check constraint stops checking.
105
+ CONSTRAINT "templates_key_matches_built_in" CHECK ("built_in" = ("key" IS NOT NULL)),
106
+ -- A space template makes a space, so it cannot live inside one. Without this the picker for space
107
+ -- creation has to decide what a space-scoped space template means, and every answer is a guess.
108
+ CONSTRAINT "templates_space_kind" CHECK ("kind" <> 'space' OR "space_id" IS NULL)
109
+ );
110
+ --> statement-breakpoint
111
+
112
+ -- The only read that matters, and it is one index rather than two.
113
+ --
114
+ -- "What may I make here" is `kind = 'page' and (space_id = $1 or space_id is null)`, and this is
115
+ -- what serves it — one index rather than a second one for the workspace-wide half.
116
+ --
117
+ -- `name` is last so the read is covered, not so the read comes back sorted: measured, the plan is an
118
+ -- index-only scan with the `or` applied as a filter inside it, and the `order by` is a sort over the
119
+ -- handful of rows that come out. That is the right trade at this size, and it is worth writing down
120
+ -- because the shape suggests otherwise — an index whose trailing column is the sort key usually does
121
+ -- supply the order, and here the disjunction on the column before it is what stops it.
122
+ --
123
+ -- There is deliberately **no** `(workspace_id, created_at desc)` index, unlike `export_jobs` and
124
+ -- `import_jobs` next door. Those accumulate a row per request for ever and are read newest-first;
125
+ -- a workspace has tens of templates, read by name, and an index nothing needs is a write nobody
126
+ -- asked for.
127
+ CREATE INDEX IF NOT EXISTS "templates_ws_kind_space_idx" ON "mod_quire"."templates" USING btree ("workspace_id","kind","space_id","name");--> statement-breakpoint
128
+
129
+ -- One override per starter per workspace. Two rows both claiming `retrospective` would make which
130
+ -- one the picker draws a coin toss, and "reset to the shipped one" would delete half the change.
131
+ -- Partial, because `key` is null on every template somebody wrote themselves and a plain unique
132
+ -- index over a nullable column constrains nothing at all in Postgres — NULLs never collide.
133
+ --
134
+ -- Names are **not** unique, in either direction. A workspace calling its own template "Meeting
135
+ -- notes" beside the starter of that name is a thing people mean to do, and a constraint refusing it
136
+ -- would be the database having an opinion about wording.
137
+ CREATE UNIQUE INDEX IF NOT EXISTS "templates_ws_key_uq" ON "mod_quire"."templates" USING btree ("workspace_id","key") WHERE "key" IS NOT NULL;--> statement-breakpoint
138
+
139
+ -- Row-level security, the same triple every tenant table gets.
140
+ --
141
+ -- `force` matters: without it the table owner bypasses the policy, and the owner is the role the
142
+ -- service connects as. A *superuser* bypasses RLS whatever this says, and the development and CI
143
+ -- roles are superusers — so a test that does not connect as an unprivileged NOBYPASSRLS role proves
144
+ -- nothing about isolation.
145
+ --
146
+ -- This is the tenant fence and nothing more. It does not decide who may *use* a template — a
147
+ -- space-scoped template belongs to a space, and whether the person asking may read that space is
148
+ -- settled by the procedure against the same space bindings as every other read in this module. Nor
149
+ -- does it decide what a template may *contain*: a template made from a page the author could read
150
+ -- carries that page's prose to whoever makes a page from it, which is a copy and not a leak, and is
151
+ -- the procedure's call at the moment of saving rather than this policy's.
152
+ ALTER TABLE "mod_quire"."templates" ENABLE ROW LEVEL SECURITY;--> statement-breakpoint
153
+ ALTER TABLE "mod_quire"."templates" FORCE ROW LEVEL SECURITY;--> statement-breakpoint
154
+ DROP POLICY IF EXISTS "templates_ws_isolation" ON "mod_quire"."templates";--> statement-breakpoint
155
+ CREATE POLICY "templates_ws_isolation" ON "mod_quire"."templates"
156
+ USING (workspace_id::text = current_setting('app.workspace_id', true))
157
+ WITH CHECK (workspace_id::text = current_setting('app.workspace_id', true));
@@ -78,6 +78,13 @@
78
78
  "when": 1788040627617,
79
79
  "tag": "0010_transfers",
80
80
  "breakpoints": true
81
+ },
82
+ {
83
+ "idx": 11,
84
+ "version": "7",
85
+ "when": 1788127027617,
86
+ "tag": "0011_templates",
87
+ "breakpoints": true
81
88
  }
82
89
  ]
83
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernhq/module-quire",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "Kern Quire: collaborative documents, spaces and page trees",
5
5
  "homepage": "https://github.com/KernAIO/module-quire#readme",
6
6
  "license": "AGPL-3.0-only",
@@ -53,8 +53,8 @@
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@kernhq/contracts": "^0.7.0",
56
- "@kernhq/kernel": "^0.7.2",
57
- "@kernhq/ui": "^0.12.0",
56
+ "@kernhq/kernel": "^0.9.0",
57
+ "@kernhq/ui": "^0.14.0",
58
58
  "@tanstack/svelte-query": "^6.1.0",
59
59
  "svelte": "^5.46.0"
60
60
  },
@@ -73,9 +73,9 @@
73
73
  "@biomejs/biome": "^2.0.0",
74
74
  "@changesets/cli": "^2.27.0",
75
75
  "@kernhq/contracts": "^0.7.0",
76
- "@kernhq/kernel": "^0.7.2",
76
+ "@kernhq/kernel": "^0.9.0",
77
77
  "@kernhq/tsconfig": "^0.1.0",
78
- "@kernhq/ui": "^0.12.0",
78
+ "@kernhq/ui": "^0.14.0",
79
79
  "@tanstack/svelte-query": "^6.1.0",
80
80
  "@types/node": "^24.0.0",
81
81
  "@types/pg": "^8.15.0",
@@ -1,6 +1,6 @@
1
1
  <script lang="ts">
2
2
  import { Button, Dialog, Field, Input, Select, Textarea } from '@kernhq/ui'
3
- import { useQueryClient } from '@tanstack/svelte-query'
3
+ import { createQuery, useQueryClient } from '@tanstack/svelte-query'
4
4
  import { getQuireApi } from '../api-instance.js'
5
5
  import { t } from '../i18n.js'
6
6
  import type { Space } from '../index.js'
@@ -23,6 +23,25 @@ let visibility = $state<Space['visibility']>('open')
23
23
  let saving = $state(false)
24
24
  let error = $state<string | null>(null)
25
25
 
26
+ /**
27
+ * A whole space somebody saved, so a team can be given the shape as well as the name.
28
+ *
29
+ * There is no shipped space template and there should not be: the five starters Kern ships are
30
+ * pages, because a page template is generic in a way a space's organisation never is. So this
31
+ * control appears only once somebody in the workspace has saved one — an empty picker is a question
32
+ * with one answer.
33
+ *
34
+ * `spaceId: null` is the workspace-wide question, which is the only one that can be asked before
35
+ * there is a space.
36
+ */
37
+ let fromTemplate = $state('')
38
+ const templatesQuery = createQuery(() => ({
39
+ queryKey: quireKeys.templates(workspaceId, 'space', null),
40
+ enabled: open && Boolean(workspaceId),
41
+ queryFn: () => api.templates.list({ workspaceId, kind: 'space', spaceId: null }),
42
+ }))
43
+ const spaceTemplates = $derived((templatesQuery.data ?? []).filter((choice) => choice.id))
44
+
26
45
  /**
27
46
  * The key is derived from the name until somebody types one, and then left alone. Overwriting a key
28
47
  * a person has edited — because they went back and fixed a typo in the name — is the kind of thing
@@ -47,16 +66,22 @@ function reset() {
47
66
  key = ''
48
67
  description = ''
49
68
  visibility = 'open'
69
+ fromTemplate = ''
50
70
  keyTouched = false
51
71
  error = null
52
72
  }
53
73
 
54
- async function submit() {
55
- if (!valid || saving) return
56
- saving = true
57
- error = null
58
- try {
59
- const space = await api.spaces.create({
74
+ /**
75
+ * Make the space, from a template or from nothing.
76
+ *
77
+ * `templates.instantiate` makes the space itself — it has to, because it also writes the tree in the
78
+ * same transaction — so the two fields it has no opinion about are applied afterwards rather than
79
+ * dropped. A dialog that asks for a description and then quietly ignores it is worse than one that
80
+ * never asked.
81
+ */
82
+ async function make(): Promise<Space> {
83
+ if (!fromTemplate)
84
+ return api.spaces.create({
60
85
  workspaceId,
61
86
  key,
62
87
  name: name.trim(),
@@ -64,6 +89,29 @@ async function submit() {
64
89
  icon: null,
65
90
  visibility,
66
91
  })
92
+
93
+ const made = await api.templates.instantiate({
94
+ workspaceId,
95
+ templateId: fromTemplate,
96
+ key,
97
+ name: name.trim(),
98
+ })
99
+ if (description.trim() || visibility !== 'open')
100
+ return api.spaces.update({
101
+ workspaceId,
102
+ spaceId: made.spaceId,
103
+ description: description.trim(),
104
+ visibility,
105
+ })
106
+ return api.spaces.get({ workspaceId, spaceId: made.spaceId })
107
+ }
108
+
109
+ async function submit() {
110
+ if (!valid || saving) return
111
+ saving = true
112
+ error = null
113
+ try {
114
+ const space = await make()
67
115
  await client.invalidateQueries({ queryKey: quireKeys.spaces(workspaceId) })
68
116
  open = false
69
117
  reset()
@@ -119,7 +167,28 @@ async function submit() {
119
167
  {/snippet}
120
168
  </Field>
121
169
 
122
- {#if error}<p class="error">{error}</p>{/if}
170
+ <!--
171
+ Only once there is something to choose between. With no space templates saved this is a menu
172
+ whose single entry is "an empty space", which teaches somebody that the control does nothing.
173
+ -->
174
+ {#if spaceTemplates.length > 0}
175
+ <Field label={t('template_new_space_from')}>
176
+ {#snippet children(id: string)}
177
+ <Select
178
+ {id}
179
+ ariaLabel={t('template_new_space_from')}
180
+ value={fromTemplate}
181
+ options={[
182
+ { value: '', label: t('template_new_space_blank') },
183
+ ...spaceTemplates.map((choice) => ({ value: choice.id as string, label: choice.name })),
184
+ ]}
185
+ onValueChange={(v: string) => (fromTemplate = v)}
186
+ />
187
+ {/snippet}
188
+ </Field>
189
+ {/if}
190
+
191
+ {#if error}<p class="error" role="alert">{error}</p>{/if}
123
192
  </div>
124
193
 
125
194
  {#snippet footer()}
@@ -8,8 +8,12 @@ import {
8
8
  getHost,
9
9
  session,
10
10
  } from '@kernhq/ui'
11
+ import { createQuery } from '@tanstack/svelte-query'
12
+ import { getQuireApi } from '../api-instance.js'
11
13
  import { t } from '../i18n.js'
12
14
  import { type Page, pageDocumentName } from '../index.js'
15
+ import { quireKeys } from '../query.js'
16
+ import PagePicker from './PagePicker.svelte'
13
17
 
14
18
  /**
15
19
  * The body of a page, synchronised through the collab service.
@@ -54,6 +58,68 @@ const user = $derived({
54
58
  name: session.user?.name ?? '',
55
59
  avatarUrl: session.user?.avatarUrl ?? null,
56
60
  })
61
+
62
+ /* ---------------------------------------------------------------------------------------------- */
63
+ /* The two macros that name another page */
64
+ /* ---------------------------------------------------------------------------------------------- */
65
+
66
+ /**
67
+ * Include page and include-an-excerpt need a page id, and `@kernhq/ui` cannot search for one.
68
+ *
69
+ * The `/` menu hides both entries unless the host passes `pickPage`, for the same reason it hides
70
+ * Image without `pickImage`: a macro with no page draws an empty frame for every reader, so an entry
71
+ * whose only possible outcome is an empty frame is worse than no entry. Without this wiring the two
72
+ * macros were in the schema, in the renderer and in the resolver, and unreachable from the product.
73
+ *
74
+ * The menu awaits a promise, so dismissing the dialog has to resolve it — see `PagePicker`.
75
+ */
76
+ let pickerOpen = $state(false)
77
+ let pending: ((picked: { pageId: string } | null) => void) | null = null
78
+
79
+ function pickPage(): Promise<{ pageId: string } | null> {
80
+ return new Promise((resolve) => {
81
+ // A picker already waiting answers "nothing" rather than being left holding an open promise.
82
+ pending?.(null)
83
+ pending = resolve
84
+ pickerOpen = true
85
+ })
86
+ }
87
+
88
+ function picked(page: { id: string; title: string } | null) {
89
+ const resolve = pending
90
+ pending = null
91
+ pickerOpen = false
92
+ if (page) titlesPicked.set(page.id, page.title)
93
+ resolve?.(page ? { pageId: page.id } : null)
94
+ }
95
+
96
+ /**
97
+ * The title a macro's card shows, resolved live and never stored.
98
+ *
99
+ * A title written into the document outlives the permission that allowed it: it would travel into
100
+ * every export and every published copy and be drawn by a renderer that never asked anybody. So the
101
+ * document holds the id, and this names it for the writer's own card, from what this session
102
+ * already has — the space's tree, which the sidebar has usually loaded under this very key, plus
103
+ * whatever was chosen in the picker (which is how a page in another space gets a name here).
104
+ *
105
+ * A page it cannot name is drawn as "Another page" rather than as "No page chosen": the card says
106
+ * what it knows and does not invent the rest.
107
+ */
108
+ const api = getQuireApi()
109
+ const treeQuery = createQuery(() => ({
110
+ queryKey: quireKeys.tree(doc.workspaceId, doc.spaceId),
111
+ enabled: Boolean(doc.workspaceId && doc.spaceId),
112
+ queryFn: () =>
113
+ api.pages.tree({ workspaceId: doc.workspaceId, spaceId: doc.spaceId, includeArchived: false }),
114
+ }))
115
+ const titlesInSpace = $derived(new Map((treeQuery.data ?? []).map((node) => [node.id, node.title])))
116
+ const titlesPicked = new Map<string, string>()
117
+
118
+ function macroPageLabel(pageId: string): string | null {
119
+ const title = titlesInSpace.get(pageId) ?? titlesPicked.get(pageId) ?? null
120
+ if (title === null) return null
121
+ return title.trim() || t('untitled')
122
+ }
57
123
  </script>
58
124
 
59
125
  {#if getHost().isMock}
@@ -92,6 +158,20 @@ const user = $derived({
92
158
  {activeComment}
93
159
  {onCommentClick}
94
160
  {oncomment}
161
+ {pickPage}
162
+ {macroPageLabel}
95
163
  />
96
164
  {/key}
165
+
166
+ <!--
167
+ Outside the `{#key name}` block: re-keying tears the editor down and rebuilds it, and a picker
168
+ inside would be destroyed mid-choice with the `/` menu still awaiting its promise.
169
+ -->
170
+ <PagePicker
171
+ bind:open={pickerOpen}
172
+ workspaceId={doc.workspaceId}
173
+ spaceId={doc.spaceId}
174
+ excludeId={doc.id}
175
+ onPick={picked}
176
+ />
97
177
  {/if}