lucid-extension-sdk 0.0.241 → 0.0.243

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/commandtypes.d.ts CHANGED
@@ -697,6 +697,13 @@ export type AddCardIntegrationQuery = {
697
697
  /** OnSetup action */
698
698
  'os'?: string | undefined;
699
699
  } | undefined;
700
+ /** If specified, custom import modal via iframe url */
701
+ 'cim'?: {
702
+ 'su': string;
703
+ 'w': number;
704
+ 'h': number;
705
+ 'i': string;
706
+ };
700
707
  /** If specified, add-card settings */
701
708
  'ac'?: {
702
709
  /** Get input fields action */
@@ -4,6 +4,7 @@ import { DataSourceProxy } from '../../data/datasourceproxy';
4
4
  import { TextStyle } from '../../document/text/textstyle';
5
5
  import { EditorClient } from '../../editorclient';
6
6
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
7
+ import { JsonSerializable } from '../jsonserializable';
7
8
  import { CardIntegrationConfig } from './cardintegrationconfig';
8
9
  import { ExtensionCardFieldDefinition } from './cardintegrationdefinitions';
9
10
  /**
@@ -122,6 +123,31 @@ export declare abstract class LucidCardIntegration {
122
123
  import: (primaryKeys: string[], searchFields: Map<string, SerializedFieldType>) => Promise<ImportResult>;
123
124
  onSetup?: () => Promise<void>;
124
125
  };
126
+ /**
127
+ * If specified, allow the user to import cards using a custom card-import modal.
128
+ *
129
+ * srcUrl:
130
+ * The url to be displayed in an iframe. This can either be a public url, or a local
131
+ * file located in the public folder of your packages root directory.
132
+ *
133
+ * width:
134
+ * The width of the iframe. The maximum width is 1344px.
135
+ *
136
+ * height:
137
+ * The height of the iframe. The maximum height is 1000px.
138
+ *
139
+ * import:
140
+ * Imports the items selected from you custom iframe. You can pass in whatever data is needed to import the items
141
+ * through you data-connector. The data must be of type JsonSerializable. Return the collection created and the
142
+ * primary keys of the items that were imported.
143
+ *
144
+ */
145
+ customImportModal?: {
146
+ srcUrl: string;
147
+ width: number;
148
+ height: number;
149
+ import: (data: JsonSerializable) => Promise<ImportResult>;
150
+ };
125
151
  /**
126
152
  * If specified, allow the user to create new cards and convert other shapes to cards
127
153
  */
@@ -1,4 +1,5 @@
1
1
  import { SerializedFieldType } from '../data/serializedfield/serializedfields';
2
+ import { JsonSerializable } from '../jsonserializable';
2
3
  /** @ignore */
3
4
  export interface GetFieldsParam {
4
5
  'd': string;
@@ -26,6 +27,10 @@ export interface ImportParam {
26
27
  's': [string, SerializedFieldType][];
27
28
  }
28
29
  /** @ignore */
30
+ export interface CustomImportParam {
31
+ 'd': JsonSerializable;
32
+ }
33
+ /** @ignore */
29
34
  export interface GetInputFieldsParam {
30
35
  'i': [string, SerializedFieldType][];
31
36
  }
@@ -108,6 +108,22 @@ class LucidCardIntegrationRegistry {
108
108
  });
109
109
  }
110
110
  }
111
+ if (cardIntegration.customImportModal) {
112
+ const customImportModal = cardIntegration.customImportModal;
113
+ serialized['cim'] = {
114
+ 'su': customImportModal.srcUrl,
115
+ 'w': customImportModal.width,
116
+ 'h': customImportModal.height,
117
+ 'i': LucidCardIntegrationRegistry.nextHookName(),
118
+ };
119
+ client.registerAction(serialized['cim']['i'], async ({ 'd': data }) => {
120
+ const result = await customImportModal.import(data);
121
+ return {
122
+ 'c': result.collection.id,
123
+ 'pks': result.primaryKeys,
124
+ };
125
+ });
126
+ }
111
127
  if (cardIntegration.addCard) {
112
128
  const addCard = cardIntegration.addCard;
113
129
  serialized['ac'] = {
package/interop.d.ts CHANGED
@@ -48,8 +48,25 @@ declare interface I18nFormattedNumberParams {
48
48
 
49
49
  declare class I18nFormattedNumber {}
50
50
 
51
+ declare enum ListStyles {
52
+ LONG = 'long',
53
+ SHORT = 'short',
54
+ NARROW = 'narrow',
55
+ }
56
+ declare enum ListTypes {
57
+ AND = 'conjunction',
58
+ OR = 'disjunction',
59
+ UNIT_LIST = 'unit',
60
+ }
61
+ declare type FormattedListParams = {
62
+ style: ListStyles;
63
+ type: ListTypes;
64
+ };
65
+
66
+ declare class I18nFormattedList {}
67
+
51
68
  declare interface I18nReplacement {
52
- [s: string]: number | string | I18nSafeString | I18nFormattedNumber;
69
+ [s: string]: number | string | string[] | I18nSafeString | I18nFormattedNumber | I18nFormattedList;
53
70
  }
54
71
 
55
72
  declare namespace i18n {
@@ -58,4 +75,5 @@ declare namespace i18n {
58
75
  function getLanguage(): string;
59
76
  function getInLocale(locale: string, key: string, replacements?: I18nReplacement, wrappers?: string[]): string;
60
77
  function formatNumber(value: number, params: I18nFormattedNumberParams): I18nFormattedNumber;
78
+ function formatList(value: string[], params?: I18nFormattedListParams): I18nFormattedList;
61
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.241",
3
+ "version": "0.0.243",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",