@mica-js/editor 0.6.0 → 0.7.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.
@@ -1,3 +1,3 @@
1
1
  import { c as toWireFailure, i as isFusedBridgeError, n as FusedBridgeError, o as mapWireFailure, r as fromWireFailure, t as FUSED_WIRE_FAILURE } from "./wire-BDHL5Aj9.js";
2
- import { _ as fusedModelSinkService, a as createFusedRuntime, c as createModelEventRouter, d as createHostPackageGateway, f as packageLockKey, g as fusedModelChannelService, h as fusedHostResourceService, i as startFusedSimulationGuest, l as createFusedDisplay, m as fusedHostPackageService, n as startFusedDisplayGuest, o as createHostModelRouter, p as fusedDisplayService, r as createViewSession, s as channelKey, t as loadFusedWorkerFactories, u as connectFusedWorkbench, v as fusedSimulationService } from "./runtime-CE38_qhr.js";
2
+ import { _ as fusedModelSinkService, a as createFusedRuntime, c as createModelEventRouter, d as createHostPackageGateway, f as packageLockKey, g as fusedModelChannelService, h as fusedHostResourceService, i as startFusedSimulationGuest, l as createFusedDisplay, m as fusedHostPackageService, n as startFusedDisplayGuest, o as createHostModelRouter, p as fusedDisplayService, r as createViewSession, s as channelKey, t as loadFusedWorkerFactories, u as connectFusedWorkbench, v as fusedSimulationService } from "./runtime-DV_lH_Yd.js";
3
3
  export { FUSED_WIRE_FAILURE, FusedBridgeError, channelKey, connectFusedWorkbench, createFusedDisplay, createFusedRuntime, createHostModelRouter, createHostPackageGateway, createModelEventRouter, createViewSession, fromWireFailure, fusedDisplayService, fusedHostPackageService, fusedHostResourceService, fusedModelChannelService, fusedModelSinkService, fusedSimulationService, isFusedBridgeError, loadFusedWorkerFactories, mapWireFailure, packageLockKey, startFusedDisplayGuest, startFusedSimulationGuest, toWireFailure };
package/dist/fused.d.ts CHANGED
@@ -4,6 +4,7 @@ import { Endpoint } from '@mica-js/document/fused';
4
4
  import { Event as Event_2 } from '@mica-js/core/lifecycle';
5
5
  import { WidgetAudioState as FusedAudioState } from '@mica-js/widget/audio-guest';
6
6
  import { FusedDocument } from '@mica-js/document/fused';
7
+ import { Geometry2D } from '@mica-js/document/fused';
7
8
  import { DeviceRegistry as IDeviceProvider } from '@mica-js/document/fused';
8
9
  import { IDisposable } from '@mica-js/core/lifecycle';
9
10
  import { WidgetAudioControls as IFusedAudioControls } from '@mica-js/widget/audio-host';
@@ -14,6 +15,7 @@ import { WidgetAudioToneOptions as IFusedAudioToneOptions } from '@mica-js/widge
14
15
  import { InstanceViewLayout } from '@mica-js/document/fused';
15
16
  import { Placement2D } from '@mica-js/document/fused';
16
17
  import { Point2D } from '@mica-js/document/fused';
18
+ import { ProgramFile } from '@mica-js/sdk/fused';
17
19
  import { ProgramSources } from '@mica-js/sdk/fused';
18
20
  import { PropertyValue } from '@mica-js/document/fused';
19
21
  import { TimePs } from '@mica-js/core';
@@ -92,6 +94,18 @@ export { FusedAudioState }
92
94
 
93
95
  export { FusedDocument }
94
96
 
97
+ /** Read-only plain property snapshot handed to a 2D presentation. */
98
+ declare type FusedPresentationProps = Readonly<Record<string, FusedPresentationValue>>;
99
+
100
+ /**
101
+ * One resolved property value a presentation may read.
102
+ *
103
+ * Scalars stay plain; `image` and `binary` properties are their resolved bytes; `firmware`
104
+ * properties are the loaded, segment-addressable snapshot. Resolution happens in the simulation
105
+ * worker, so an unresolved property rejects the presentation instead of shrinking its props.
106
+ */
107
+ declare type FusedPresentationValue = string | number | boolean | null | Uint8Array | IFusedFirmwareSnapshot | IFusedProgramFilesSnapshot;
108
+
95
109
  /** Session status the host mirrors; `idle` means no models are mounted (edit mode). */
96
110
  declare type FusedSessionStatus = 'idle' | 'paused' | 'running' | 'faulted' | 'disposed';
97
111
 
@@ -251,6 +265,61 @@ export { IFusedAudioTone }
251
265
 
252
266
  export { IFusedAudioToneOptions }
253
267
 
