@harnesys/sdk 1.1.0 → 1.2.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.
package/README.md CHANGED
@@ -8,7 +8,7 @@ Leaf package for addon authors. Implements the addon platform spec (`docs/ADDONS
8
8
  bun add @harnesys/sdk
9
9
  ```
10
10
 
11
- Version `1.0.0` tracks the addon platform contract (`platform: 1`); `1.1.0` adds tool schema validation to the fake host. The SDK ships TypeScript sources for Bun and compiled ESM plus declarations in `dist/`; see [Распространение SDK](../../docs/add-ons/sdk.md#распространение-sdk) for the export modes and the consumer `tsconfig` shape.
11
+ Version `1.0.0` tracks the addon platform contract (`platform: 1`); `1.1.0` adds tool schema validation to the fake host; `1.2.0` adds `createLabel` and `icon` to the viewer descriptor. The SDK ships TypeScript sources for Bun and compiled ESM plus declarations in `dist/`; see [Распространение SDK](../../docs/add-ons/sdk.md#распространение-sdk) for the export modes and the consumer `tsconfig` shape.
12
12
 
13
13
  ## Layout
14
14
 
@@ -9,8 +9,18 @@ export interface ViewerDescriptor {
9
9
  /** Add-on route (GET) that serves the editor/preview HTML document. */
10
10
  route: string;
11
11
  mode: 'view' | 'edit';
12
- /** Host offers "New <title> file" in the sources tree when true. */
12
+ /** Host offers a "create file" entry in the sources tree when true. */
13
13
  create?: boolean;
14
+ /**
15
+ * Full label of that entry, e.g. `{'en': 'New Draw.io'}`. The host renders it
16
+ * verbatim; without it the entry falls back to `New <title>`.
17
+ */
18
+ createLabel?: L10n;
19
+ /**
20
+ * Icon shown for the extensions above in the sources tree and its menus:
21
+ * a lucide icon name or an SVG shipped with the package (`assets/*.svg`).
22
+ */
23
+ icon?: string;
14
24
  }
15
25
  export declare const ViewerExtensionSchema: z.ZodString;
16
26
  export declare const ViewerDescriptorSchema: z.ZodObject<{
@@ -23,6 +33,8 @@ export declare const ViewerDescriptorSchema: z.ZodObject<{
23
33
  view: "view";
24
34
  }>;
25
35
  create: z.ZodOptional<z.ZodBoolean>;
36
+ createLabel: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>;
37
+ icon: z.ZodOptional<z.ZodString>;
26
38
  }, z.core.$strip>;
27
39
  export declare const viewerFamily: {
28
40
  readonly family: "viewer";
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { AddonIconRefSchema } from "../manifest/branding.js";
2
3
  import { L10nSchema } from "../manifest/l10n.js";
3
4
  export const VIEWER_SCHEMA_VERSION = 1;
4
5
  export const ViewerExtensionSchema = z
@@ -13,6 +14,8 @@ export const ViewerDescriptorSchema = z.object({
13
14
  .regex(/^\/[A-Za-z0-9/_:.-]*$/, 'route must start with / and use :param segments'),
14
15
  mode: z.enum(['view', 'edit']),
15
16
  create: z.boolean().optional(),
17
+ createLabel: L10nSchema.optional(),
18
+ icon: AddonIconRefSchema.optional(),
16
19
  });
17
20
  export const viewerFamily = {
18
21
  family: 'viewer',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harnesys/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Add-on SDK for Harnesys: manifest, contributions, JSON-RPC protocol, permissions, defineAddon, host client and a testing fake host.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,4 +1,5 @@
1
1
  import { z } from 'zod';
2
+ import { AddonIconRefSchema } from '../manifest/branding.ts';
2
3
  import type { L10n } from '../manifest/l10n.ts';
3
4
  import { L10nSchema } from '../manifest/l10n.ts';
4
5
 
@@ -12,8 +13,18 @@ export interface ViewerDescriptor {
12
13
  /** Add-on route (GET) that serves the editor/preview HTML document. */
13
14
  route: string;
14
15
  mode: 'view' | 'edit';
15
- /** Host offers "New <title> file" in the sources tree when true. */
16
+ /** Host offers a "create file" entry in the sources tree when true. */
16
17
  create?: boolean;
18
+ /**
19
+ * Full label of that entry, e.g. `{'en': 'New Draw.io'}`. The host renders it
20
+ * verbatim; without it the entry falls back to `New <title>`.
21
+ */
22
+ createLabel?: L10n;
23
+ /**
24
+ * Icon shown for the extensions above in the sources tree and its menus:
25
+ * a lucide icon name or an SVG shipped with the package (`assets/*.svg`).
26
+ */
27
+ icon?: string;
17
28
  }
18
29
 
19
30
  export const ViewerExtensionSchema = z
@@ -29,6 +40,8 @@ export const ViewerDescriptorSchema = z.object({
29
40
  .regex(/^\/[A-Za-z0-9/_:.-]*$/, 'route must start with / and use :param segments'),
30
41
  mode: z.enum(['view', 'edit']),
31
42
  create: z.boolean().optional(),
43
+ createLabel: L10nSchema.optional(),
44
+ icon: AddonIconRefSchema.optional(),
32
45
  });
33
46
 
34
47
  export const viewerFamily = {