@inflatable-cookie/longhorn-poodle-svelte 0.1.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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +37 -0
  3. package/package.json +171 -0
  4. package/src/bindings/index.ts +4 -0
  5. package/src/bindings/layout.svelte.ts +143 -0
  6. package/src/bindings/lifecycle.svelte.ts +246 -0
  7. package/src/bindings/optimistic.svelte.ts +96 -0
  8. package/src/bindings/scheduler.ts +13 -0
  9. package/src/bindings/surface-transfer-actions.ts +281 -0
  10. package/src/bindings/surface-transfer.svelte.ts +230 -0
  11. package/src/bindings/surfaces.svelte.ts +179 -0
  12. package/src/bindings/transfer-actions.ts +240 -0
  13. package/src/bindings/transfer-model.ts +138 -0
  14. package/src/bindings/transfer.svelte.ts +388 -0
  15. package/src/bindings/window-chrome.ts +63 -0
  16. package/src/bindings/window-drag.ts +161 -0
  17. package/src/commands/poodle/CommandPaletteBinding.svelte +51 -0
  18. package/src/commands/poodle/KeybindingSettings.svelte +138 -0
  19. package/src/commands/poodle/projectors.ts +37 -0
  20. package/src/commands/poodle.ts +9 -0
  21. package/src/commands/svelte/lifecycle.ts +13 -0
  22. package/src/commands/svelte/session.svelte.ts +212 -0
  23. package/src/commands/svelte.ts +2 -0
  24. package/src/config/poodle/BackupSettingsPage.svelte +295 -0
  25. package/src/config/poodle/RestoreSettingsPage.svelte +535 -0
  26. package/src/config/poodle/StorageSettingsPage.svelte +361 -0
  27. package/src/config/poodle/restore-model.ts +63 -0
  28. package/src/config/poodle/types.ts +11 -0
  29. package/src/config/poodle.ts +8 -0
  30. package/src/history/svelte/lifecycle.ts +13 -0
  31. package/src/history/svelte/session.svelte.ts +97 -0
  32. package/src/history/svelte.ts +2 -0
  33. package/src/history-tree/svelte/lifecycle.ts +11 -0
  34. package/src/history-tree/svelte/session.svelte.ts +27 -0
  35. package/src/history-tree/svelte.ts +3 -0
  36. package/src/licence/poodle/LicenceActivation.svelte +62 -0
  37. package/src/licence/poodle/LicenceSeats.svelte +57 -0
  38. package/src/licence/poodle/LicenceStatus.svelte +34 -0
  39. package/src/licence/poodle/LicenceSurface.svelte.ts +43 -0
  40. package/src/licence/poodle.ts +3 -0
  41. package/src/native-content/index.ts +4 -0
  42. package/src/native-content/lifecycle.ts +13 -0
  43. package/src/native-content/session.svelte.ts +526 -0
  44. package/src/native-content/viewport.ts +27 -0
  45. package/src/native-content/visibility.ts +19 -0
  46. package/src/notifications/poodle/NotificationPanel.svelte +66 -0
  47. package/src/notifications/poodle/NotificationToastHost.svelte +40 -0
  48. package/src/notifications/poodle/NotificationToastStack.svelte +22 -0
  49. package/src/notifications/poodle/projectors.ts +30 -0
  50. package/src/notifications/poodle.ts +4 -0
  51. package/src/notifications/svelte/lifecycle.ts +11 -0
  52. package/src/notifications/svelte/session.svelte.ts +57 -0
  53. package/src/notifications/svelte.ts +2 -0
  54. package/src/operation/poodle/OperationPanel.svelte +200 -0
  55. package/src/operation/poodle/projectors.ts +78 -0
  56. package/src/operation/poodle.ts +2 -0
  57. package/src/operation/svelte/lifecycle.ts +13 -0
  58. package/src/operation/svelte/session.svelte.ts +80 -0
  59. package/src/operation/svelte.ts +2 -0
  60. package/src/poodle/LayoutDockRegion.svelte +148 -0
  61. package/src/poodle/LayoutSplitView.svelte +120 -0
  62. package/src/poodle/LayoutTabs.svelte +91 -0
  63. package/src/poodle/binding.ts +401 -0
  64. package/src/poodle/document.ts +117 -0
  65. package/src/poodle/index.ts +8 -0
  66. package/src/poodle/projectors.ts +125 -0
  67. package/src/poodle/transfer.ts +188 -0
  68. package/src/poodle/types.ts +89 -0
  69. package/src/settings/poodle/SettingsShell.svelte +382 -0
  70. package/src/settings/poodle.ts +2 -0
  71. package/src/settings/svelte/context.ts +61 -0
  72. package/src/settings/svelte/document.svelte.ts +202 -0
  73. package/src/settings/svelte/errors.ts +84 -0
  74. package/src/settings/svelte/lifecycle.ts +18 -0
  75. package/src/settings/svelte/page.svelte.ts +266 -0
  76. package/src/settings/svelte/runtime.svelte.ts +187 -0
  77. package/src/settings/svelte/scope.svelte.ts +123 -0
  78. package/src/settings/svelte/session.svelte.ts +288 -0
  79. package/src/settings/svelte/types.ts +90 -0
  80. package/src/settings/svelte.ts +6 -0
  81. package/src/svelte.d.ts +6 -0
  82. package/src/update/poodle/UpdateCentre.svelte +64 -0
  83. package/src/update/poodle/UpdateSettings.svelte +64 -0
  84. package/src/update/poodle/UpdateStatus.svelte +51 -0
  85. package/src/update/poodle/UpdateSurface.svelte.ts +88 -0
  86. package/src/update/poodle.ts +3 -0