268
+ /** Pixels per local unit and the overlay extent the host reserves for one instance. */
269
+ declare interface IFusedDisplayLayout {
270
+ /** Overlay width in device pixels. */
271
+ readonly width: number;
272
+ /** Overlay height in device pixels. */
273
+ readonly height: number;
274
+ /** Device pixels per local unit. */
275
+ readonly scale: number;
276
+ }
277
+
278
+ /** One loaded firmware segment of a presentation snapshot (RFC 0026). */
279
+ declare interface IFusedFirmwareSegment {
280
+ readonly addressSpace: string;
281
+ readonly address: number;
282
+ /** Segment bytes; an independent copy owned by the presentation snapshot. */
283
+ readonly bytes: Uint8Array;
284
+ }
285
+
286
+ /** Read-only firmware snapshot a presentation may read (RFC 0026). */
287
+ declare interface IFusedFirmwareSnapshot {
288
+ readonly kind: 'firmware';
289
+ readonly segments: readonly IFusedFirmwareSegment[];
290
+ }
291
+
292
+ /**
293
+ * Everything the display worker needs to prepare one instance.
294
+ *
295
+ * Geometry and the property projection are resolved inside the simulation worker, so the host never
296
+ * parses a manifest or evaluates an author module.
297
+ */
298
+ declare interface IFusedInstancePresentation {
299
+ readonly instanceId: string;
300
+ /** Full `publisher:name` device id the instance locks. */
301
+ readonly device: string;
302
+ readonly lock: DeviceLock;
303
+ readonly geometry: Geometry2D;
304
+ /** Package-root relative `.js` overlay entry; `undefined` for a geometry-only device. */
305
+ readonly view: string | undefined;
306
+ /**
307
+ * Resolved property snapshot, identical to the one the model receives: manifest default and
308
+ * document override through the SDK, with resource bytes and the loaded firmware image. An
309
+ * instance whose props cannot be projected has no presentation at all, so this is never partial.
310
+ */
311
+ readonly props: FusedPresentationProps;
312
+ /** Declared model method names; empty for a device without a model. */
313
+ readonly methods: readonly string[];
314
+ /** Declared model event names; empty for a device without a model. */
315
+ readonly events: readonly string[];
316
+ }
317
+
318
+ declare interface IFusedProgramFilesSnapshot {
319
+ readonly kind: 'filesystem';
320
+ readonly files: readonly ProgramFile[];
321
+ }
322
+
254
323
  declare interface IFusedTextTarget {
255
324
  readonly kind: 'designator' | 'label' | 'reference';
256
325
  readonly id: string;
@@ -444,6 +513,13 @@ export declare interface IWorkbenchOptions {
444
513
  readonly theme?: WorkbenchTheme;
445
514
  readonly readOnly?: boolean;
446
515
  readonly step?: TimePs;
516
+ /**
517
+ * Overlay extent of one instance; defaults to its geometry bounds at one pixel per local unit.
518
+ *
519
+ * Physical devices express geometry in millimetres, so a board-sized package needs a higher
520
+ * density than the default to stay legible.
521
+ */
522
+ readonly measure?: (instance: IFusedInstancePresentation) => IFusedDisplayLayout;
447
523
  readonly contributions?: IWorkbenchContributions;
448
524
  }
449
525
 
package/dist/fused.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { c as planPolylineSegmentDrag, n as orthogonalWaypoints, t as extendWirePath } from "./wire-JZIiIOI0.js";
2
2
  import { Q as isHtmlViewError, _ as resolveTheme, a as createHtmlViewHost, f as WORKBENCH_DARK_COLORS, g as readCanvasTheme, h as normalizeTheme, m as WORKBENCH_THEME_CSS_VARIABLES, p as WORKBENCH_LIGHT_COLORS, v as themeStyle } from "./html-HXwZq1my.js";
3
- import { a as createFusedRuntime } from "./runtime-CE38_qhr.js";
3
+ import { a as createFusedRuntime } from "./runtime-DV_lH_Yd.js";
4
4
  import { DisposableStore, Emitter } from "@mica-js/core/lifecycle";
5
5
  import { projectOnSegment } from "@mica-js/document/schematic";
6
6
  import { timePs } from "@mica-js/core";
@@ -6473,6 +6473,7 @@ async function createWorkbench(options) {
6473
6473
  mode: targetMode,
6474
6474
  container: environment,
6475
6475
  ...options.programs === void 0 ? {} : { programs: options.programs },
6476
+ ...options.measure === void 0 ? {} : { measure: options.measure },
6476
6477
  resolveResource: (request) => {
6477
6478
  if (request.reference.mode !== "asset" || options.assetProvider === void 0) throw new Error("No asset provider is configured");
6478
6479
  return options.assetProvider.read(request.reference.assetId, abort.signal);