@dxtmisha/figma 0.1.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 ADDED
@@ -0,0 +1,30 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ ## [0.1.0] - 2026-05-10
6
+
7
+ ### Added
8
+ - **AI Prompt Generator**: Implemented a recursive AI prompt generator for advanced automation.
9
+ - **Figma Styles Sync**: Added functionality to synchronize Figma styles directly with the project.
10
+ - **Zip Export**: Implemented Zip archiving for exporting assets and styles.
11
+ - **Unit Testing**: Added a comprehensive unit testing suite using Vitest.
12
+ - **Documentation**: Integrated AI-assisted documentation metadata across the package.
13
+ - **Figma Storage**: Implemented robust data storage mechanics within Figma (`useFigmaStorage`).
14
+ - **Figma Messages**: Added `FigmaMessage` class for standardized event listening and messaging.
15
+ - **Selection Logic**: Consolidated Figma frame selection logic and standardized messengers.
16
+ - **Translation Support**: Added ability to use local texts in translations.
17
+ - **Component Build**: Added `ComponentBuild.ts` for managing component construction.
18
+ - **Image Utilities**: Added image processing functions: `resizeImageByMax`, `blobToBase64`, and `ensureMaxSize`.
19
+ - **Top Level Frames**: Added `FigmaTopLevelFrames` and `useFigmaUiFrames` for UI frame management.
20
+
21
+ ### Changed / Improved
22
+ - **Checkbox Design**: Refactored Checkbox design integration.
23
+ - **Data Persistence**: Improved Figma data storage mechanics and callback handling (`StorageCallback`).
24
+ - **Selection Mechanics**: Standardized frame selection logic across the plugin.
25
+ - **Refactoring**: Consolidated messaging systems and selection logic for better maintainability.
26
+
27
+ ### Fixed
28
+ - **Component Visibility**: Fixed component visibility issues for editors.
29
+ - **Bug Fixes**: Addressed various minor bugs in frame selection and data storage.
30
+ - Fixed type definition errors and improved TypeScript support.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 dxtmisha
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1 @@
1
+ # @dxtmisha/figma
@@ -0,0 +1,5 @@
1
+ This library provides a structured bidirectional messaging bridge between a Figma plugin's logic sandbox and its UI layer. It implements a subscription-based event bus via FigmaPostAbstract and FigmaUiMessenger, utilizing a verification code system through FigmaPostCode to validate and filter messages sent over the window.postMessage boundary.
2
+
3
+ An AI should study this library when implementing Figma plugin features that require fetching document structure, frame hierarchies, selection states, or node styles. It is essential for managing Figma-specific storage persistence (ClientStorage and global storage) and for serializing Figma node data into JSON or CSS maps for UI rendering.
4
+
5
+ The library functions as the communication middleware within a Figma plugin architecture, connecting the PluginAPI logic with frontend technologies. It provides a suite of utility functions—such as fetchTopLevelFrames, sendFrameStyles, and fetchClientStorage—that abstract raw messaging into a typed, asynchronous API based on pre-defined event signatures and response interfaces.
package/ai-doc.ru.txt ADDED
@@ -0,0 +1,11 @@
1
+ ПАКЕТ СРЕДСТВ СВЯЗИ ДЛЯ UI FIGMA:
2
+ Данная библиотека предназначена для упрощения взаимодействия между UI-частью плагина Figma (Frontend) и его фоновым процессом (Backend). Она предоставляет абстракции для обмена сообщениями и получения данных из Figma.
3
+
4
+ 1. ПРЕДНАЗНАЧЕНИЕ: Библиотека используется исключительно в UI-коде плагина Figma. Она реализует `FigmaUiMessenger` для отправки (`post`) и приема сообщений от плагина, а также функции для запроса данных о фреймах, стилях и хранилище.
5
+ 2. ТИПОВАЯ СТРУКТУРА: Весь обмен сообщениями завязан на защищенном коде (`FigmaPostCode`), который должен совпадать на обеих сторонах (UI и Code).
6
+ 3. ОСНОВНЫЕ ИНСТРУМЕНТЫ:
7
+ - `FigmaUiMessenger`: Синглтон для управления сообщениями на стороне UI.
8
+ - Функции `fetch...`: Обертки над сообщениями для асинхронного получения данных из Figma (например, `fetchFramesSelected`).
9
+
10
+ Используй этот пакет при разработке визуальной части плагина для связи с API Figma через прослойку `figma-code`.
11
+
package/ai-doc.txt ADDED
@@ -0,0 +1,11 @@
1
+ FIGMA UI COMMUNICATION PACKAGE:
2
+ This library is designed to simplify the interaction between the UI part of a Figma plugin (Frontend) and its background process (Backend). It provides abstractions for messaging and retrieving data from Figma.
3
+
4
+ 1. PURPOSE: The library is used exclusively in the Figma plugin's UI code. It implements `FigmaUiMessenger` for sending (`post`) and receiving messages from the plugin, along with functions for requesting frames, styles, and storage data.
5
+ 2. SECURITY: All messaging is tied to a secure code (`FigmaPostCode`), which must match on both sides (UI and Code).
6
+ 3. KEY TOOLS:
7
+ - `FigmaUiMessenger`: A singleton for managing messages on the UI side.
8
+ - `fetch...` functions: Wrappers over messages for asynchronously retrieving data from Figma (e.g., `fetchFramesSelected`).
9
+
10
+ Use this package when developing the visual part of a plugin to communicate with the Figma API via the `figma-code` layer.
11
+
package/ai-types.txt ADDED
@@ -0,0 +1,301 @@
1
+ 1) All these methods are in the @dxtmisha/figma library.
2
+ 2) Everything that is exported can be used.
3
+ 3) Use what is in this library if it exists; do not use other libraries if there is an analogue here. Do not create new ones if an analogue already exists here.
4
+
5
+ The following is the content of "exports" from package.json:
6
+ {
7
+ ".": {
8
+ "import": "./dist/library.js",
9
+ "types": "./dist/library.d.ts"
10
+ },
11
+ "./style.css": "./dist/style.css",
12
+ "./types/*": "./dist/*",
13
+ "./types/**/*.d.ts": "./dist/**/*.d.ts"
14
+ }
15
+
16
+ // File: classes/FigmaPostAbstract.d.ts
17
+ /** Base class for Figma plugin-UI messaging. */
18
+ export declare abstract class FigmaPostAbstract {
19
+ /**
20
+ * Sends message to the other side.
21
+ * @param type Message type
22
+ * @param message Message data
23
+ */
24
+ abstract post<Message>(type: string, message?: Message): void;
25
+ /**
26
+ * Adds listener for message type.
27
+ * @param type Message type
28
+ * @param callback Function called on receipt
29
+ * @param once Execute only once
30
+ */
31
+ add<Message>(type: string, callback: UiFigmaMessengerCallback<Message>, once?: boolean): this;
32
+ /**
33
+ * Removes listener for message type.
34
+ * @param type Message type
35
+ * @param callback Function to remove
36
+ */
37
+ remove<Message>(type: string, callback: UiFigmaMessengerCallback<Message>): this;
38
+ /** Initializes message listener. */
39
+ make(): this;
40
+ }
41
+ // File: classes/FigmaPostCode.d.ts
42
+ /** Manages unique code for verifying Figma plugin-UI messages. */
43
+ export declare class FigmaPostCode {
44
+ /**
45
+ * Checks if code matches current post code.
46
+ * @param code Code to check
47
+ */
48
+ static is(code: string): boolean;
49
+ /** Returns current post code. */
50
+ static get(): string;
51
+ /**
52
+ * Sets new post code. Callable once.
53
+ * @param code New code
54
+ */
55
+ static set(code: string): void;
56
+ }
57
+ // File: classes/FigmaUiMessenger.d.ts
58
+ /** Messenger for Figma UI (frontend). */
59
+ export declare class FigmaUiMessenger extends FigmaPostAbstract {
60
+ /**
61
+ * Gets instance for Figma UI messenger.
62
+ * @returns current instance
63
+ */
64
+ static getInstance(): FigmaUiMessenger;
65
+ /**
66
+ * Sends message to Figma plugin.
67
+ * @param type Message type
68
+ * @param message Message data
69
+ */
70
+ post<Message>(type: string, message?: Message): void;
71
+ }
72
+ // File: config.d.ts
73
+ export declare const FIGMA_IMAGE_TYPE = "image/jpeg";
74
+ /** Figma message type for texts */
75
+ export declare const FIGMA_MESSAGE_TEXTS = "texts";
76
+ // File: functions/fetchClientStorage.d.ts
77
+ /**
78
+ * Fetch client storage data.
79
+ * @param name Storage name
80
+ * @param callback Callback function
81
+ * @param defaultValue Default value
82
+ * @param isOnce Call only once
83
+ */
84
+ export declare function fetchClientStorage<T>(name: string, callback: (value: T) => void, defaultValue?: T, isOnce?: boolean): void;
85
+ // File: functions/fetchFrameSelection.d.ts
86
+ /**
87
+ * Fetch list of selected frames.
88
+ * @param callback Callback function
89
+ */
90
+ export declare function fetchFrameSelection(callback: (value: UiFigmaFramesList) => void): void;
91
+ // File: functions/fetchFrameStyles.d.ts
92
+ /**
93
+ * Fetch styles for specified frames.
94
+ * @param callback Callback function
95
+ */
96
+ export declare function fetchFrameStyles(callback: (value: UiFigmaFrameStylesMessengerResponse) => void): void;
97
+ // File: functions/fetchFramesSelected.d.ts
98
+ /**
99
+ * Fetches selected frames from Figma plugin.
100
+ * @param callback Function called on receipt
101
+ */
102
+ export declare function fetchFramesSelected(callback: (selected: string[]) => void): void;
103
+ // File: functions/fetchStorage.d.ts
104
+ /**
105
+ * Fetch storage data.
106
+ * @param name Storage name
107
+ * @param callback Callback function
108
+ * @param id Storage id
109
+ * @param defaultValue Default value
110
+ * @param isOnce Call only once
111
+ */
112
+ export declare function fetchStorage<T>(name: string, callback: (value: T) => void, id?: string, defaultValue?: T, isOnce?: boolean): void;
113
+ // File: functions/fetchTopLevelFrames.d.ts
114
+ /**
115
+ * Fetches top-level frames from Figma plugin.
116
+ * @param callback Function called on receipt
117
+ */
118
+ export declare function fetchTopLevelFrames(callback: (frames: UiFigmaFramesList) => void): void;
119
+ // File: functions/sendClientStorage.d.ts
120
+ /**
121
+ * Sends client storage data to Figma plugin.
122
+ * @param name Storage name
123
+ * @param value Value to store
124
+ */
125
+ export declare function sendClientStorage<T>(name: string, value: T): void;
126
+ // File: functions/sendFrameSelection.d.ts
127
+ /**
128
+ * Send selection frame to UI
129
+ * @param id Frame ID
130
+ */
131
+ export declare function sendFrameSelection(id?: string): void;
132
+ // File: functions/sendFrameStyles.d.ts
133
+ /**
134
+ * Send request for frame styles.
135
+ * @param attributes Attributes for fetching styles
136
+ */
137
+ export declare function sendFrameStyles(attributes: UiFigmaFrameStylesMessengerAttributes): void;
138
+ // File: functions/sendFramesSelected.d.ts
139
+ /**
140
+ * Sends selected frames to Figma plugin.
141
+ * @param id Frame ID
142
+ * @param selected Selection state
143
+ */
144
+ export declare function sendFramesSelected(id: string, selected: boolean): void;
145
+ // File: functions/sendStorage.d.ts
146
+ /**
147
+ * Sends storage data to Figma plugin.
148
+ * @param name Storage name
149
+ * @param value Value to store
150
+ * @param id Object ID
151
+ */
152
+ export declare function sendStorage<T>(name: string, value: T, id?: string): void;
153
+ // File: library.d.ts
154
+ export * from './classes/FigmaPostAbstract';
155
+ export * from './classes/FigmaPostCode';
156
+ export * from './classes/FigmaUiMessenger';
157
+ export * from './functions/fetchClientStorage';
158
+ export * from './functions/fetchFrameSelection';
159
+ export * from './functions/fetchFrameStyles';
160
+ export * from './functions/fetchFramesSelected';
161
+ export * from './functions/fetchStorage';
162
+ export * from './functions/fetchTopLevelFrames';
163
+ export * from './functions/sendClientStorage';
164
+ export * from './functions/sendFrameSelection';
165
+ export * from './functions/sendFrameStyles';
166
+ export * from './functions/sendFramesSelected';
167
+ export * from './functions/sendStorage';
168
+ export * from './types/figmaMessengerTypes';
169
+ export * from './types/figmaStylesTypes';
170
+ export * from './types/framesTypes';
171
+ export * from './types/storageTypes';
172
+ // File: types/figmaMessengerTypes.d.ts
173
+ /** Message callback function type */
174
+ export type UiFigmaMessengerCallback<Message = any> = (message: Message) => void;
175
+ /** Item with callback and execution rule */
176
+ export type UiFigmaMessengerCallbackItem<Message = any> = {
177
+ /** Callback function */
178
+ callback: UiFigmaMessengerCallback<Message>;
179
+ /** Rule for single execution */
180
+ once: boolean;
181
+ };
182
+ /** Stored message type and callbacks */
183
+ export type UiFigmaMessengerItem = {
184
+ /** Message type */
185
+ type: string;
186
+ /** Registered callbacks */
187
+ callbackList: UiFigmaMessengerCallbackItem[];
188
+ };
189
+ /** Message items list */
190
+ export type UiFigmaMessengerList = Record<string, UiFigmaMessengerItem>;
191
+ /** Message data structure */
192
+ export type UiFigmaMessengerData<Message = any> = {
193
+ /** Verification code */
194
+ code: string;
195
+ /** Message type */
196
+ type: string;
197
+ /** Message content */
198
+ message?: Message;
199
+ };
200
+ // File: types/figmaStylesTypes.d.ts
201
+ /** CSS styles for a Figma element */
202
+ export type UiFigmaFrameStylesCssItem = Record<string, string>;
203
+ /** CSS styles list indexed by ID */
204
+ export type UiFigmaFrameStylesCssList = Record<string, UiFigmaFrameStylesCssItem>;
205
+ /** JSON structure for Figma frame style */
206
+ export type UiFigmaFrameStylesJson = {
207
+ /** Node ID */
208
+ id: string;
209
+ /** Node name */
210
+ name: string;
211
+ /** Node type */
212
+ type?: string;
213
+ /** Text content */
214
+ characters?: string;
215
+ /** Style properties */
216
+ style?: Record<string, string | number | boolean>;
217
+ /** Map of style IDs */
218
+ styles?: Record<string, string>;
219
+ /** Child nodes */
220
+ children?: UiFigmaFrameStylesJson[];
221
+ };
222
+ /** Document tree and styles data */
223
+ export type UiFigmaFrameStylesData = {
224
+ /** Document node tree */
225
+ document: UiFigmaFrameStylesJson;
226
+ /** Style definitions */
227
+ styles: Record<string, any>;
228
+ };
229
+ /** Figma frame style item */
230
+ export type UiFigmaFrameStylesItem = UiFigmaFramesItem & {
231
+ /** Compact JSON data */
232
+ json?: UiFigmaFrameStylesData;
233
+ /** Text content */
234
+ text?: string;
235
+ /** CSS styles */
236
+ styles?: UiFigmaFrameStylesCssItem;
237
+ /** Map of children's CSS styles */
238
+ childrenStyles?: UiFigmaFrameStylesCssList;
239
+ };
240
+ /** Frame style items list */
241
+ export type UiFigmaFrameStylesList = UiFigmaFrameStylesItem[];
242
+ /** Messenger request attributes for frame styles */
243
+ export type UiFigmaFrameStylesMessengerAttributes = {
244
+ /** List of IDs */
245
+ ids: string | string[];
246
+ /** Include child styles */
247
+ children?: boolean;
248
+ };
249
+ /** Messenger response item for frame styles */
250
+ export type UiFigmaFrameStylesMessengerResponseItem = {
251
+ /** Node ID */
252
+ id: string;
253
+ /** Style data */
254
+ data: UiFigmaFrameStylesList;
255
+ };
256
+ /** Full messenger response for frame styles */
257
+ export type UiFigmaFrameStylesMessengerResponse = UiFigmaFrameStylesMessengerResponseItem[];
258
+ /** Event name for updating Figma frame styles */
259
+ export declare const FIGMA_FRAME_STYLES_MESSENGER_NAME = "ui-figma-styles-update";
260
+ // File: types/framesTypes.d.ts
261
+ /** Simplified Figma frame item */
262
+ export type UiFigmaFramesItem = {
263
+ /** Frame name */
264
+ name: string;
265
+ /** Unique element ID */
266
+ id: string;
267
+ /** Image as byte array or Base64 */
268
+ image?: Uint8Array<ArrayBufferLike> | string;
269
+ };
270
+ /** Frame items list */
271
+ export type UiFigmaFramesList = UiFigmaFramesItem[];
272
+ /** Message: send frame list */
273
+ export declare const UI_MA_FRAMES_POST_NAME = "ui-figma-frames-list";
274
+ /** Message: send selected frames */
275
+ export declare const UI_FIGMA_FRAMES_SELECTED_POST_NAME = "ui-figma-frames-selected";
276
+ /** Message: add frame to selection */
277
+ export declare const UI_FIGMA_FRAMES_SELECTED_ADD_NAME = "ui-figma-frames-selected-add";
278
+ /** Message: get frame selection */
279
+ export declare const UI_FIGMA_FRAME_GET_SELECTION = "ui-figma-frame-get-selection";
280
+ /** Message: set frame selection */
281
+ export declare const UI_FIGMA_FRAME_SET_SELECTION = "ui-figma-frame-set-selection";
282
+ /** Message: get client storage */
283
+ export declare const UI_FIGMA_CLIENT_STORAGE_GET = "ui-figma-client-storage-get";
284
+ /** Message: set client storage */
285
+ export declare const UI_FIGMA_CLIENT_STORAGE_SET = "ui-figma-client-storage-set";
286
+ /** Message: get storage */
287
+ export declare const UI_FIGMA_STORAGE_GET = "ui-figma-storage-get";
288
+ /** Message: set storage */
289
+ export declare const UI_FIGMA_STORAGE_SET = "ui-figma-storage-set";
290
+ // File: types/storageTypes.d.ts
291
+ /** Client storage messenger data */
292
+ export type ClientStorageMessengerData<T = any> = {
293
+ name: string;
294
+ value: T;
295
+ };
296
+ /** Storage messenger data */
297
+ export type StorageMessengerData<T = any> = {
298
+ id?: string;
299
+ name: string;
300
+ value: T;
301
+ };
@@ -0,0 +1,62 @@
1
+ import { UiFigmaMessengerCallback, UiFigmaMessengerData, UiFigmaMessengerList } from '../types/figmaMessengerTypes';
2
+ /**
3
+ * Base abstract class for managing messaging between the Figma plugin and UI.
4
+ *
5
+ * Базовый абстрактный класс для управления обменом сообщениями между плагином Figma и UI.
6
+ */
7
+ export declare abstract class FigmaPostAbstract {
8
+ protected isMake: boolean;
9
+ protected readonly posts: UiFigmaMessengerList;
10
+ /**
11
+ * Sends a message to the other side.
12
+ *
13
+ * Отправляет сообщение на другую сторону.
14
+ * @param type The type of the message / Тип сообщения
15
+ * @param message The message data / Данные сообщения
16
+ */
17
+ abstract post<Message>(type: string, message?: Message): void;
18
+ /**
19
+ * Adds a callback listener for a specific message type.
20
+ *
21
+ * Добавляет колбэк-слушатель для определенного типа сообщения.
22
+ * @param type The type of the message / Тип сообщения
23
+ * @param callback The function to call when the message is received / Функция, вызываемая при получении сообщения
24
+ * @param once Whether the callback should only be called once / Вызывать ли колбэк только один раз
25
+ */
26
+ add<Message>(type: string, callback: UiFigmaMessengerCallback<Message>, once?: boolean): this;
27
+ /**
28
+ * Removes a callback listener for a specific message type.
29
+ *
30
+ * Удаляет колбэк-слушатель для определенного типа сообщения.
31
+ * @param type The type of the message / Тип сообщения
32
+ * @param callback The function to remove / Функция для удаления
33
+ */
34
+ remove<Message>(type: string, callback: UiFigmaMessengerCallback<Message>): this;
35
+ /**
36
+ * Initializes the message listener.
37
+ *
38
+ * Инициализирует слушатель сообщений.
39
+ */
40
+ make(): this;
41
+ /**
42
+ * Sets up the actual environment-specific message listener.
43
+ *
44
+ * Настраивает фактический слушатель сообщений, зависящий от среды.
45
+ */
46
+ protected abstract prepare(): void;
47
+ /**
48
+ * Notifies all registered listeners for a specific message type.
49
+ *
50
+ * Уведомляет всех зарегистрированных слушателей для определенного типа сообщения.
51
+ * @param type The type of the message / Тип сообщения
52
+ * @param message The message data / Данные сообщения
53
+ */
54
+ protected notify<Message>(type: string, message: Message): void;
55
+ /**
56
+ * Internal message handler that filters by post code and notifies listeners.
57
+ *
58
+ * Внутренний обработчик сообщений, который фильтрует по коду сообщения и уведомляет слушателей.
59
+ * @param data The received message data / Данные полученного сообщения
60
+ */
61
+ protected onMessage: (data?: UiFigmaMessengerData) => void;
62
+ }
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Class for managing the unique code used for verifying messages between the Figma plugin and UI.
3
+ *
4
+ * Класс для управления уникальным кодом, используемым для проверки сообщений между плагином Figma и UI.
5
+ */
6
+ export declare class FigmaPostCode {
7
+ private static code;
8
+ private static isEditable;
9
+ /**
10
+ * Checks if the provided code matches the current post code.
11
+ *
12
+ * Проверяет, совпадает ли предоставленный код с текущим кодом сообщения.
13
+ * @param code The code to check / Проверяемый код
14
+ */
15
+ static is(code: string): boolean;
16
+ /**
17
+ * Returns the current post code.
18
+ *
19
+ * Возвращает текущий код сообщения.
20
+ */
21
+ static get(): string;
22
+ /**
23
+ * Sets a new post code. Can only be called once.
24
+ *
25
+ * Устанавливает новый код сообщения. Можно вызвать только один раз.
26
+ * @param code The new code to set / Новый код для установки
27
+ */
28
+ static set(code: string): void;
29
+ }
@@ -0,0 +1,29 @@
1
+ import { FigmaPostAbstract } from './FigmaPostAbstract';
2
+ /**
3
+ * Messenger for the Figma UI side (frontend).
4
+ *
5
+ * Мессенджер для стороны UI Figma (frontend).
6
+ */
7
+ export declare class FigmaUiMessenger extends FigmaPostAbstract {
8
+ /**
9
+ * Getting an instance of the class for working with Figma UI messenger (frontend).
10
+ *
11
+ * Получение экземпляра класса для работы с мессенджером UI Figma (frontend).
12
+ * @returns current instance/ текущий экземпляр
13
+ */
14
+ static getInstance(): FigmaUiMessenger;
15
+ /**
16
+ * Sends a message to the Figma plugin.
17
+ *
18
+ * Отправляет сообщение в плагин Figma.
19
+ * @param type The type of the message / Тип сообщения
20
+ * @param message The message data / Данные сообщения
21
+ */
22
+ post<Message>(type: string, message?: Message): void;
23
+ /**
24
+ * Initializes the listener using the window message event.
25
+ *
26
+ * Инициализирует слушатель, используя событие message объекта window.
27
+ */
28
+ protected prepare(): void;
29
+ }
@@ -0,0 +1,3 @@
1
+ export declare const FIGMA_IMAGE_TYPE = "image/jpeg";
2
+ /** Figma message type for texts / Тип сообщения Figma для текстов */
3
+ export declare const FIGMA_MESSAGE_TEXTS = "texts";
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Fetch client storage data.
3
+ *
4
+ * Получить данные клиентского хранилища.
5
+ * @param name Storage name / Имя хранилища
6
+ * @param callback Callback function / Функция обратного вызова
7
+ * @param defaultValue Default value / Значение по умолчанию
8
+ * @param isOnce Call only once / Вызвать только один раз
9
+ */
10
+ export declare function fetchClientStorage<T>(name: string, callback: (value: T) => void, defaultValue?: T, isOnce?: boolean): void;
@@ -0,0 +1,8 @@
1
+ import { UiFigmaFramesList } from '../types/framesTypes';
2
+ /**
3
+ * Fetch the list of selected frames.
4
+ *
5
+ * Получить список выбранных фреймов.
6
+ * @param callback Callback function / Функция обратного вызова
7
+ */
8
+ export declare function fetchFrameSelection(callback: (value: UiFigmaFramesList) => void): void;
@@ -0,0 +1,8 @@
1
+ import { UiFigmaFrameStylesMessengerResponse } from '../types/figmaStylesTypes';
2
+ /**
3
+ * Fetch the styles for the specified frames.
4
+ *
5
+ * Получить стили для указанных фреймов.
6
+ * @param callback Callback function / Функция обратного вызова
7
+ */
8
+ export declare function fetchFrameStyles(callback: (value: UiFigmaFrameStylesMessengerResponse) => void): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Fetches the selected frames from the Figma plugin.
3
+ *
4
+ * Получает выбранные фреймы из плагина Figma.
5
+ * @param callback The function to call once the frames are received / Функция, вызываемая после получения выбранных фреймов
6
+ */
7
+ export declare function fetchFramesSelected(callback: (selected: string[]) => void): void;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Fetch storage data.
3
+ *
4
+ * Получить данные хранилища.
5
+ * @param name Storage name / Имя хранилища
6
+ * @param callback Callback function / Функция обратного вызова
7
+ * @param id Storage id / Идентификатор хранилища
8
+ * @param defaultValue Default value / Значение по умолчанию
9
+ * @param isOnce Call only once / Вызвать только один раз
10
+ */
11
+ export declare function fetchStorage<T>(name: string, callback: (value: T) => void, id?: string, defaultValue?: T, isOnce?: boolean): void;
@@ -0,0 +1,8 @@
1
+ import { UiFigmaFramesList } from '../types/framesTypes';
2
+ /**
3
+ * Fetches the top-level frames from the Figma plugin.
4
+ *
5
+ * Получает фреймы верхнего уровня из плагина Figma.
6
+ * @param callback The function to call once the frames are received / Функция, вызываемая после получения фреймов
7
+ */
8
+ export declare function fetchTopLevelFrames(callback: (frames: UiFigmaFramesList) => void): void;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sends the client storage data to the Figma plugin.
3
+ *
4
+ * Отправляет данные клиентского хранилища в плагин Figma.
5
+ * @param name The name of the storage / Название хранилища
6
+ * @param value The value to store / Значение для хранения
7
+ */
8
+ export declare function sendClientStorage<T>(name: string, value: T): void;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Send selection frame to UI
3
+ *
4
+ * Отправка выделенного фрейма в UI
5
+ * @param id - Frame ID / ID фрейма
6
+ */
7
+ export declare function sendFrameSelection(id?: string): void;
@@ -0,0 +1,8 @@
1
+ import { UiFigmaFrameStylesMessengerAttributes } from '../types/figmaStylesTypes';
2
+ /**
3
+ * Send request to get frame styles.
4
+ *
5
+ * Отправить запрос на получение стилей фреймов.
6
+ * @param attributes Attributes for fetching styles / Атрибуты для получения стилей
7
+ */
8
+ export declare function sendFrameStyles(attributes: UiFigmaFrameStylesMessengerAttributes): void;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Sends the selected frames to the Figma plugin.
3
+ *
4
+ * Отправляет выбранные фреймы в плагин Figma.
5
+ * @param id The ID of the frame / Идентификатор фрейма
6
+ * @param selected The selection state of the frame / Состояние выбора фрейма
7
+ */
8
+ export declare function sendFramesSelected(id: string, selected: boolean): void;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Sends the storage data to the Figma plugin.
3
+ *
4
+ * Отправляет данные хранилища в плагин Figma.
5
+ * @param name The name of the storage / Название хранилища
6
+ * @param value The value to store / Значение для хранения
7
+ * @param id The ID of the object / Идентификатор объекта
8
+ */
9
+ export declare function sendStorage<T>(name: string, value: T, id?: string): void;
@@ -0,0 +1,18 @@
1
+ export * from './classes/FigmaPostAbstract';
2
+ export * from './classes/FigmaPostCode';
3
+ export * from './classes/FigmaUiMessenger';
4
+ export * from './functions/fetchClientStorage';
5
+ export * from './functions/fetchFrameSelection';
6
+ export * from './functions/fetchFrameStyles';
7
+ export * from './functions/fetchFramesSelected';
8
+ export * from './functions/fetchStorage';
9
+ export * from './functions/fetchTopLevelFrames';
10
+ export * from './functions/sendClientStorage';
11
+ export * from './functions/sendFrameSelection';
12
+ export * from './functions/sendFrameStyles';
13
+ export * from './functions/sendFramesSelected';
14
+ export * from './functions/sendStorage';
15
+ export * from './types/figmaMessengerTypes';
16
+ export * from './types/figmaStylesTypes';
17
+ export * from './types/framesTypes';
18
+ export * from './types/storageTypes';
@@ -0,0 +1,211 @@
1
+ import { StorageCallback as e, random as t } from "@dxtmisha/functional-basic";
2
+ //#region \0@oxc-project+runtime@0.128.0/helpers/typeof.js
3
+ function n(e) {
4
+ "@babel/helpers - typeof";
5
+ return n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
6
+ return typeof e;
7
+ } : function(e) {
8
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
9
+ }, n(e);
10
+ }
11
+ //#endregion
12
+ //#region \0@oxc-project+runtime@0.128.0/helpers/toPrimitive.js
13
+ function r(e, t) {
14
+ if (n(e) != "object" || !e) return e;
15
+ var r = e[Symbol.toPrimitive];
16
+ if (r !== void 0) {
17
+ var i = r.call(e, t || "default");
18
+ if (n(i) != "object") return i;
19
+ throw TypeError("@@toPrimitive must return a primitive value.");
20
+ }
21
+ return (t === "string" ? String : Number)(e);
22
+ }
23
+ //#endregion
24
+ //#region \0@oxc-project+runtime@0.128.0/helpers/toPropertyKey.js
25
+ function i(e) {
26
+ var t = r(e, "string");
27
+ return n(t) == "symbol" ? t : t + "";
28
+ }
29
+ //#endregion
30
+ //#region \0@oxc-project+runtime@0.128.0/helpers/defineProperty.js
31
+ function a(e, t, n) {
32
+ return (t = i(t)) in e ? Object.defineProperty(e, t, {
33
+ value: n,
34
+ enumerable: !0,
35
+ configurable: !0,
36
+ writable: !0
37
+ }) : e[t] = n, e;
38
+ }
39
+ //#endregion
40
+ //#region src/classes/FigmaPostCode.ts
41
+ var o = class {
42
+ static is(e) {
43
+ return this.code === e;
44
+ }
45
+ static get() {
46
+ return this.code;
47
+ }
48
+ static set(e) {
49
+ this.isEditable && (this.code = `figma-${e}`, this.isEditable = !1);
50
+ }
51
+ };
52
+ a(o, "code", `figma-${t(1e5, 999999)}`), a(o, "isEditable", !0);
53
+ //#endregion
54
+ //#region src/classes/FigmaPostAbstract.ts
55
+ var s = class {
56
+ constructor() {
57
+ a(this, "isMake", !1), a(this, "posts", {}), a(this, "onMessage", (e) => {
58
+ e && o.is(e.code) && this.notify(e.type, e.message);
59
+ });
60
+ }
61
+ add(e, t, n = !1) {
62
+ return this.posts[e] || (this.posts[e] = {
63
+ type: e,
64
+ callbackList: []
65
+ }), this.posts[e].callbackList.push({
66
+ callback: t,
67
+ once: n
68
+ }), this;
69
+ }
70
+ remove(e, t) {
71
+ return this.posts[e] && (this.posts[e].callbackList = this.posts[e].callbackList.filter((e) => e.callback !== t)), this;
72
+ }
73
+ make() {
74
+ return this.isMake || (this.isMake = !0, this.prepare()), this;
75
+ }
76
+ notify(e, t) {
77
+ e in this.posts && this.posts[e].callbackList.forEach((n) => {
78
+ n.callback(t), n.once && this.remove(e, n.callback);
79
+ });
80
+ }
81
+ }, c = class e extends s {
82
+ static getInstance() {
83
+ return l || (l = new e(), l.make(), l);
84
+ }
85
+ post(e, t) {
86
+ parent.postMessage({ pluginMessage: {
87
+ code: o.get(),
88
+ type: e,
89
+ message: t
90
+ } }, "*");
91
+ }
92
+ prepare() {
93
+ window.addEventListener("message", (e) => {
94
+ var t;
95
+ return this.onMessage((t = e.data) == null ? void 0 : t.pluginMessage);
96
+ });
97
+ }
98
+ }, l, u = "ui-figma-frames-list", d = "ui-figma-frames-selected", f = "ui-figma-frames-selected-add", p = "ui-figma-frame-get-selection", m = "ui-figma-frame-set-selection", h = "ui-figma-client-storage-get", g = "ui-figma-client-storage-set", _ = "ui-figma-storage-get", v = "ui-figma-storage-set", y = !1;
99
+ function b(e, t, n, r = !0) {
100
+ C();
101
+ let i = S(e);
102
+ i.addCallback(t, r), i.isLoading() || (i.preparation(), c.getInstance().post(h, {
103
+ name: e,
104
+ defaultValue: n
105
+ }));
106
+ }
107
+ var x = (e) => `figma:client-storage:${e}`, S = (t) => e.getInstance(x(t)), C = () => {
108
+ y || (y = !0, c.getInstance().add(h, (e) => {
109
+ S(e.name).run(e.value).then();
110
+ }));
111
+ }, w = !1;
112
+ function T(e) {
113
+ O();
114
+ let t = D();
115
+ t.addCallback(e), t.isLoading() || (t.preparation(), c.getInstance().post(p));
116
+ }
117
+ var E = () => "figma:frame-selection:get", D = () => e.getInstance(E()), O = () => {
118
+ w || (w = !0, c.getInstance().add(p, (e) => {
119
+ D().run(e);
120
+ }));
121
+ }, k = "ui-figma-styles-update", A = !1;
122
+ function j(e) {
123
+ P(), N().addCallback(e);
124
+ }
125
+ var M = () => "figma:frame-styles:get", N = () => e.getInstance(M()), P = () => {
126
+ A || (A = !0, c.getInstance().add(k, (e) => {
127
+ N().run(e).then();
128
+ }));
129
+ }, F, I = !1;
130
+ function L(e) {
131
+ if (F) {
132
+ e(F);
133
+ return;
134
+ }
135
+ if (I) {
136
+ setTimeout(() => L(e), 160);
137
+ return;
138
+ }
139
+ I = !0, c.getInstance().add(d, (t) => {
140
+ F = t, I = !1, e(F);
141
+ }).post(d);
142
+ }
143
+ //#endregion
144
+ //#region src/functions/fetchStorage.ts
145
+ var R = !1;
146
+ function z(e, t, n, r, i = !0) {
147
+ H();
148
+ let a = V(e, n);
149
+ a.addCallback(t, i), a.isLoading() || (a.preparation(), c.getInstance().post(_, {
150
+ name: e,
151
+ id: n,
152
+ defaultValue: r
153
+ }));
154
+ }
155
+ var B = (e, t) => `figma:storage:${t ? `${e}:${t}` : e}`, V = (t, n) => e.getInstance(B(t, n)), H = () => {
156
+ R || (R = !0, c.getInstance().add(_, (e) => {
157
+ V(e.name, e.id).run(e.value);
158
+ }));
159
+ }, U, W = !1;
160
+ function G(e) {
161
+ if (U) {
162
+ e(U);
163
+ return;
164
+ }
165
+ if (W) {
166
+ setTimeout(() => G(e), 160);
167
+ return;
168
+ }
169
+ W = !0;
170
+ let t = c.getInstance(), n = (r) => {
171
+ U = r, U.length > 0 && (e(U), t.remove(u, n), W = !1);
172
+ };
173
+ t.add(u, n).post(u);
174
+ }
175
+ //#endregion
176
+ //#region src/functions/sendClientStorage.ts
177
+ function K(e, t) {
178
+ c.getInstance().post(g, {
179
+ name: e,
180
+ value: t
181
+ });
182
+ }
183
+ //#endregion
184
+ //#region src/functions/sendFrameSelection.ts
185
+ function q(e) {
186
+ c.getInstance().post(m, { id: e });
187
+ }
188
+ //#endregion
189
+ //#region src/functions/sendFrameStyles.ts
190
+ function J(e) {
191
+ c.getInstance().post(k, e);
192
+ }
193
+ //#endregion
194
+ //#region src/functions/sendFramesSelected.ts
195
+ function Y(e, t) {
196
+ c.getInstance().post(f, {
197
+ id: e,
198
+ selected: t
199
+ });
200
+ }
201
+ //#endregion
202
+ //#region src/functions/sendStorage.ts
203
+ function X(e, t, n) {
204
+ c.getInstance().post(v, {
205
+ name: e,
206
+ value: t,
207
+ id: n
208
+ });
209
+ }
210
+ //#endregion
211
+ export { k as FIGMA_FRAME_STYLES_MESSENGER_NAME, s as FigmaPostAbstract, o as FigmaPostCode, c as FigmaUiMessenger, h as UI_FIGMA_CLIENT_STORAGE_GET, g as UI_FIGMA_CLIENT_STORAGE_SET, u as UI_FIGMA_FRAMES_POST_NAME, f as UI_FIGMA_FRAMES_SELECTED_ADD_NAME, d as UI_FIGMA_FRAMES_SELECTED_POST_NAME, p as UI_FIGMA_FRAME_GET_SELECTION, m as UI_FIGMA_FRAME_SET_SELECTION, _ as UI_FIGMA_STORAGE_GET, v as UI_FIGMA_STORAGE_SET, b as fetchClientStorage, T as fetchFrameSelection, j as fetchFrameStyles, L as fetchFramesSelected, z as fetchStorage, G as fetchTopLevelFrames, K as sendClientStorage, q as sendFrameSelection, J as sendFrameStyles, Y as sendFramesSelected, X as sendStorage };
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Type for the message callback function/
3
+ * Тип для функции обратного вызова сообщения
4
+ */
5
+ export type UiFigmaMessengerCallback<Message = any> = (message: Message) => void;
6
+ /**
7
+ * Item containing a callback and its execution rule/
8
+ * Элемент, содержащий функцию обратного вызова и правило её выполнения
9
+ */
10
+ export type UiFigmaMessengerCallbackItem<Message = any> = {
11
+ /** Callback function / Функция обратного вызова */
12
+ callback: UiFigmaMessengerCallback<Message>;
13
+ /** Rule for single execution / Правило однократного выполнения */
14
+ once: boolean;
15
+ };
16
+ /**
17
+ * Structure for storing a message type and its associated callbacks/
18
+ * Структура для хранения типа сообщения и связанных с ним обратных вызовов
19
+ */
20
+ export type UiFigmaMessengerItem = {
21
+ /** Message type / Тип сообщения */
22
+ type: string;
23
+ /** List of registered callbacks / Список зарегистрированных функций обратного вызова */
24
+ callbackList: UiFigmaMessengerCallbackItem[];
25
+ };
26
+ /**
27
+ * List of message items/
28
+ * Список элементов сообщений
29
+ */
30
+ export type UiFigmaMessengerList = Record<string, UiFigmaMessengerItem>;
31
+ /**
32
+ * Data structure for a message sent between the plugin and UI/
33
+ * Структура данных для сообщения, передаваемого между плагином и UI
34
+ */
35
+ export type UiFigmaMessengerData<Message = any> = {
36
+ /** Verification code / Проверочный код */
37
+ code: string;
38
+ /** Message type / Тип сообщения */
39
+ type: string;
40
+ /** Message content / Содержимое сообщения */
41
+ message?: Message;
42
+ };
@@ -0,0 +1,100 @@
1
+ import { UiFigmaFramesItem } from './framesTypes';
2
+ /**
3
+ * Type representing CSS styles for a Figma element.
4
+ *
5
+ * Тип, представляющий CSS-стили для элемента Figma.
6
+ */
7
+ export type UiFigmaFrameStylesCssItem = Record<string, string>;
8
+ /**
9
+ * List of CSS styles for multiple Figma elements, indexed by ID.
10
+ *
11
+ * Список CSS-стилей для нескольких элементов Figma, индексированный по ID.
12
+ */
13
+ export type UiFigmaFrameStylesCssList = Record<string, UiFigmaFrameStylesCssItem>;
14
+ /**
15
+ * JSON structure for Figma frame style data.
16
+ *
17
+ * JSON-структура для данных стиля фрейма Figma.
18
+ */
19
+ export type UiFigmaFrameStylesJson = {
20
+ /** Node ID / Идентификатор узла */
21
+ id: string;
22
+ /** Node name / Имя узла */
23
+ name: string;
24
+ /** Node type / Тип узла */
25
+ type?: string;
26
+ /** Text content (for text nodes) / Текстовое содержимое (для текстовых узлов) */
27
+ characters?: string;
28
+ /** Style properties / Свойства стиля */
29
+ style?: Record<string, string | number | boolean>;
30
+ /** Map of style IDs / Карта идентификаторов стилей */
31
+ styles?: Record<string, string>;
32
+ /** Child nodes / Дочерние узлы */
33
+ children?: UiFigmaFrameStylesJson[];
34
+ };
35
+ /**
36
+ * Data structure containing Figma document tree and styles.
37
+ *
38
+ * Структура данных, содержащая дерево документа Figma и стили.
39
+ */
40
+ export type UiFigmaFrameStylesData = {
41
+ /** Document node tree / Дерево узлов документа */
42
+ document: UiFigmaFrameStylesJson;
43
+ /** Style definitions / Определения стилей */
44
+ styles: Record<string, any>;
45
+ };
46
+ /**
47
+ * Represents a Figma frame style item, extending frame information.
48
+ *
49
+ * Представляет элемент стиля фрейма Figma, расширяющий информацию о фрейме.
50
+ */
51
+ export type UiFigmaFrameStylesItem = UiFigmaFramesItem & {
52
+ /** Compact JSON data / Компактные данные JSON */
53
+ json?: UiFigmaFrameStylesData;
54
+ /** Text content / Текстовое содержимое */
55
+ text?: string;
56
+ /** CSS styles / CSS-стили */
57
+ styles?: UiFigmaFrameStylesCssItem;
58
+ /** Map of children's CSS styles / Карта CSS-стилей дочерних элементов */
59
+ childrenStyles?: UiFigmaFrameStylesCssList;
60
+ };
61
+ /**
62
+ * List of frame style items.
63
+ *
64
+ * Список элементов стиля фрейма.
65
+ */
66
+ export type UiFigmaFrameStylesList = UiFigmaFrameStylesItem[];
67
+ /**
68
+ * Attributes for the messenger request to update frame styles.
69
+ *
70
+ * Атрибуты для запроса через мессенджер на обновление стилей фреймов.
71
+ */
72
+ export type UiFigmaFrameStylesMessengerAttributes = {
73
+ /** List of IDs / Список идентификаторов */
74
+ ids: string | string[];
75
+ /** Whether to include child styles / Включать ли стили дочерних элементов */
76
+ children?: boolean;
77
+ };
78
+ /**
79
+ * Item in the messenger response for frame styles.
80
+ *
81
+ * Элемент в ответе мессенджера для стилей фрейма.
82
+ */
83
+ export type UiFigmaFrameStylesMessengerResponseItem = {
84
+ /** Node ID / Идентификатор узла */
85
+ id: string;
86
+ /** Style data / Данные стилей */
87
+ data: UiFigmaFrameStylesList;
88
+ };
89
+ /**
90
+ * Full response from the messenger for frame styles.
91
+ *
92
+ * Полный ответ от мессенджера для стилей фрейма.
93
+ */
94
+ export type UiFigmaFrameStylesMessengerResponse = UiFigmaFrameStylesMessengerResponseItem[];
95
+ /**
96
+ * Messenger event name for updating Figma frame styles.
97
+ *
98
+ * Имя события мессенджера для обновления стилей фреймов Figma.
99
+ */
100
+ export declare const FIGMA_FRAME_STYLES_MESSENGER_NAME = "ui-figma-styles-update";
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Represents a simplified Figma frame item for the UI/
3
+ * Представляет упрощенный элемент фрейма Figma для пользовательского интерфейса
4
+ */
5
+ export type UiFigmaFramesItem = {
6
+ /** Name of the frame / Название фрейма */
7
+ name: string;
8
+ /** Unique element ID / Уникальный идентификатор элемента */
9
+ id: string;
10
+ /** Image as a byte array or Base64 string / Изображение в виде байтового массива или строки Base64 */
11
+ image?: Uint8Array<ArrayBufferLike> | string;
12
+ };
13
+ /**
14
+ * List of frame items/
15
+ * Список элементов фреймов
16
+ */
17
+ export type UiFigmaFramesList = UiFigmaFramesItem[];
18
+ /**
19
+ * Message name for sending the list of frames/
20
+ * Имя сообщения для отправки списка фреймов
21
+ */
22
+ export declare const UI_FIGMA_FRAMES_POST_NAME = "ui-figma-frames-list";
23
+ /**
24
+ * Message name for sending the selected frames/
25
+ * Имя сообщения для отправки выбранных фреймов
26
+ */
27
+ export declare const UI_FIGMA_FRAMES_SELECTED_POST_NAME = "ui-figma-frames-selected";
28
+ /**
29
+ * Message name for adding a frame to the selection/
30
+ * Имя сообщения для добавления фрейма в выборку
31
+ */
32
+ export declare const UI_FIGMA_FRAMES_SELECTED_ADD_NAME = "ui-figma-frames-selected-add";
33
+ /**
34
+ * Message name for getting the selection of frames/
35
+ * Имя сообщения для получения выборки фреймов
36
+ */
37
+ export declare const UI_FIGMA_FRAME_GET_SELECTION = "ui-figma-frame-get-selection";
38
+ /**
39
+ * Message name for setting the selection of frames/
40
+ * Имя сообщения для установки выборки фреймов
41
+ */
42
+ export declare const UI_FIGMA_FRAME_SET_SELECTION = "ui-figma-frame-set-selection";
43
+ /**
44
+ * Message name for getting the client storage/
45
+ * Имя сообщения для получения клиентского хранилища
46
+ */
47
+ export declare const UI_FIGMA_CLIENT_STORAGE_GET = "ui-figma-client-storage-get";
48
+ /**
49
+ * Message name for setting the client storage/
50
+ * Имя сообщения для установки клиентского хранилища
51
+ */
52
+ export declare const UI_FIGMA_CLIENT_STORAGE_SET = "ui-figma-client-storage-set";
53
+ /**
54
+ * Message name for getting the storage/
55
+ * Имя сообщения для получения хранилища
56
+ */
57
+ export declare const UI_FIGMA_STORAGE_GET = "ui-figma-storage-get";
58
+ /**
59
+ * Message name for setting the storage/
60
+ * Имя сообщения для установки хранилища
61
+ */
62
+ export declare const UI_FIGMA_STORAGE_SET = "ui-figma-storage-set";
@@ -0,0 +1,11 @@
1
+ /** Client storage messenger data/ Данные сообщения клиентского хранилища */
2
+ export type ClientStorageMessengerData<T = any> = {
3
+ name: string;
4
+ value: T;
5
+ };
6
+ /** Storage messenger data/ Данные сообщения хранилища */
7
+ export type StorageMessengerData<T = any> = {
8
+ id?: string;
9
+ name: string;
10
+ value: T;
11
+ };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@dxtmisha/figma",
3
+ "private": false,
4
+ "version": "0.1.0",
5
+ "type": "module",
6
+ "description": "[description]",
7
+ "scripts": {
8
+ "dev": "vite",
9
+ "build": "vue-tsc -b && vite build",
10
+ "preview": "vite preview",
11
+ "test": "vitest",
12
+ "library": "dxt-library",
13
+ "types": "dxt-types",
14
+ "prepublishOnly": "npm run library && npm run build",
15
+ "public-to-npm": "npm publish --access public"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "ai-description.txt",
20
+ "ai-doc.ru.txt",
21
+ "ai-doc.txt",
22
+ "ai-types.txt",
23
+ "CHANGELOG.md",
24
+ "LICENSE",
25
+ "package.json",
26
+ "README.md"
27
+ ],
28
+ "main": "dist/library.js",
29
+ "module": "dist/library.js",
30
+ "types": "dist/library.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "import": "./dist/library.js",
34
+ "types": "./dist/library.d.ts"
35
+ },
36
+ "./style.css": "./dist/style.css",
37
+ "./types/*": "./dist/*",
38
+ "./types/**/*.d.ts": "./dist/**/*.d.ts"
39
+ },
40
+ "dependencies": {},
41
+ "devDependencies": {},
42
+ "sideEffects": false
43
+ }