@punica/editor 1.5.0 → 1.6.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/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -132,4 +132,135 @@ export function bootstrap(options?: {
|
|
|
132
132
|
*/
|
|
133
133
|
export function start(): Promise<void>;
|
|
134
134
|
|
|
135
|
+
// ---------------------------------------------------------------------------
|
|
136
|
+
// Headless seam + substrate re-exports.
|
|
137
|
+
//
|
|
138
|
+
// These are the `@punica/editor` package's runtime exports consumed by an
|
|
139
|
+
// external shell package (`@punica/editor-shell-classic`) built as its own
|
|
140
|
+
// bundle with `@punica/editor` marked external. The corresponding runtime
|
|
141
|
+
// values live in `src/index.ts` (re-exported from `src/impl/core/*`).
|
|
142
|
+
|
|
143
|
+
/** Module lifecycle states (mirrors `core/moduleTypes.ts`). */
|
|
144
|
+
export enum ModuleLifecycleState {
|
|
145
|
+
CREATED = 'created',
|
|
146
|
+
BOOTSTRAPPING = 'bootstrapping',
|
|
147
|
+
BOOTSTRAPPED = 'bootstrapped',
|
|
148
|
+
BOOTSTRAP_FAILED = 'bootstrap_failed',
|
|
149
|
+
STARTING = 'starting',
|
|
150
|
+
STARTED = 'started',
|
|
151
|
+
START_FAILED = 'start_failed',
|
|
152
|
+
READY = 'ready'
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Module registry surface reachable from a module's lifecycle context. */
|
|
156
|
+
export interface IModuleRegistry {
|
|
157
|
+
register(module: IModule): void;
|
|
158
|
+
get(name: string): IModule | undefined;
|
|
159
|
+
getAll(): readonly IModule[];
|
|
160
|
+
resolveBootstrapOrder(): string[];
|
|
161
|
+
resolveStartOrder(): string[];
|
|
162
|
+
bootstrapAll(): Promise<void>;
|
|
163
|
+
startAll(): Promise<void>;
|
|
164
|
+
getState(moduleName: string): ModuleLifecycleState | undefined;
|
|
165
|
+
areAllModulesReady(): boolean;
|
|
166
|
+
detectPreBootstrapAccess(): string[];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Context passed to module lifecycle methods. */
|
|
170
|
+
export interface ModuleContext {
|
|
171
|
+
readonly phase: 'bootstrap' | 'start';
|
|
172
|
+
readonly punica: typeof import('punica');
|
|
173
|
+
readonly registry: IModuleRegistry;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/** Core module interface all Punica modules implement. */
|
|
177
|
+
export interface IModule {
|
|
178
|
+
readonly name: string;
|
|
179
|
+
readonly version: string;
|
|
180
|
+
readonly dependencies: readonly string[];
|
|
181
|
+
readonly state: ModuleLifecycleState;
|
|
182
|
+
bootstrap(context: ModuleContext): Promise<void>;
|
|
183
|
+
start(context: ModuleContext): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** A shell contribution registered via `registerShell()`. */
|
|
187
|
+
export interface ShellContribution {
|
|
188
|
+
facade?: Record<string, unknown>;
|
|
189
|
+
moduleFactories?: Record<string, () => IModule>;
|
|
190
|
+
profiles?: import('punica').shell.Profile.ApplicationProfile[];
|
|
191
|
+
defaultProfileId?: string;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Register a shell contribution (facade, profile-gated modules, profiles).
|
|
196
|
+
* Call after `initialize()` and before `bootstrap()`. Multiple calls
|
|
197
|
+
* accumulate.
|
|
198
|
+
*/
|
|
199
|
+
export function registerShell(contribution: ShellContribution): void;
|
|
200
|
+
|
|
201
|
+
/** Centralized module-name constants (`MODULE_NAMES.SHELL.LAYOUT`, …). */
|
|
202
|
+
export const MODULE_NAMES: {
|
|
203
|
+
readonly [group: string]: { readonly [key: string]: string };
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/** Centralized command-id constants (`COMMAND_IDS.WORKFLOW.RUN_START`, …). */
|
|
207
|
+
export const COMMAND_IDS: {
|
|
208
|
+
readonly [group: string]: { readonly [key: string]: string };
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/** True when running on a Mac platform (affects key-chord parsing). */
|
|
212
|
+
export function isMacPlatform(): boolean;
|
|
213
|
+
|
|
214
|
+
/** Parse a `'mod+shift+p'`-style chord into an `IKey`. */
|
|
215
|
+
export function parseKeyChord(
|
|
216
|
+
chord: string,
|
|
217
|
+
isMac?: boolean
|
|
218
|
+
): import('punica').shell.KeyboardShortcuts.IKey;
|
|
219
|
+
|
|
220
|
+
/** True while executing inside a headless UI-activation scope. */
|
|
221
|
+
export function isHeadlessScope(): boolean;
|
|
222
|
+
|
|
223
|
+
/** Enter a headless UI-activation scope (view reveals materialize hidden). */
|
|
224
|
+
export function enterHeadlessScope(): void;
|
|
225
|
+
|
|
226
|
+
/** Exit the current headless UI-activation scope. */
|
|
227
|
+
export function exitHeadlessScope(): void;
|
|
228
|
+
|
|
229
|
+
/** Run `fn` inside a headless UI-activation scope, restoring the prior scope. */
|
|
230
|
+
export function runInHeadlessScope<T>(fn: () => Promise<T>): Promise<T>;
|
|
231
|
+
|
|
232
|
+
/** Options for `emitShellEvent()`. */
|
|
233
|
+
export interface ShellEventOptions {
|
|
234
|
+
name: string;
|
|
235
|
+
source?: string;
|
|
236
|
+
correlationId?: string;
|
|
237
|
+
traceId?: string;
|
|
238
|
+
kind?: 'info' | 'warn' | 'error';
|
|
239
|
+
payload: Record<string, unknown>;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** Best-effort kernel-event emit from the shell/profile layer. */
|
|
243
|
+
export function emitShellEvent(opts: ShellEventOptions): boolean;
|
|
244
|
+
|
|
245
|
+
/** The core-owned ApplicationProfile mechanism (`punica.shell.Profile`). */
|
|
246
|
+
export const Profile: {
|
|
247
|
+
readonly manager: import('punica').shell.Profile.IProfileManager;
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/** ApplicationProfile validator interface (host-injectable). */
|
|
251
|
+
export interface IProfileValidator {
|
|
252
|
+
validate(data: unknown):
|
|
253
|
+
| {
|
|
254
|
+
valid: true;
|
|
255
|
+
profile: import('punica').shell.Profile.ApplicationProfile;
|
|
256
|
+
}
|
|
257
|
+
| { valid: false; errors: string[] };
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/** Returns the injected validator if set, else the minimal default. */
|
|
261
|
+
export function getProfileValidator(): IProfileValidator;
|
|
262
|
+
|
|
263
|
+
/** Inject a production-grade (e.g. Ajv-backed) profile validator. */
|
|
264
|
+
export function setProfileValidator(v: IProfileValidator): void;
|
|
265
|
+
|
|
135
266
|
export {};
|