lucid-extension-sdk 0.0.383 → 0.0.385

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.
@@ -61,7 +61,8 @@ export interface SearchOptionsParam {
61
61
  's': string;
62
62
  'i': [string, SerializedFieldType][];
63
63
  'fd'?: {
64
- 'n'?: string;
64
+ 'n'?: string | undefined;
65
+ 'ds'?: string | undefined;
65
66
  };
66
67
  }
67
68
  /** @ignore */
@@ -7,7 +7,8 @@ export declare class LucidCardIntegrationRegistry {
7
7
  private static nextHookName;
8
8
  static registerFieldOptionsCallback(client: EditorClient, callback: (inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardFieldOption[]>): string;
9
9
  static registerFieldSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>, fieldData?: {
10
- name?: string;
10
+ name?: string | undefined;
11
+ dataSourceId?: string | undefined;
11
12
  }) => Promise<ExtensionCardFieldOption[]>): string;
12
13
  static registerUserSearchCallback(client: EditorClient, callback: (searchText: string, inputSoFar: Map<string, SerializedFieldType>) => Promise<ExtensionCardUserData[]>): string;
13
14
  private static registerDependencyMapping;
@@ -24,7 +24,9 @@ class LucidCardIntegrationRegistry {
24
24
  static registerFieldSearchCallback(client, callback) {
25
25
  const name = LucidCardIntegrationRegistry.nextHookName();
26
26
  client.registerAction(name, async ({ 'i': inputSoFar, 's': searchText, 'fd': serializedFieldData }) => {
27
- const fieldData = serializedFieldData ? { name: serializedFieldData.n } : undefined;
27
+ const fieldData = serializedFieldData
28
+ ? { name: serializedFieldData['n'], dataSourceId: serializedFieldData['ds'] }
29
+ : undefined;
28
30
  const result = await callback(searchText, new Map(inputSoFar), fieldData);
29
31
  return result.map((option) => (0, cardintegrationdefinitions_1.serializeCardFieldOption)(option));
30
32
  });
@@ -0,0 +1,11 @@
1
+ import { SerializedLucidDictionary } from './serializedfield/serializedfields';
2
+ /**
3
+ * Creates icon data as a SerializedLucidDictionary.
4
+ * Useful for creating icons in extensions built on the Lucid Extension SDK that need to be parsed by Lucid's products.
5
+ *
6
+ * @param icon - The URL or SVG data for the icon
7
+ * @param ariaLabel - The accessible label for the icon
8
+ * @param tooltipLabel - Optional tooltip text
9
+ * @returns A SerializedLucidDictionary with the keys: icon, ariaLabel, and tooltipLabel (if provided)
10
+ */
11
+ export declare function createLucidIconData(icon: string, ariaLabel: string, tooltipLabel?: string): SerializedLucidDictionary;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLucidIconData = void 0;
4
+ /**
5
+ * Creates icon data as a SerializedLucidDictionary.
6
+ * Useful for creating icons in extensions built on the Lucid Extension SDK that need to be parsed by Lucid's products.
7
+ *
8
+ * @param icon - The URL or SVG data for the icon
9
+ * @param ariaLabel - The accessible label for the icon
10
+ * @param tooltipLabel - Optional tooltip text
11
+ * @returns A SerializedLucidDictionary with the keys: icon, ariaLabel, and tooltipLabel (if provided)
12
+ */
13
+ function createLucidIconData(icon, ariaLabel, tooltipLabel) {
14
+ return {
15
+ ['dict']: Object.assign({ ['icon']: icon, ['ariaLabel']: ariaLabel }, (tooltipLabel ? { ['tooltipLabel']: tooltipLabel } : {})),
16
+ };
17
+ }
18
+ exports.createLucidIconData = createLucidIconData;
@@ -113,6 +113,13 @@ export declare const isSerializedTimeObject: (subject: unknown) => subject is im
113
113
  minutes: (x: unknown) => x is number | undefined;
114
114
  seconds: (x: unknown) => x is number | undefined;
115
115
  }>;
116
+ export declare const isSerializedLucidIconDataDictionary: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
117
+ dict: (subject: unknown) => subject is import("../../guards").DestructureGuardedTypeObj<{
118
+ icon: typeof isString;
119
+ ariaLabel: typeof isString;
120
+ tooltipLabel: (x: unknown) => x is string | undefined;
121
+ }>;
122
+ }>;
116
123
  export declare function isSerializedFieldType(value: any): value is SerializedFieldType;
117
124
  export declare function isSerializedJsonFieldType(value: any): value is SerializedJsonFieldType;
118
125
  export declare const isSerializedFields: (x: unknown) => x is Record<string | number, SerializedFieldType>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedTimeObject = exports.isSerializedLucidDateObject = exports.isSerializedIsoDateObject = exports.isSerializedMillisecondsDateObject = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
3
+ exports.isSerializedFields = exports.isSerializedJsonFieldType = exports.isSerializedFieldType = exports.isSerializedLucidIconDataDictionary = exports.isSerializedTimeObject = exports.isSerializedLucidDateObject = exports.isSerializedIsoDateObject = exports.isSerializedMillisecondsDateObject = exports.isSerializedLucidCurrency = exports.isSerializedLucidDictionary = exports.isJsonSerializedLucidDictionary = exports.isNestedSerializedLucidDictionary = exports.isSerializedColorObjectFieldType = void 0;
4
4
  const checks_1 = require("../../checks");
5
5
  const validators_1 = require("../../validators/validators");
6
6
  function isSerializedColorObjectFieldType(value) {
@@ -34,6 +34,13 @@ exports.isSerializedTimeObject = (0, validators_1.objectValidator)({
34
34
  'minutes': (0, validators_1.option)(checks_1.isNumber),
35
35
  'seconds': (0, validators_1.option)(checks_1.isNumber),
36
36
  });
37
+ exports.isSerializedLucidIconDataDictionary = (0, validators_1.objectValidator)({
38
+ 'dict': (0, validators_1.objectValidator)({
39
+ 'icon': checks_1.isString,
40
+ 'ariaLabel': checks_1.isString,
41
+ 'tooltipLabel': (0, validators_1.option)(checks_1.isString),
42
+ }),
43
+ });
37
44
  function isSerializedFieldType(value) {
38
45
  return (value == null ||
39
46
  (0, checks_1.isNumber)(value) ||
@@ -44,7 +51,8 @@ function isSerializedFieldType(value) {
44
51
  ((0, checks_1.isArray)(value) && value.every(isSerializedFieldType)) ||
45
52
  (0, exports.isSerializedLucidDateObject)(value) ||
46
53
  (0, exports.isSerializedTimeObject)(value) ||
47
- isSerializedColorObjectFieldType(value));
54
+ isSerializedColorObjectFieldType(value) ||
55
+ (0, exports.isSerializedLucidIconDataDictionary)(value));
48
56
  }
49
57
  exports.isSerializedFieldType = isSerializedFieldType;
50
58
  function isSerializedJsonFieldType(value) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lucid-extension-sdk",
3
- "version": "0.0.383",
3
+ "version": "0.0.385",
4
4
  "description": "Utility classes for writing Lucid Software editor extensions",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",