@lapis-notes/ui 0.2.1 → 0.2.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @lapis-notes/ui
2
2
 
3
+ ## 0.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#167](https://github.com/lapismd/lapis-notes/pull/167)
8
+ [`498a089`](https://github.com/lapismd/lapis-notes/commit/498a089e230d323852ab9b98346e45179a74461b)
9
+ Thanks [@stevejuma](https://github.com/stevejuma)! - Render General → Advanced
10
+ CLI controls through the declarative Design Core settings group so they use
11
+ the same heading, card and field layout as core settings.
12
+
13
+ ## 0.2.3
14
+
15
+ ### Patch Changes
16
+
17
+ - [#152](https://github.com/lapismd/lapis-notes/pull/152)
18
+ [`e575ecf`](https://github.com/lapismd/lapis-notes/commit/e575ecf7e15c47e2fca5f36c070f86acb94fddf9)
19
+ Thanks
20
+ [@lapismd-dependency-bot](https://github.com/apps/lapismd-dependency-bot)! -
21
+ Refresh first-party Lapis dependencies to the published versions recorded in
22
+ this pull request.
23
+
24
+ ## 0.2.2
25
+
26
+ ### Patch Changes
27
+
28
+ - [#126](https://github.com/lapismd/lapis-notes/pull/126)
29
+ [`036204b`](https://github.com/lapismd/lapis-notes/commit/036204b0b52d70dd817a97983cefc3835f306cd8)
30
+ Thanks
31
+ [@lapismd-dependency-bot](https://github.com/apps/lapismd-dependency-bot)! -
32
+ Refresh first-party Lapis dependencies to the published versions recorded in
33
+ this pull request.
34
+
3
35
  ## 0.2.1
4
36
 
5
37
  ### Patch Changes
@@ -8,7 +8,7 @@
8
8
  CliInstallationStatus,
9
9
  } from "./cli-settings";
10
10
  import CliAccessSettings from "./CliAccessSettings.svelte";
11
- let { host }: { host: CliSettingsHost } = $props();
11
+ let { host, embedded = false }: { host: CliSettingsHost; embedded?: boolean } = $props();
12
12
  let status = $state<CliInstallationStatus>();
13
13
  let downloads = $state<CliDownload[]>([]);
14
14
  let selectedDownload = $state("");
@@ -62,8 +62,10 @@
62
62
  >
63
63
  <div class="row">
64
64
  <div>
65
- <h3>Command line interface</h3>
66
- <p>Use the <code>lapis</code> command from your terminal.</p>
65
+ {#if !embedded}
66
+ <h3>Command line interface</h3>
67
+ <p>Use the <code>lapis</code> command from your terminal.</p>
68
+ {/if}
67
69
  {#if status}
68
70
  <p>
69
71
  {status.state === "installed"
@@ -1,6 +1,7 @@
1
1
  import type { CliSettingsHost } from "./cli-settings";
2
2
  type $$ComponentProps = {
3
3
  host: CliSettingsHost;
4
+ embedded?: boolean;
4
5
  };
5
6
  declare const CliSettings: import("svelte").Component<$$ComponentProps, {}, "">;
6
7
  type CliSettings = ReturnType<typeof CliSettings>;
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ import type { WorkspaceCustomSettingProps } from "@lapismd/design-core/workspace/settings";
3
+ import { cliSettingsFieldHost } from "./cli-settings";
4
+ import CliSettings from "./CliSettings.svelte";
5
+
6
+ let { field }: WorkspaceCustomSettingProps = $props();
7
+ let host = $derived(cliSettingsFieldHost(field));
8
+ </script>
9
+
10
+ <CliSettings {host} embedded />
@@ -0,0 +1,4 @@
1
+ import type { WorkspaceCustomSettingProps } from "@lapismd/design-core/workspace/settings";
2
+ declare const CliSettingsField: import("svelte").Component<WorkspaceCustomSettingProps<unknown>, {}, "">;
3
+ type CliSettingsField = ReturnType<typeof CliSettingsField>;
4
+ export default CliSettingsField;
@@ -1,4 +1,4 @@
1
- import type { WorkspaceSettingsController } from "@lapismd/design-core/workspace/settings";
1
+ import type { WorkspaceCustomSetting, WorkspaceSettingsController } from "@lapismd/design-core/workspace/settings";
2
2
  export interface CliInstallationStatus {
3
3
  state: "not-installed" | "installed" | "broken" | "conflict";
4
4
  destination: string;
@@ -45,5 +45,6 @@ export interface CliSettingsHost {
45
45
  downloads?: () => Promise<CliDownload[]>;
46
46
  access?: CliAccessHost;
47
47
  }
48
+ export declare function cliSettingsFieldHost(field: WorkspaceCustomSetting): CliSettingsHost;
48
49
  export declare function cliSettingsHost(controller: WorkspaceSettingsController): CliSettingsHost;
49
50
  export declare function registerCliSettings(settings: WorkspaceSettingsController, host: CliSettingsHost): () => void;
@@ -1,5 +1,12 @@
1
- import GeneralCliSettingsPage from "./GeneralCliSettingsPage.svelte";
1
+ import CliSettingsField from "./CliSettingsField.svelte";
2
2
  const hosts = new WeakMap();
3
+ const fieldHosts = new WeakMap();
4
+ export function cliSettingsFieldHost(field) {
5
+ const host = fieldHosts.get(field);
6
+ if (!host)
7
+ throw new Error("CLI settings field host is not bound");
8
+ return host;
9
+ }
3
10
  export function cliSettingsHost(controller) {
4
11
  const host = hosts.get(controller);
5
12
  if (!host)
@@ -13,12 +20,28 @@ export function registerCliSettings(settings, host) {
13
20
  }
14
21
  const entry = { host };
15
22
  hosts.set(settings, entry);
23
+ const field = {
24
+ id: "cli",
25
+ title: "Command line interface",
26
+ description: "Use the lapis command from your terminal.",
27
+ type: "custom",
28
+ presentation: "full-width",
29
+ component: CliSettingsField,
30
+ };
31
+ fieldHosts.set(field, host);
16
32
  const dispose = settings.registerSection({
17
33
  id: "general",
18
34
  title: "General",
19
35
  navigationGroupId: "options",
20
36
  order: 0,
21
- page: GeneralCliSettingsPage,
37
+ fields: [
38
+ {
39
+ id: "advanced",
40
+ title: "Advanced",
41
+ type: "group",
42
+ fields: [field],
43
+ },
44
+ ],
22
45
  searchEntries: [
23
46
  {
24
47
  id: "cli",
@@ -29,9 +52,12 @@ export function registerCliSettings(settings, host) {
29
52
  ],
30
53
  });
31
54
  return () => {
32
- if (hosts.get(settings) !== entry)
55
+ if (hosts.get(settings) !== entry) {
56
+ fieldHosts.delete(field);
33
57
  return;
58
+ }
34
59
  dispose();
35
60
  hosts.delete(settings);
61
+ fieldHosts.delete(field);
36
62
  };
37
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lapis-notes/ui",
3
- "version": "0.2.1",
3
+ "version": "0.2.4",
4
4
  "description": "Public UI primitives required by Lapis Notes API consumers",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -90,13 +90,13 @@
90
90
  "tailwindcss": "^4.1.12",
91
91
  "tw-animate-css": "^1.3.7",
92
92
  "typescript": "~5.8.3",
93
- "vite": "^6.4.2",
93
+ "vite": "^6.4.5",
94
94
  "vitest": "^4.1.8"
95
95
  },
96
96
  "dependencies": {
97
97
  "@dnd-kit/dom": "^0.4.0",
98
98
  "@dnd-kit/svelte": "^0.4.0",
99
- "@lapismd/design-core": "^0.13.3",
99
+ "@lapismd/design-core": "^0.13.5",
100
100
  "@lucide/svelte": "^0.515.0",
101
101
  "bits-ui": "2.20.2",
102
102
  "clsx": "^2.1.1",
@@ -1,12 +0,0 @@
1
- <script lang="ts">
2
- import { untrack } from "svelte";
3
- import type { WorkspaceSettingsPageProps } from "@lapismd/design-core/workspace/settings";
4
- import { cliSettingsHost } from "./cli-settings";
5
- import CliSettings from "./CliSettings.svelte";
6
- let { controller }: WorkspaceSettingsPageProps = $props();
7
- const host = untrack(() => cliSettingsHost(controller));
8
- </script>
9
-
10
- <h1>General</h1>
11
- <h2>Advanced</h2>
12
- <CliSettings {host} />
@@ -1,4 +0,0 @@
1
- import type { WorkspaceSettingsPageProps } from "@lapismd/design-core/workspace/settings";
2
- declare const GeneralCliSettingsPage: import("svelte").Component<WorkspaceSettingsPageProps, {}, "">;
3
- type GeneralCliSettingsPage = ReturnType<typeof GeneralCliSettingsPage>;
4
- export default GeneralCliSettingsPage;