@@ -0,0 +1,64 @@
1
+ <script lang="ts">
2
+ import { UpdateCenter as PoodleUpdateCenter } from "@inflatable-cookie/poodle-svelte";
3
+ import type { UpdateController } from "@inflatable-cookie/longhorn/update";
4
+
5
+ import { sampleUpdateController } from "./UpdateSurface.svelte.ts";
6
+
7
+ /**
8
+ * Binds an `UpdateController` to Poodle's `UpdateCenter`.
9
+ *
10
+ * An icon that is not there at all until there is something to act on, and
11
+ * a popover holding the same status surface a settings panel would show.
12
+ * `presence` decides the first part and is the controller's, not a rule this
13
+ * file reimplements: three availability states carry a newer version that
14
+ * this application cannot install, and an icon for any of them would offer
15
+ * something that cannot be taken.
16
+ */
17
+ interface Props {
18
+ controller: UpdateController;
19
+ title?: string;
20
+ ariaLabel?: string | null;
21
+ confirmInstall?: boolean;
22
+ onOpenChange?: ((open: boolean) => void) | null;
23
+ }
24
+
25
+ let {
26
+ controller,
27
+ title = "Update",
28
+ ariaLabel = null,
29
+ confirmInstall = true,
30
+ onOpenChange = null,
31
+ }: Props = $props();
32
+
33
+ const update = sampleUpdateController(() => controller);
34
+
35
+ function install(): void {
36
+ const version = update.actionableVersion;
37
+ if (version !== undefined) void controller.install(version);
38
+ }
39
+
40
+ function defer(): void {
41
+ const version = update.actionableVersion;
42
+ if (version !== undefined) void controller.defer(version, { cause: "userPostponed" });
43
+ }
44
+ </script>
45
+
46
+ <PoodleUpdateCenter
47
+ presence={update.presence}
48
+ status={update.status}
49
+ availability={update.availability}
50
+ progress={update.progress}
51
+ channel={update.channel}
52
+ installedVersion={update.installedVersion}
53
+ deferral={update.deferral}
54
+ lastRejection={update.lastRejection}
55
+ aheadOfChannel={update.aheadOfChannel}
56
+ pending={update.pending}
57
+ {title}
58
+ {ariaLabel}
59
+ {confirmInstall}
60
+ {onOpenChange}
61
+ onCheck={() => void controller.check()}
62
+ onInstall={update.actionableVersion === undefined ? null : install}
63
+ onDefer={update.actionableVersion === undefined ? null : defer}
64
+ />
@@ -0,0 +1,64 @@
1
+ <script lang="ts">
2
+ import { Field, Select, Stack, type SelectOption } from "@inflatable-cookie/poodle-svelte";
3
+ import { UPDATE_CHANNELS, type Channel, type UpdateController } from "@inflatable-cookie/longhorn/update";
4
+
5
+ import { sampleUpdateController } from "./UpdateSurface.svelte.ts";
6
+ import UpdateStatus from "./UpdateStatus.svelte";
7
+
8
+ /**
9
+ * The update settings panel: which channel this install follows, and the
10
+ * same status surface the popover shows.
11
+ *
12
+ * A composition, not a component. It owns no state and no rendering of its
13
+ * own beyond arranging two things that already exist, which is why it lives
14
+ * here rather than being written again in every application.
15
+ */
16
+ interface Props {
17
+ controller: UpdateController;
18
+ confirmInstall?: boolean;
19
+ }
20
+
21
+ let { controller, confirmInstall = true }: Props = $props();
22
+
23
+ const update = sampleUpdateController(() => controller);
24
+
25
+ const CHANNEL_LABELS: Record<Channel, string> = {
26
+ production: "Production",
27
+ beta: "Beta",
28
+ nightly: "Nightly",
29
+ };
30
+
31
+ // Said out loud, because "nightly" is a word people choose without knowing
32
+ // what they are agreeing to. Selecting a faster channel is the one setting
33
+ // here that can leave an install ahead of what it follows.
34
+ const CHANNEL_HINTS: Record<Channel, string> = {
35
+ production: "Released builds. The default.",
36
+ beta: "Release candidates, ahead of production.",
37
+ nightly: "Continuous builds. Expect breakage.",
38
+ };
39
+
40
+ const options = $derived<SelectOption[]>(
41
+ UPDATE_CHANNELS.map((value) => ({ value, label: CHANNEL_LABELS[value] })),
42
+ );
43
+
44
+ const selected = $derived(update.channel);
45
+ </script>
46
+
47
+ <Stack gap="lg">
48
+ <Field
49
+ id="longhorn-update-channel"
50
+ label="Release channel"
51
+ description={selected === undefined ? undefined : CHANNEL_HINTS[selected]}
52
+ >
53
+ <Select
54
+ id="longhorn-update-channel"
55
+ options={options}
56
+ value={selected ?? null}
57
+ disabled={update.pending || selected === undefined}
58
+ ariaLabel="Release channel"
59
+ onValueChange={(value) => void controller.selectChannel(value as Channel)}
60
+ />
61
+ </Field>
62
+
63
+ <UpdateStatus {controller} {confirmInstall} />
64
+ </Stack>
@@ -0,0 +1,51 @@
1
+ <script lang="ts">
2
+ import { UpdateStatus as PoodleUpdateStatus } from "@inflatable-cookie/poodle-svelte";
3
+ import type { UpdateController } from "@inflatable-cookie/longhorn/update";
4
+
5
+ import { sampleUpdateController } from "./UpdateSurface.svelte.ts";
6
+
7
+ /**
8
+ * Binds an `UpdateController` to Poodle's `UpdateStatus`.
9
+ *
10
+ * The information, the download, and install-and-restart, in whatever
11
+ * container puts it there — a settings panel or the popover below. Poodle
12
+ * renders all five availability states; this supplies them and turns the
13
+ * three actions back into controller commands.
14
+ */
15
+ interface Props {
16
+ controller: UpdateController;
17
+ confirmInstall?: boolean;
18
+ }
19
+
20
+ let { controller, confirmInstall = true }: Props = $props();
21
+
22
+ const update = sampleUpdateController(() => controller);
23
+
24
+ function install(): void {
25
+ const version = update.actionableVersion;
26
+ if (version !== undefined) void controller.install(version);
27
+ }
28
+
29
+ // "Not now", which is the operator's own decision rather than the gate's.
30
+ // The controller keeps the two apart and only this one quietens the icon.
31
+ function defer(): void {
32
+ const version = update.actionableVersion;
33
+ if (version !== undefined) void controller.defer(version, { cause: "userPostponed" });
34
+ }
35
+ </script>
36
+
37
+ <PoodleUpdateStatus
38
+ status={update.status}
39
+ availability={update.availability}
40
+ progress={update.progress}
41
+ channel={update.channel}
42
+ installedVersion={update.installedVersion}
43
+ deferral={update.deferral}
44
+ lastRejection={update.lastRejection}
45
+ aheadOfChannel={update.aheadOfChannel}
46
+ pending={update.pending}
47
+ {confirmInstall}
48
+ onCheck={() => void controller.check()}
49
+ onInstall={update.actionableVersion === undefined ? null : install}
50
+ onDefer={update.actionableVersion === undefined ? null : defer}
51
+ />
@@ -0,0 +1,88 @@
1
+ import type { UpdateController } from "@inflatable-cookie/longhorn/update";
2
+
3
+ /**
4
+ * The controller's reads, sampled so Svelte can see them change.
5
+ *
6
+ * `UpdateController` is a plain class, not a rune, so `controller.availability`
7
+ * in a template is not a tracked dependency: nothing re-renders when the
8
+ * authority notifies. Poodle's components bump their own counter on `observe`,
9
+ * but they re-derive from the props they were handed — which are stale unless
10
+ * the parent re-evaluates them.
11
+ *
12
+ * # Why this stays, now that Poodle's `observe` works
13
+ *
14
+ * It did not, for two props. `presence` was read straight in `UpdateCenter`'s
15
+ * template and `pending` at two `disabled=` sites, both outside the
16
+ * notify-tracked derived, so the bump never reached them -- the icon stayed
17
+ * hidden forever. Poodle routed both on 2026-08-13, and their contract now
18
+ * covers it.
19
+ *
20
+ * This stays anyway, for one structural reason rather than distrust:
21
+ * `UpdateSettings` renders its own control. Delegation cannot help a
22
+ * component that draws a `Select` bound to `controller.channel`, so a
23
+ * subscription is needed there whatever the other two do. Given one of the
24
+ * three requires it, all three use it -- one mechanism beats two, which is
25
+ * the principle Poodle applied to their own props.
26
+ *
27
+ * `tests/update` asserts Poodle's `observe` is sufficient on its own, so the
28
+ * simplification stays available and a regression on their side is visible
29
+ * here even though nothing depends on it.
30
+ *
31
+ * # React hosts cannot do this at all
32
+ *
33
+ * Poodle reports that `observe` plus plain reads is structurally impossible in
34
+ * React: props are by value, so the re-render `observe` triggers re-runs with
35
+ * the values the parent last rendered. A React host needs
36
+ * `useSyncExternalStore` over the same authority. Longhorn ships no React
37
+ * surface, so it does not bite here -- recorded because the sampler below is
38
+ * the Svelte shape of the same answer.
39
+ *
40
+ * The controller's lifecycle is deliberately not touched. Whoever constructed
41
+ * it starts and stops it, the same division `SettingsSession` keeps: a view
42
+ * that started the thing it renders would stop it on unmount and take the
43
+ * state away from every other view of the same controller.
44
+ */
45
+ export function sampleUpdateController(getController: () => UpdateController) {
46
+ let controller = getController();
47
+ let notify = $state(0);
48
+
49
+ $effect(() => {
50
+ const nextController = getController();
51
+ if (nextController !== controller) {
52
+ controller = nextController;
53
+ notify += 1;
54
+ }
55
+ const unobserve = nextController.observe(() => {
56
+ notify += 1;
57
+ });
58
+ return () => unobserve();
59
+ });
60
+
61
+ return {
62
+ get status() { void notify; return controller.status; },
63
+ get availability() { void notify; return controller.availability; },
64
+ get progress() { void notify; return controller.progress; },
65
+ get channel() { void notify; return controller.channel; },
66
+ get installedVersion() { void notify; return controller.installedVersion; },
67
+ get deferral() { void notify; return controller.deferral; },
68
+ get lastRejection() { void notify; return controller.lastRejection; },
69
+ get aheadOfChannel() { void notify; return controller.aheadOfChannel; },
70
+ get presence() { void notify; return controller.presence; },
71
+ get pending() { void notify; return controller.pending; },
72
+
73
+ /**
74
+ * The version an install or defer would act on.
75
+ *
76
+ * An offer names it; so does an artifact already downloaded and waiting.
77
+ * Absent otherwise, and the actions are absent with it — an install button
78
+ * with no version to install is a button that cannot work.
79
+ */
80
+ get actionableVersion(): string | undefined {
81
+ void notify;
82
+ const progress = controller.progress;
83
+ if (progress?.state === "readyToInstall") return progress.version;
84
+ const availability = controller.availability;
85
+ return availability?.state === "offer" ? availability.version : undefined;
86
+ },
87
+ };
88
+ }
@@ -0,0 +1,3 @@
1
+ export { default as UpdateCentre } from "./poodle/UpdateCentre.svelte";
2
+ export { default as UpdateSettings } from "./poodle/UpdateSettings.svelte";
3
+ export { default as UpdateStatus } from "./poodle/UpdateStatus.svelte";