@punica/editor 1.7.1 → 1.8.1
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/dist/index.bundle.esm.js +2 -2
- package/dist/index.bundle.esm.js.map +1 -1
- package/dist/index.bundle.umd.js +2 -2
- package/dist/index.bundle.umd.js.map +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +1 -0
- package/types/punica.module.extensions.api.d.ts +41 -2
- package/types/punica.module.extensions.i18n.d.ts +83 -0
- package/types/punica.module.shell.activityBar.d.ts +22 -0
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
/// <reference path="punica.module.kernel.tasks.d.ts" />
|
|
24
24
|
/// <reference path="punica.module.extensions.api.d.ts" />
|
|
25
25
|
/// <reference path="punica.module.extensions.settings.d.ts" />
|
|
26
|
+
/// <reference path="punica.module.extensions.i18n.d.ts" />
|
|
26
27
|
/// <reference path="punica.module.runtime.fs.d.ts" />
|
|
27
28
|
/// <reference path="punica.module.runtime.search.d.ts" />
|
|
28
29
|
/// <reference path="punica.module.runtime.vcs.d.ts" />
|
|
@@ -76,8 +76,24 @@ declare module 'punica' {
|
|
|
76
76
|
*/
|
|
77
77
|
showOnStartup?: boolean;
|
|
78
78
|
};
|
|
79
|
-
activityBar?: Pick<BaseView, 'id' | 'name'> &
|
|
80
|
-
Required<Pick<BaseView, 'title' | 'icon' | 'alignment'
|
|
79
|
+
activityBar?: Pick<BaseView, 'id' | 'name' | 'capability'> &
|
|
80
|
+
Required<Pick<BaseView, 'title' | 'icon' | 'alignment'>> & {
|
|
81
|
+
/**
|
|
82
|
+
* Draw this item together with every other item declaring the same
|
|
83
|
+
* `group.id`: one icon, and a flyout listing the members once there
|
|
84
|
+
* is more than one. Lets a family of extensions (marketplaces,
|
|
85
|
+
* database providers, …) grow without taking a bar slot each.
|
|
86
|
+
* The group's identity lives here, in the manifests — the substrate
|
|
87
|
+
* knows only "same id, same icon". Ignored by older shells.
|
|
88
|
+
*/
|
|
89
|
+
group?: {
|
|
90
|
+
id: string;
|
|
91
|
+
/** Tooltip of the group icon. First member to declare it wins. */
|
|
92
|
+
title?: string;
|
|
93
|
+
/** Group icon (raw HTML). First member to declare it wins. */
|
|
94
|
+
icon?: string;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
81
97
|
statusBar?: Pick<BaseView, 'id' | 'name'> &
|
|
82
98
|
Required<Pick<BaseView, 'title' | 'label' | 'icon' | 'alignment'>>;
|
|
83
99
|
}
|
|
@@ -716,6 +732,16 @@ declare module 'punica' {
|
|
|
716
732
|
*/
|
|
717
733
|
export const manager: extensions.settings.SettingsApi;
|
|
718
734
|
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Localization engine for extension user interfaces.
|
|
738
|
+
*/
|
|
739
|
+
namespace i18n {
|
|
740
|
+
/**
|
|
741
|
+
* Localization façade surfaced via `punica.extensions.i18n.manager`.
|
|
742
|
+
*/
|
|
743
|
+
export const manager: extensions.i18n.I18nApi;
|
|
744
|
+
}
|
|
719
745
|
}
|
|
720
746
|
|
|
721
747
|
/**
|
|
@@ -809,5 +835,18 @@ declare module 'punica' {
|
|
|
809
835
|
*/
|
|
810
836
|
export const manager: SettingsApi;
|
|
811
837
|
}
|
|
838
|
+
|
|
839
|
+
/**
|
|
840
|
+
* Localization engine — see punica.module.extensions.i18n.d.ts.
|
|
841
|
+
*/
|
|
842
|
+
export namespace i18n {
|
|
843
|
+
export import I18nApi = extensions.i18n.I18nApi;
|
|
844
|
+
export import MessageBundle = extensions.i18n.MessageBundle;
|
|
845
|
+
export import MessageBundles = extensions.i18n.MessageBundles;
|
|
846
|
+
/**
|
|
847
|
+
* Localization façade surfaced via `punica.extensions.i18n.manager`.
|
|
848
|
+
*/
|
|
849
|
+
export const manager: I18nApi;
|
|
850
|
+
}
|
|
812
851
|
}
|
|
813
852
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
declare module 'punica' {
|
|
2
|
+
export namespace extensions {
|
|
3
|
+
/**
|
|
4
|
+
* Localization for extension user interfaces.
|
|
5
|
+
*
|
|
6
|
+
* The substrate owns the ENGINE — one active locale, one change event, one
|
|
7
|
+
* plural implementation — and extensions own only their dictionaries. The
|
|
8
|
+
* alternative, a helper copied into every extension, is how this fleet
|
|
9
|
+
* handles small utilities, but an engine is not a small utility: 80-odd
|
|
10
|
+
* copies of plural selection and fallback order drift apart, and the drift
|
|
11
|
+
* shows up as a half-translated screen rather than a failing build.
|
|
12
|
+
*
|
|
13
|
+
* The language is stored in the shared `system` / `ui.language` setting,
|
|
14
|
+
* the same namespace the theme lives in, so every extension resolves the
|
|
15
|
+
* same value. The set of offered languages comes from the active
|
|
16
|
+
* ApplicationProfile's `localization.supported` — a v1 slot that existed
|
|
17
|
+
* unused until this API filled it.
|
|
18
|
+
*/
|
|
19
|
+
export namespace i18n {
|
|
20
|
+
/** A dictionary: flat dot-separated keys to display strings. */
|
|
21
|
+
export type MessageBundle = Record<string, string>;
|
|
22
|
+
|
|
23
|
+
/** Locale tag (`en`, `tr`) to that locale's dictionary. */
|
|
24
|
+
export type MessageBundles = Record<string, MessageBundle>;
|
|
25
|
+
|
|
26
|
+
export interface I18nApi {
|
|
27
|
+
/**
|
|
28
|
+
* The active locale tag. Resolution order: the `ui.language` setting,
|
|
29
|
+
* then the app/OS language's subtag when it is supported, then the
|
|
30
|
+
* profile's declared default, then `'en'`.
|
|
31
|
+
*/
|
|
32
|
+
getLocale(): string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Change the language for the whole application. Writes
|
|
36
|
+
* `system` / `ui.language` at global scope and notifies subscribers;
|
|
37
|
+
* callers do not write the setting themselves.
|
|
38
|
+
*/
|
|
39
|
+
setLocale(locale: string): Promise<void>;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Languages this product offers, from the active profile's
|
|
43
|
+
* `localization.supported`. Falls back to `['en']` when the profile
|
|
44
|
+
* declares none.
|
|
45
|
+
*/
|
|
46
|
+
supportedLocales(): string[];
|
|
47
|
+
|
|
48
|
+
/** Subscribe to language changes. Returns an unsubscribe function. */
|
|
49
|
+
onDidChange(listener: (locale: string) => void): () => void;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Register an extension's dictionaries, keyed by locale tag. Call once
|
|
53
|
+
* during `activate()`, before anything renders. Registering again for
|
|
54
|
+
* the same extension replaces the previous bundles, so a reload during
|
|
55
|
+
* development does not accumulate stale strings.
|
|
56
|
+
*/
|
|
57
|
+
register(extensionName: string, bundles: MessageBundles): void;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Look up a message for a registered extension.
|
|
61
|
+
*
|
|
62
|
+
* `params` values are interpolated into `{name}` placeholders. A
|
|
63
|
+
* numeric `params.count` also selects a plural form: the lookup tries
|
|
64
|
+
* `<key>.<pluralCategory>` (via `Intl.PluralRules`) before `<key>`,
|
|
65
|
+
* which is what lets English say "1 attempt" / "2 attempts" while
|
|
66
|
+
* Turkish keeps one form after a numeral.
|
|
67
|
+
*
|
|
68
|
+
* Never throws. When no message is found — unregistered extension,
|
|
69
|
+
* unknown key, missing locale — the key itself is returned, because a
|
|
70
|
+
* visible key is greppable and cannot be mistaken for finished copy.
|
|
71
|
+
*/
|
|
72
|
+
t(
|
|
73
|
+
extensionName: string,
|
|
74
|
+
key: string,
|
|
75
|
+
params?: Record<string, string | number>
|
|
76
|
+
): string;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Localization façade surfaced via `punica.extensions.i18n.manager`. */
|
|
80
|
+
export const manager: I18nApi;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -4,6 +4,20 @@ declare module 'punica' {
|
|
|
4
4
|
type Alignment = 'primary' | 'secondary';
|
|
5
5
|
type ItemType = 'normal' | 'menu';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* Groups several activity items behind one icon. Declared per member —
|
|
9
|
+
* the substrate has no group table of its own, so what a group means
|
|
10
|
+
* (marketplaces, databases, …) stays in the manifests that opt in.
|
|
11
|
+
*/
|
|
12
|
+
interface IItemGroup {
|
|
13
|
+
/** Members sharing this id are drawn as a single icon. */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Tooltip of the group icon. First member to declare it wins; defaults to `id`. */
|
|
16
|
+
title?: string;
|
|
17
|
+
/** Group icon (raw HTML). First member to declare it wins; defaults to the first member's icon. */
|
|
18
|
+
icon?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
7
21
|
interface IItem {
|
|
8
22
|
id: string;
|
|
9
23
|
name: string;
|
|
@@ -31,6 +45,14 @@ declare module 'punica' {
|
|
|
31
45
|
* and the Capability Catalog. See `IActivityBarManager.syncContentTool`.
|
|
32
46
|
*/
|
|
33
47
|
contentViewType?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Collect this item into a group. While the group has one member the
|
|
50
|
+
* shell draws that member's own icon and click behaviour; when a
|
|
51
|
+
* second member joins, the icon becomes the group's and clicking it
|
|
52
|
+
* opens a flyout listing the members. Shells that predate grouping
|
|
53
|
+
* ignore the field and draw the item on its own, as before.
|
|
54
|
+
*/
|
|
55
|
+
group?: IItemGroup;
|
|
34
56
|
}
|
|
35
57
|
|
|
36
58
|
interface IActivityBarManager {
|