@moonbase.sh/gorilla-engine 0.0.0-next-20261028214425

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.
@@ -0,0 +1,187 @@
1
+ import { ActivationUiOptions, ActivationControllerOptions, ActivationScreen, ActivationController, ActivationState } from '@moonbase.sh/licensing';
2
+ export { ActivationScreen, ActivationState, ActivationStrings, ActivationUiOptions, TrialFeature } from '@moonbase.sh/licensing';
3
+ import { ReactElement } from 'react';
4
+
5
+ /** How the update download is going, as the update screen shows it. */
6
+ interface DownloadState {
7
+ phase: 'idle' | 'downloading' | 'done' | 'failed' | 'notCovered';
8
+ progress: number | null;
9
+ path: string | null;
10
+ error: string | null;
11
+ /** For `notCovered`: what the customer's licenses cover, and where to upgrade. */
12
+ releaseAccess: unknown;
13
+ upgradeUrl: string | null;
14
+ }
15
+
16
+ /**
17
+ * Where a Gorilla Engine plugin keeps the license by default: the manufacturer's
18
+ * folder for user data, as Gorilla Engine's own Product Hub library does.
19
+ * `~/Library/Application Support/<manufacturer>/<plugin>/license.mb` on macOS and
20
+ * `%APPDATA%\<manufacturer>\<plugin>\license.mb` on Windows.
21
+ */
22
+ declare function defaultLicenseFile(): string;
23
+ /** Branding and behaviour of the built-in activation overlay. */
24
+ interface GorillaEngineUiOptions extends ActivationUiOptions {
25
+ /**
26
+ * The product mark in the header: an image among the plugin's assets, such as
27
+ * `images/logo.png`. Without one, a sun mark is drawn in the accent colour.
28
+ */
29
+ logo?: string;
30
+ /**
31
+ * The plugin's fonts, as paths among its assets (`fonts/Inter-Regular.otf`).
32
+ * Gorilla Engine draws with the system's font otherwise.
33
+ */
34
+ fonts?: {
35
+ regular?: string;
36
+ medium?: string;
37
+ semibold?: string;
38
+ mono?: string;
39
+ };
40
+ }
41
+ /** What {@link MoonbaseGorillaEngine} is built from. */
42
+ interface MoonbaseGorillaEngineOptions extends Omit<ActivationControllerOptions, 'licenseFile' | 'openUrl' | 'productName' | 'accountName'> {
43
+ /** Where the license is kept. Defaults to {@link defaultLicenseFile}. */
44
+ licenseFile?: string;
45
+ /** Opens a link in the browser. Defaults to Gorilla Engine's `openURLinBrowser`. */
46
+ openUrl?: (url: string) => void | Promise<void>;
47
+ /**
48
+ * Turn the plugin's MIDI and audio on while it is licensed (a license or a
49
+ * trial) and off while it is not, through `GorillaEngine.getPluginMM` and
50
+ * `getPluginAE`. Pair it with Gorilla Compiler's copy protection setting that
51
+ * keeps them off at startup. On by default.
52
+ */
53
+ lockAudioAndMidi?: boolean;
54
+ /** The built-in activation overlay's branding and behaviour. */
55
+ ui?: GorillaEngineUiOptions;
56
+ }
57
+ /** What the activation overlay shows, besides the license state. */
58
+ interface ActivationUiState {
59
+ /** Whether the overlay is up. */
60
+ visible: boolean;
61
+ /** The screen it was last asked to open on, and a count that moves with every ask. */
62
+ screen: ActivationScreen | null;
63
+ request: number;
64
+ download: DownloadState;
65
+ }
66
+ /**
67
+ * Moonbase licensing for a Gorilla Engine plugin: the {@link ActivationController},
68
+ * with Gorilla Engine's runtime for the browser, file dialogs and the plugin's
69
+ * MIDI and audio, and the state behind the `MoonbaseActivation` overlay.
70
+ *
71
+ * Create one per plugin instance, before rendering, and call {@link start}.
72
+ * Instances share the license file, so activating in one unlocks the others
73
+ * within a few seconds.
74
+ */
75
+ declare class MoonbaseGorillaEngine extends ActivationController {
76
+ /** The overlay's branding and behaviour. */
77
+ readonly ui: GorillaEngineUiOptions;
78
+ /** The endpoint, for the overlay's links. */
79
+ readonly endpoint: string;
80
+ private readonly lockAudioAndMidi;
81
+ private readonly uiListeners;
82
+ private uiState;
83
+ private lastLicensed;
84
+ private gated;
85
+ private downloaded;
86
+ private name;
87
+ constructor(options: MoonbaseGorillaEngineOptions);
88
+ /**
89
+ * Validate the stored license, start watching it, and bring the overlay up
90
+ * when the plugin has no license. Call once per plugin instance.
91
+ */
92
+ start(): void;
93
+ /** This computer's name, as the activation screen shows it. */
94
+ get deviceName(): string;
95
+ /** What the overlay shows, besides the license state. */
96
+ uiSnapshot(): ActivationUiState;
97
+ /** Called whenever {@link uiSnapshot} changes. Returns a function that stops it. */
98
+ subscribeUi(listener: () => void): () => void;
99
+ private setUi;
100
+ private afterStateChange;
101
+ /**
102
+ * Show the activation overlay, optionally on a particular screen. Without one
103
+ * it shows whatever the license state calls for.
104
+ */
105
+ present(screen?: ActivationScreen): void;
106
+ /** Take the overlay down. */
107
+ closeUi(): void;
108
+ /** Copy text to the clipboard, for the activation link and the license id. */
109
+ copyText(text: string): Promise<void>;
110
+ /** Show a file in the file manager. */
111
+ reveal(file: string): Promise<void>;
112
+ private downloadsFolder;
113
+ /**
114
+ * Save the machine file for offline activation: through Gorilla Engine's save
115
+ * dialog, or into Downloads, shown in the file manager. Null when the customer
116
+ * cancels.
117
+ */
118
+ saveMachineFile(): Promise<string | null>;
119
+ /** Pick the license file the customer got back for offline activation. Null when they cancel. */
120
+ chooseLicenseFile(): Promise<{
121
+ name: string;
122
+ text: string;
123
+ } | null>;
124
+ /** Read a license file the customer dropped or picked. */
125
+ readLicenseFile(file: string): Promise<{
126
+ name: string;
127
+ text: string;
128
+ }>;
129
+ /**
130
+ * Download the latest installer for this platform into Downloads, reporting
131
+ * progress to the overlay, then show it in the file manager.
132
+ */
133
+ downloadUpdate(): Promise<void>;
134
+ /** Show the downloaded installer in the file manager again. */
135
+ revealUpdate(): Promise<void>;
136
+ /**
137
+ * Open a link from the overlay in the browser: the pending activation, the
138
+ * store, or Moonbase's site from the footer.
139
+ */
140
+ openLink(url: string): Promise<void>;
141
+ }
142
+ /**
143
+ * Moonbase licensing for a Gorilla Engine plugin:
144
+ *
145
+ * ```ts
146
+ * import { createMoonbase } from '@moonbase.sh/gorilla-engine'
147
+ *
148
+ * const moonbase = createMoonbase({
149
+ * endpoint: 'https://your-store.moonbase.sh',
150
+ * productId: 'your-product',
151
+ * publicKey: MOONBASE_PUBLIC_KEY,
152
+ * appVersion: '1.2.0',
153
+ * ui: { productName: 'Solstice', manufacturerName: 'Helio Audio' },
154
+ * })
155
+ * moonbase.start()
156
+ * ```
157
+ */
158
+ declare function createMoonbase(options: MoonbaseGorillaEngineOptions): MoonbaseGorillaEngine;
159
+
160
+ /** The license state, kept current: for gating features in the plugin's own UI. */
161
+ declare function useMoonbaseState(moonbase: MoonbaseGorillaEngine): ActivationState;
162
+ /** Props of {@link MoonbaseActivation}. */
163
+ interface MoonbaseActivationProps {
164
+ moonbase: MoonbaseGorillaEngine;
165
+ /** The plugin window's size: the overlay covers it. */
166
+ width: number;
167
+ height: number;
168
+ x?: number;
169
+ y?: number;
170
+ }
171
+ /**
172
+ * The activation overlay: the "Solstice Activation" screens in a panel over the
173
+ * plugin's interface, which it covers and takes every click from while it is up.
174
+ * It comes up by itself while the plugin has no license, and cannot be closed
175
+ * until it has one; `moonbase.present()` brings it up on demand. Render it last,
176
+ * over everything else:
177
+ *
178
+ * ```tsx
179
+ * <geLabel width={920} height={590}>
180
+ * <PluginUI />
181
+ * <MoonbaseActivation moonbase={moonbase} width={920} height={590} />
182
+ * </geLabel>
183
+ * ```
184
+ */
185
+ declare function MoonbaseActivation(props: MoonbaseActivationProps): ReactElement | null;
186
+
187
+ export { type ActivationUiState, type GorillaEngineUiOptions, MoonbaseActivation, type MoonbaseActivationProps, MoonbaseGorillaEngine, type MoonbaseGorillaEngineOptions, createMoonbase, defaultLicenseFile, useMoonbaseState };
@@ -0,0 +1,187 @@
1
+ import { ActivationUiOptions, ActivationControllerOptions, ActivationScreen, ActivationController, ActivationState } from '@moonbase.sh/licensing';
2
+ export { ActivationScreen, ActivationState, ActivationStrings, ActivationUiOptions, TrialFeature } from '@moonbase.sh/licensing';
3
+ import { ReactElement } from 'react';
4
+
5
+ /** How the update download is going, as the update screen shows it. */
6
+ interface DownloadState {
7
+ phase: 'idle' | 'downloading' | 'done' | 'failed' | 'notCovered';
8
+ progress: number | null;
9
+ path: string | null;
10
+ error: string | null;
11
+ /** For `notCovered`: what the customer's licenses cover, and where to upgrade. */
12
+ releaseAccess: unknown;
13
+ upgradeUrl: string | null;
14
+ }
15
+
16
+ /**
17
+ * Where a Gorilla Engine plugin keeps the license by default: the manufacturer's
18
+ * folder for user data, as Gorilla Engine's own Product Hub library does.
19
+ * `~/Library/Application Support/<manufacturer>/<plugin>/license.mb` on macOS and
20
+ * `%APPDATA%\<manufacturer>\<plugin>\license.mb` on Windows.
21
+ */
22
+ declare function defaultLicenseFile(): string;
23
+ /** Branding and behaviour of the built-in activation overlay. */
24
+ interface GorillaEngineUiOptions extends ActivationUiOptions {
25
+ /**
26
+ * The product mark in the header: an image among the plugin's assets, such as
27
+ * `images/logo.png`. Without one, a sun mark is drawn in the accent colour.
28
+ */
29
+ logo?: string;
30
+ /**
31
+ * The plugin's fonts, as paths among its assets (`fonts/Inter-Regular.otf`).
32
+ * Gorilla Engine draws with the system's font otherwise.
33
+ */
34
+ fonts?: {
35
+ regular?: string;
36
+ medium?: string;
37
+ semibold?: string;
38
+ mono?: string;
39
+ };
40
+ }
41
+ /** What {@link MoonbaseGorillaEngine} is built from. */
42
+ interface MoonbaseGorillaEngineOptions extends Omit<ActivationControllerOptions, 'licenseFile' | 'openUrl' | 'productName' | 'accountName'> {
43
+ /** Where the license is kept. Defaults to {@link defaultLicenseFile}. */
44
+ licenseFile?: string;
45
+ /** Opens a link in the browser. Defaults to Gorilla Engine's `openURLinBrowser`. */
46
+ openUrl?: (url: string) => void | Promise<void>;
47
+ /**
48
+ * Turn the plugin's MIDI and audio on while it is licensed (a license or a
49
+ * trial) and off while it is not, through `GorillaEngine.getPluginMM` and
50
+ * `getPluginAE`. Pair it with Gorilla Compiler's copy protection setting that
51
+ * keeps them off at startup. On by default.
52
+ */
53
+ lockAudioAndMidi?: boolean;
54
+ /** The built-in activation overlay's branding and behaviour. */
55
+ ui?: GorillaEngineUiOptions;
56
+ }
57
+ /** What the activation overlay shows, besides the license state. */
58
+ interface ActivationUiState {
59
+ /** Whether the overlay is up. */
60
+ visible: boolean;
61
+ /** The screen it was last asked to open on, and a count that moves with every ask. */
62
+ screen: ActivationScreen | null;
63
+ request: number;
64
+ download: DownloadState;
65
+ }
66
+ /**
67
+ * Moonbase licensing for a Gorilla Engine plugin: the {@link ActivationController},
68
+ * with Gorilla Engine's runtime for the browser, file dialogs and the plugin's
69
+ * MIDI and audio, and the state behind the `MoonbaseActivation` overlay.
70
+ *
71
+ * Create one per plugin instance, before rendering, and call {@link start}.
72
+ * Instances share the license file, so activating in one unlocks the others
73
+ * within a few seconds.
74
+ */
75
+ declare class MoonbaseGorillaEngine extends ActivationController {
76
+ /** The overlay's branding and behaviour. */
77
+ readonly ui: GorillaEngineUiOptions;
78
+ /** The endpoint, for the overlay's links. */
79
+ readonly endpoint: string;
80
+ private readonly lockAudioAndMidi;
81
+ private readonly uiListeners;
82
+ private uiState;
83
+ private lastLicensed;
84
+ private gated;
85
+ private downloaded;
86
+ private name;
87
+ constructor(options: MoonbaseGorillaEngineOptions);
88
+ /**
89
+ * Validate the stored license, start watching it, and bring the overlay up
90
+ * when the plugin has no license. Call once per plugin instance.
91
+ */
92
+ start(): void;
93
+ /** This computer's name, as the activation screen shows it. */
94
+ get deviceName(): string;
95
+ /** What the overlay shows, besides the license state. */
96
+ uiSnapshot(): ActivationUiState;
97
+ /** Called whenever {@link uiSnapshot} changes. Returns a function that stops it. */
98
+ subscribeUi(listener: () => void): () => void;
99
+ private setUi;
100
+ private afterStateChange;
101
+ /**
102
+ * Show the activation overlay, optionally on a particular screen. Without one
103
+ * it shows whatever the license state calls for.
104
+ */
105
+ present(screen?: ActivationScreen): void;
106
+ /** Take the overlay down. */
107
+ closeUi(): void;
108
+ /** Copy text to the clipboard, for the activation link and the license id. */
109
+ copyText(text: string): Promise<void>;
110
+ /** Show a file in the file manager. */
111
+ reveal(file: string): Promise<void>;
112
+ private downloadsFolder;
113
+ /**
114
+ * Save the machine file for offline activation: through Gorilla Engine's save
115
+ * dialog, or into Downloads, shown in the file manager. Null when the customer
116
+ * cancels.
117
+ */
118
+ saveMachineFile(): Promise<string | null>;
119
+ /** Pick the license file the customer got back for offline activation. Null when they cancel. */
120
+ chooseLicenseFile(): Promise<{
121
+ name: string;
122
+ text: string;
123
+ } | null>;
124
+ /** Read a license file the customer dropped or picked. */
125
+ readLicenseFile(file: string): Promise<{
126
+ name: string;
127
+ text: string;
128
+ }>;
129
+ /**
130
+ * Download the latest installer for this platform into Downloads, reporting
131
+ * progress to the overlay, then show it in the file manager.
132
+ */
133
+ downloadUpdate(): Promise<void>;
134
+ /** Show the downloaded installer in the file manager again. */
135
+ revealUpdate(): Promise<void>;
136
+ /**
137
+ * Open a link from the overlay in the browser: the pending activation, the
138
+ * store, or Moonbase's site from the footer.
139
+ */
140
+ openLink(url: string): Promise<void>;
141
+ }
142
+ /**
143
+ * Moonbase licensing for a Gorilla Engine plugin:
144
+ *
145
+ * ```ts
146
+ * import { createMoonbase } from '@moonbase.sh/gorilla-engine'
147
+ *
148
+ * const moonbase = createMoonbase({
149
+ * endpoint: 'https://your-store.moonbase.sh',
150
+ * productId: 'your-product',
151
+ * publicKey: MOONBASE_PUBLIC_KEY,
152
+ * appVersion: '1.2.0',
153
+ * ui: { productName: 'Solstice', manufacturerName: 'Helio Audio' },
154
+ * })
155
+ * moonbase.start()
156
+ * ```
157
+ */
158
+ declare function createMoonbase(options: MoonbaseGorillaEngineOptions): MoonbaseGorillaEngine;
159
+
160
+ /** The license state, kept current: for gating features in the plugin's own UI. */
161
+ declare function useMoonbaseState(moonbase: MoonbaseGorillaEngine): ActivationState;
162
+ /** Props of {@link MoonbaseActivation}. */
163
+ interface MoonbaseActivationProps {
164
+ moonbase: MoonbaseGorillaEngine;
165
+ /** The plugin window's size: the overlay covers it. */
166
+ width: number;
167
+ height: number;
168
+ x?: number;
169
+ y?: number;
170
+ }
171
+ /**
172
+ * The activation overlay: the "Solstice Activation" screens in a panel over the
173
+ * plugin's interface, which it covers and takes every click from while it is up.
174
+ * It comes up by itself while the plugin has no license, and cannot be closed
175
+ * until it has one; `moonbase.present()` brings it up on demand. Render it last,
176
+ * over everything else:
177
+ *
178
+ * ```tsx
179
+ * <geLabel width={920} height={590}>
180
+ * <PluginUI />
181
+ * <MoonbaseActivation moonbase={moonbase} width={920} height={590} />
182
+ * </geLabel>
183
+ * ```
184
+ */
185
+ declare function MoonbaseActivation(props: MoonbaseActivationProps): ReactElement | null;
186
+
187
+ export { type ActivationUiState, type GorillaEngineUiOptions, MoonbaseActivation, type MoonbaseActivationProps, MoonbaseGorillaEngine, type MoonbaseGorillaEngineOptions, createMoonbase, defaultLicenseFile, useMoonbaseState };