lucid-extension-sdk 0.0.123 → 0.0.125

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.123",
3
+ "version": "0.0.125",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "sdk/index.js",
6
6
  "types": "sdk/index.d.ts",
@@ -501,6 +501,8 @@ export declare type AddCardIntegrationQuery = {
501
501
  'isl': string;
502
502
  /** Icon url */
503
503
  'u': string;
504
+ /** Text style */
505
+ 'ts'?: Partial<TextStyle> | undefined;
504
506
  /** Field configuration */
505
507
  'fc': {
506
508
  /** Callback to get field definitions for all fields supported by the card integration */
@@ -991,6 +993,8 @@ export declare type RegisterPanelQuery = {
991
993
  'i': string;
992
994
  /** tooltip */
993
995
  'to'?: string;
996
+ /** If true, we will persist the panel's iframe */
997
+ 'p'?: boolean;
994
998
  };
995
999
  export declare type RegisterPanelResult = undefined;
996
1000
  export declare type RegisterUnfurlQuery = {
@@ -1,3 +1,4 @@
1
+ import { TextStyle } from '../../document/text/textstyle';
1
2
  import { LucidCardFieldDisplaySettings, SerializedLucidCardFieldDisplaySettings } from './cardfielddisplaysettings';
2
3
  export interface CardIntegrationConfig {
3
4
  cardConfig: {
@@ -5,6 +6,11 @@ export interface CardIntegrationConfig {
5
6
  * The data fields to be displayed on cards, as data-linked text fields
6
7
  */
7
8
  fieldNames: string[];
9
+ /**
10
+ * The default text style to set on each of the above fields for new cards. Any style not specified
11
+ * will use a default value, and any field name not present will use all defaults.
12
+ */
13
+ fieldStyles?: Map<string, Partial<TextStyle>>;
8
14
  /**
9
15
  * The data fields to be displayed on cards as data graphics
10
16
  */
@@ -30,7 +36,8 @@ export interface CardIntegrationConfig {
30
36
  export declare type SerializedCardIntegrationConfig = {
31
37
  'cc': {
32
38
  'f': string[];
33
- 'fd'?: [string, SerializedLucidCardFieldDisplaySettings][];
39
+ 'fd'?: [string, SerializedLucidCardFieldDisplaySettings][] | undefined;
40
+ 'fs'?: [string, Partial<TextStyle>][] | undefined;
34
41
  'id'?: string | undefined;
35
42
  };
36
43
  'cdpc': {
@@ -13,6 +13,7 @@ function serializeCardIntegrationConfig(config) {
13
13
  (0, cardfielddisplaysettings_1.serializeLucidCardFieldDisplaySettings)(settings),
14
14
  ])
15
15
  : undefined,
16
+ 'fs': config.cardConfig.fieldStyles ? [...config.cardConfig.fieldStyles] : undefined,
16
17
  },
17
18
  'cdpc': {
18
19
  'f': config.cardDetailsPanelConfig.fields.map((field) => {
@@ -30,6 +31,7 @@ function deserializeCardIntegrationConfig(raw) {
30
31
  return {
31
32
  cardConfig: {
32
33
  fieldNames: raw['cc']['f'],
34
+ fieldStyles: raw['cc']['fs'] ? new Map(raw['cc']['fs']) : undefined,
33
35
  fieldDisplaySettings: raw['cc']['fd']
34
36
  ? new Map(raw['cc']['fd'].map(([key, settings]) => [
35
37
  key,
@@ -1,6 +1,7 @@
1
1
  import { CollectionDefinition } from '../../data/collectiondefinition';
2
2
  import { CollectionProxy } from '../../data/collectionproxy';
3
3
  import { DataSourceProxy } from '../../data/datasourceproxy';
4
+ import { TextStyle } from '../../document/text/textstyle';
4
5
  import { EditorClient } from '../../editorclient';
5
6
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
6
7
  import { CardIntegrationConfig } from './cardintegrationconfig';
@@ -29,6 +30,12 @@ export declare abstract class LucidCardIntegration {
29
30
  * The name of the data connector associated with the card integration.
30
31
  */
31
32
  abstract dataConnectorName: string;
33
+ /**
34
+ * The default text style to use on cards created as part of this integration.
35
+ * These can be overridden by values in getDefaultConfig().fieldStyles for
36
+ * individual fields that should have different styles.
37
+ */
38
+ textStyle?: Partial<TextStyle>;
32
39
  abstract fieldConfiguration: {
33
40
  /**
34
41
  * Callback to provide a list of all supported field names for the card integration.
@@ -60,6 +60,7 @@ class LucidCardIntegrationRegistry {
60
60
  'il': cardIntegration.itemLabel,
61
61
  'isl': cardIntegration.itemsLabel,
62
62
  'u': cardIntegration.iconUrl,
63
+ 'ts': cardIntegration.textStyle,
63
64
  'fc': {
64
65
  'gf': getFieldsActionName,
65
66
  'osfc': onSelectedFieldsChangeActionName,
@@ -20,6 +20,13 @@ export declare type DataActionResponse = {
20
20
  /** The body of the HTTP Response (otherwise) */
21
21
  'text': string;
22
22
  });
23
+ export declare type DataActionOptions = {
24
+ dataConnectorName: string;
25
+ actionName: string;
26
+ actionData?: unknown;
27
+ syncDataSourceIdNonce?: string;
28
+ asynchronous?: boolean;
29
+ };
23
30
  export declare class EditorClient {
24
31
  private nextId;
25
32
  private readonly callbacks;
@@ -58,17 +65,7 @@ export declare class EditorClient {
58
65
  * @deprecated Use createUserImage instead.
59
66
  */
60
67
  experimentalCreateUserImage(mediaType: string, data: Uint8Array | string): Promise<string>;
61
- /**
62
- *
63
- * @param flowName
64
- * @param dataConnectorName
65
- * @param syncDataSourceId
66
- * @param flowData
67
- * @param async
68
- * @returns
69
- * @throws A string with an error from the data sync server
70
- */
71
- performDataAction(flowName: string, dataConnectorName: string, syncDataSourceId?: undefined | string, flowData?: unknown, async?: boolean): Promise<DataActionResponse>;
68
+ performDataAction(options: DataActionOptions): Promise<DataActionResponse>;
72
69
  /**
73
70
  * If the extension package containing this editor extension has configurable settings,
74
71
  * show a standard modal allowing the user to view or change those settings.
@@ -96,23 +96,16 @@ class EditorClient {
96
96
  experimentalCreateUserImage(mediaType, data) {
97
97
  return this.createUserImage(mediaType, data);
98
98
  }
99
- /**
100
- *
101
- * @param flowName
102
- * @param dataConnectorName
103
- * @param syncDataSourceId
104
- * @param flowData
105
- * @param async
106
- * @returns
107
- * @throws A string with an error from the data sync server
108
- */
109
- async performDataAction(flowName, dataConnectorName, syncDataSourceId = undefined, flowData = undefined, async = true) {
99
+ async performDataAction(options) {
100
+ if (options.asynchronous === undefined) {
101
+ options.asynchronous = true;
102
+ }
110
103
  const result = await this.sendCommand("da" /* CommandName.DataAction */, {
111
- 'fn': flowName,
112
- 'a': async,
113
- 's': syncDataSourceId,
114
- 'fd': flowData,
115
- 'n': dataConnectorName,
104
+ 'fn': options.actionName,
105
+ 'a': options.asynchronous,
106
+ 's': options.syncDataSourceIdNonce,
107
+ 'fd': options.actionData,
108
+ 'n': options.dataConnectorName,
116
109
  });
117
110
  if ('t' in result) {
118
111
  return {
package/sdk/ui/panel.d.ts CHANGED
@@ -24,6 +24,8 @@ export interface PanelConfig {
24
24
  iconUrl: string;
25
25
  /** A tool tip to be displayed when hovering over the activation icon. */
26
26
  toolTip?: string;
27
+ /** If set true, we will persist the panel's iframe in the background if it's not currently active*/
28
+ persist?: boolean;
27
29
  }
28
30
  /**
29
31
  * Extend this class to show a custom panel to the user, whose contents are displayed in a sandboxed
package/sdk/ui/panel.js CHANGED
@@ -37,6 +37,7 @@ class Panel extends iframeui_1.IframeUI {
37
37
  'v': this.config.visibleAction,
38
38
  'i': this.config.iconUrl,
39
39
  'to': this.config.toolTip,
40
+ 'p': this.config.persist,
40
41
  });
41
42
  }
42
43
  /**