@archilogic/extension-sdk 0.16.0 → 0.17.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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @archilogic/extension-sdk
2
2
 
3
+ ## 0.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 50b72f9: feat(extension-sdk): add a settings-change event carrying the host display units
8
+
3
9
  ## 0.16.0
4
10
 
5
11
  ### Minor Changes
package/dist/actions.d.ts CHANGED
@@ -892,6 +892,8 @@ declare type ExtensionApi = {
892
892
  modifiers?: CanvasModifiers;
893
893
  }): void;
894
894
  onCanvasChange(change: CanvasChange): void;
895
+ /** The host's display settings changed — e.g. the user switched measurement units. Optional: extensions built before settings forwarding don't expose it, and hosts feature-check before calling. */
896
+ onSettingsChange?(settings: HostSettings): void;
895
897
  /** The user pressed a declared control of the running custom action. */
896
898
  onActionControl(args: {
897
899
  runId: string;
@@ -915,6 +917,7 @@ declare type ExtensionEventMap = {
915
917
  'canvas-click': Parameters<ExtensionApi['onCanvasClick']>[0];
916
918
  'canvas-mousemove': Parameters<ExtensionApi['onCanvasMouseMove']>[0];
917
919
  'canvas-change': Parameters<ExtensionApi['onCanvasChange']>[0];
920
+ 'settings-change': HostSettings;
918
921
  'action-control': Parameters<ExtensionApi['onActionControl']>[0];
919
922
  'action-end': Parameters<ExtensionApi['onActionEnd']>[0];
920
923
  };
@@ -1445,6 +1448,21 @@ declare type HostApi = {
1445
1448
  off: <K extends ExtensionEventKey>(event: K, listener?: ExtensionEventListener<K>) => void;
1446
1449
  };
1447
1450
 
1451
+ /**
1452
+ * Display settings of the host, sent in the `onConnect` parameters (as `settings`) and again on
1453
+ * every change via `onSettingsChange` — so an extension can render measurements the way the
1454
+ * host does instead of hardcoding a unit system.
1455
+ */
1456
+ declare type HostSettings = {
1457
+ units?: {
1458
+ system?: 'metric' | 'imperial';
1459
+ /** Decimal places the host displays area values with. */
1460
+ areaDecimals?: number;
1461
+ /** Decimal places the host displays length values with. */
1462
+ lengthDecimals?: number;
1463
+ };
1464
+ };
1465
+
1448
1466
  /**
1449
1467
  * A resolved icon placed in the plan — first-class in fpe's render
1450
1468
  * vocabulary so every renderer consumes the icon svg natively instead of
package/dist/index.d.ts CHANGED
@@ -799,6 +799,8 @@ export declare type ExtensionApi = {
799
799
  modifiers?: CanvasModifiers;
800
800
  }): void;
801
801
  onCanvasChange(change: CanvasChange): void;
802
+ /** The host's display settings changed — e.g. the user switched measurement units. Optional: extensions built before settings forwarding don't expose it, and hosts feature-check before calling. */
803
+ onSettingsChange?(settings: HostSettings): void;
802
804
  /** The user pressed a declared control of the running custom action. */
803
805
  onActionControl(args: {
804
806
  runId: string;
@@ -822,6 +824,7 @@ declare type ExtensionEventMap = {
822
824
  'canvas-click': Parameters<ExtensionApi['onCanvasClick']>[0];
823
825
  'canvas-mousemove': Parameters<ExtensionApi['onCanvasMouseMove']>[0];
824
826
  'canvas-change': Parameters<ExtensionApi['onCanvasChange']>[0];
827
+ 'settings-change': HostSettings;
825
828
  'action-control': Parameters<ExtensionApi['onActionControl']>[0];
826
829
  'action-end': Parameters<ExtensionApi['onActionEnd']>[0];
827
830
  };
@@ -1352,6 +1355,21 @@ export declare type HostApi = {
1352
1355
  off: <K extends ExtensionEventKey>(event: K, listener?: ExtensionEventListener<K>) => void;
1353
1356
  };
1354
1357
 
1358
+ /**
1359
+ * Display settings of the host, sent in the `onConnect` parameters (as `settings`) and again on
1360
+ * every change via `onSettingsChange` — so an extension can render measurements the way the
1361
+ * host does instead of hardcoding a unit system.
1362
+ */
1363
+ export declare type HostSettings = {
1364
+ units?: {
1365
+ system?: 'metric' | 'imperial';
1366
+ /** Decimal places the host displays area values with. */
1367
+ areaDecimals?: number;
1368
+ /** Decimal places the host displays length values with. */
1369
+ lengthDecimals?: number;
1370
+ };
1371
+ };
1372
+
1355
1373
  /**
1356
1374
  * A resolved icon placed in the plan — first-class in fpe's render
1357
1375
  * vocabulary so every renderer consumes the icon svg natively instead of
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@archilogic/extension-sdk",
3
3
  "description": "",
4
- "version": "0.16.0",
4
+ "version": "0.17.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },