@yurikilian/lex4 1.4.1 → 1.5.2

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.
Files changed (44) hide show
  1. package/README.md +6 -4
  2. package/dist/ast/inline-mapper.d.ts.map +1 -1
  3. package/dist/ast/types.d.ts +1 -1
  4. package/dist/ast/types.d.ts.map +1 -1
  5. package/dist/components/BlockTypePicker.d.ts +11 -0
  6. package/dist/components/BlockTypePicker.d.ts.map +1 -0
  7. package/dist/components/CanvasControls.d.ts.map +1 -1
  8. package/dist/components/HeaderFooterToggle.d.ts +1 -0
  9. package/dist/components/HeaderFooterToggle.d.ts.map +1 -1
  10. package/dist/components/Lex4Editor.d.ts.map +1 -1
  11. package/dist/components/Toolbar.d.ts.map +1 -1
  12. package/dist/context/document-context.d.ts +1 -0
  13. package/dist/context/document-context.d.ts.map +1 -1
  14. package/dist/context/document-provider.d.ts.map +1 -1
  15. package/dist/context/toolbar-config.d.ts +18 -0
  16. package/dist/context/toolbar-config.d.ts.map +1 -0
  17. package/dist/extensions/variables-extension.d.ts.map +1 -1
  18. package/dist/i18n/defaults.d.ts.map +1 -1
  19. package/dist/i18n/pt-BR.d.ts.map +1 -1
  20. package/dist/i18n/types.d.ts +12 -0
  21. package/dist/i18n/types.d.ts.map +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/lex4-editor.cjs +845 -163
  25. package/dist/lex4-editor.cjs.map +1 -1
  26. package/dist/lex4-editor.js +829 -147
  27. package/dist/lex4-editor.js.map +1 -1
  28. package/dist/lexical/commands/block-commands.d.ts +5 -0
  29. package/dist/lexical/commands/block-commands.d.ts.map +1 -0
  30. package/dist/lexical/theme.d.ts.map +1 -1
  31. package/dist/lexical/utils/import-document-content.d.ts +4 -0
  32. package/dist/lexical/utils/import-document-content.d.ts.map +1 -0
  33. package/dist/style.css +156 -25
  34. package/dist/types/editor-handle.d.ts +2 -0
  35. package/dist/types/editor-handle.d.ts.map +1 -1
  36. package/dist/types/editor-props.d.ts +16 -0
  37. package/dist/types/editor-props.d.ts.map +1 -1
  38. package/dist/utils/text-style.d.ts +7 -0
  39. package/dist/utils/text-style.d.ts.map +1 -0
  40. package/dist/variables/variable-formatting.d.ts +11 -0
  41. package/dist/variables/variable-formatting.d.ts.map +1 -0
  42. package/dist/variables/variable-node.d.ts +10 -2
  43. package/dist/variables/variable-node.d.ts.map +1 -1
  44. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ import { LexicalEditor } from 'lexical';
2
+ export type BlockType = 'paragraph' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
3
+ export declare function setBlockType(editor: LexicalEditor, blockType: BlockType): void;
4
+ export declare function getActiveBlockType(editor: LexicalEditor): BlockType;
5
+ //# sourceMappingURL=block-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"block-commands.d.ts","sourceRoot":"","sources":["../../../src/lexical/commands/block-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAMjB,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9E,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,GAAG,IAAI,CAc9E;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,CAiBnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lexical/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,kBA4B1B,CAAC"}
1
+ {"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/lexical/theme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,kBA6B1B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { LexicalEditor } from 'lexical';
2
+ import { Lex4Document } from '../../types/document';
3
+ export declare function insertDocumentContent(editor: LexicalEditor, document: Lex4Document): boolean;
4
+ //# sourceMappingURL=import-document-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"import-document-content.d.ts","sourceRoot":"","sources":["../../../src/lexical/utils/import-document-content.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,aAAa,EAGnB,MAAM,SAAS,CAAC;AAOjB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AA6GzD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,GAAG,OAAO,CAiC5F"}
package/dist/style.css CHANGED
@@ -176,10 +176,10 @@
176
176
  .lex4-toolbar-row {
177
177
  display: flex;
178
178
  align-items: center;
179
- -moz-column-gap: 0.25rem;
180
- column-gap: 0.25rem;
179
+ -moz-column-gap: 0.375rem;
180
+ column-gap: 0.375rem;
181
181
  row-gap: 0.375rem;
182
- padding: 0.375rem 0.875rem;
182
+ padding: 0.5rem 0.875rem;
183
183
  flex-wrap: wrap;
184
184
  }
185
185
 
@@ -192,7 +192,11 @@
192
192
  .lex4-toolbar-group-gap {
193
193
  display: flex;
194
194
  align-items: center;
195
- gap: 0.25rem;
195
+ gap: 0.375rem;
196
+ }
197
+
198
+ .lex4-toolbar-group-block {
199
+ min-width: 9rem;
196
200
  }
197
201
 
198
202
  .lex4-toolbar-end {
@@ -202,12 +206,114 @@
202
206
  gap: 0.25rem;
203
207
  }
204
208
 
209
+ .lex4-block-type-picker {
210
+ position: relative;
211
+ }
212
+
213
+ .lex4-editor button.lex4-block-type-trigger {
214
+ display: inline-flex;
215
+ align-items: center;
216
+ gap: 0.375rem;
217
+ height: 32px;
218
+ padding: 0 0.5rem 0 0.625rem;
219
+ border-radius: 999px;
220
+ border: 1px solid var(--color-input);
221
+ background-color: var(--color-background);
222
+ color: var(--color-foreground);
223
+ transition: background-color 150ms, border-color 150ms, box-shadow 150ms;
224
+ }
225
+
226
+ .lex4-editor button.lex4-block-type-trigger:hover,
227
+ .lex4-editor button.lex4-block-type-trigger.open {
228
+ background-color: var(--color-secondary);
229
+ }
230
+
231
+ .lex4-editor button.lex4-block-type-trigger:focus-visible {
232
+ outline: none;
233
+ border-color: var(--color-ring);
234
+ box-shadow: 0 0 0 1px var(--color-ring);
235
+ }
236
+
237
+ .lex4-block-type-trigger-code {
238
+ min-width: 1.75rem;
239
+ font-size: 0.8125rem;
240
+ line-height: 1rem;
241
+ font-weight: 600;
242
+ color: var(--color-foreground);
243
+ text-align: center;
244
+ }
245
+
246
+ .lex4-block-type-trigger-code.heading {
247
+ color: var(--color-primary);
248
+ }
249
+
250
+ .lex4-block-type-trigger-chevron {
251
+ color: var(--color-muted-foreground);
252
+ transition: transform 150ms ease;
253
+ }
254
+
255
+ .lex4-block-type-trigger-chevron.open {
256
+ transform: rotate(180deg);
257
+ }
258
+
259
+ .lex4-block-type-menu {
260
+ position: absolute;
261
+ top: calc(100% + 0.5rem);
262
+ left: 0;
263
+ min-width: 13rem;
264
+ padding: 0.375rem;
265
+ border: 1px solid var(--color-border);
266
+ border-radius: 1rem;
267
+ background-color: var(--color-surface-elevated);
268
+ box-shadow: var(--shadow-lg);
269
+ z-index: 30;
270
+ }
271
+
272
+ .lex4-editor button.lex4-block-type-item {
273
+ width: 100%;
274
+ display: flex;
275
+ align-items: center;
276
+ gap: 0.75rem;
277
+ padding: 0.625rem 0.75rem;
278
+ border-radius: 0.75rem;
279
+ color: var(--color-foreground);
280
+ transition: background-color 150ms, color 150ms;
281
+ }
282
+
283
+ .lex4-editor button.lex4-block-type-item:hover,
284
+ .lex4-editor button.lex4-block-type-item.active {
285
+ background-color: var(--color-secondary);
286
+ }
287
+
288
+ .lex4-block-type-item-code {
289
+ min-width: 1.75rem;
290
+ font-size: 0.8125rem;
291
+ line-height: 1rem;
292
+ font-weight: 600;
293
+ color: var(--color-muted-foreground);
294
+ text-align: center;
295
+ }
296
+
297
+ .lex4-block-type-item-code.heading {
298
+ color: color-mix(in srgb, var(--color-primary) 80%, var(--color-foreground));
299
+ }
300
+
301
+ .lex4-block-type-item-code.active {
302
+ color: var(--color-primary);
303
+ }
304
+
305
+ .lex4-block-type-item-label {
306
+ font-size: 0.875rem;
307
+ line-height: 1.25rem;
308
+ font-weight: 500;
309
+ }
310
+
205
311
  .lex4-editor button.lex4-toolbar-toggle-btn {
206
312
  display: inline-flex;
207
313
  align-items: center;
208
314
  justify-content: center;
209
315
  gap: 0.5rem;
210
- height: 2rem;
316
+ height: 32px;
211
317
  padding: 0 0.75rem;
212
318
  border-radius: 0.375rem;
213
319
  border: 1px solid var(--color-input);
@@ -216,7 +322,7 @@
216
322
  font-size: 0.75rem;
217
323
  line-height: 1rem;
218
324
  font-weight: 500;
219
- transition: background-color 150ms, color 150ms, border-color 150ms;
325
+ transition: background-color 150ms, color 150ms, border-color 150ms, box-shadow 150ms;
220
326
  white-space: nowrap;
221
327
  }
222
328
 
@@ -240,15 +346,22 @@
240
346
  display: inline-flex;
241
347
  align-items: center;
242
348
  justify-content: center;
243
- height: 1.625rem;
244
- width: 1.625rem;
349
+ height: 32px;
350
+ width: 32px;
245
351
  border-radius: 0.375rem;
352
+ border: 1px solid transparent;
246
353
  color: var(--color-muted-foreground);
247
- transition: color 150ms, background-color 150ms;
354
+ transition: color 150ms, background-color 150ms, border-color 150ms, box-shadow 150ms;
248
355
  }
249
356
  .lex4-editor button.lex4-toolbar-btn svg {
250
357
  flex-shrink: 0;
251
358
  }
359
+ .lex4-editor button.lex4-toolbar-btn:focus-visible,
360
+ .lex4-editor button.lex4-toolbar-toggle-btn:focus-visible {
361
+ outline: none;
362
+ border-color: var(--color-ring);
363
+ box-shadow: 0 0 0 1px var(--color-ring);
364
+ }
252
365
  .lex4-editor button.lex4-toolbar-btn:hover:not(:disabled):not(.active) {
253
366
  background-color: var(--color-secondary);
254
367
  color: var(--color-foreground);
@@ -263,22 +376,24 @@
263
376
  }
264
377
 
265
378
  .lex4-toolbar-select {
266
- height: 1.75rem;
379
+ height: 32px;
267
380
  border-radius: 0.375rem;
268
- border: none;
381
+ border: 1px solid transparent;
269
382
  padding: 0 0.5rem;
270
383
  font-size: 0.75rem;
271
384
  line-height: 1rem;
272
385
  font-weight: 500;
273
- background-color: transparent;
386
+ background-color: var(--color-background);
274
387
  color: var(--color-foreground);
275
- transition: background-color 150ms;
388
+ transition: background-color 150ms, border-color 150ms, box-shadow 150ms;
276
389
  }
277
390
  .lex4-toolbar-select:hover {
278
391
  background-color: var(--color-secondary);
279
392
  }
280
- .lex4-toolbar-select:focus {
393
+ .lex4-toolbar-select:focus,
394
+ .lex4-toolbar-select:focus-visible {
281
395
  outline: none;
396
+ border-color: var(--color-ring);
282
397
  box-shadow: 0 0 0 1px var(--color-ring);
283
398
  }
284
399
 
@@ -287,6 +402,10 @@
287
402
  padding: 0 0.25rem;
288
403
  }
289
404
 
405
+ .lex4-toolbar-select-block {
406
+ min-width: 9rem;
407
+ }
408
+
290
409
  .lex4-toolbar-separator {
291
410
  margin: 0 0.25rem;
292
411
  height: 1.25rem;
@@ -303,7 +422,7 @@
303
422
  display: inline-flex;
304
423
  align-items: center;
305
424
  gap: 0.375rem;
306
- min-height: 1.75rem;
425
+ height: 32px;
307
426
  cursor: pointer;
308
427
  -webkit-user-select: none;
309
428
  -moz-user-select: none;
@@ -325,8 +444,8 @@
325
444
  .lex4-hf-switch {
326
445
  position: relative;
327
446
  display: inline-flex;
328
- height: 0.9375rem;
329
- width: 1.625rem;
447
+ height: 1rem;
448
+ width: 1.75rem;
330
449
  align-items: center;
331
450
  border-radius: 9999px;
332
451
  transition: background-color 200ms;
@@ -334,8 +453,8 @@
334
453
 
335
454
  .lex4-hf-switch-knob {
336
455
  display: inline-block;
337
- height: 0.6875rem;
338
- width: 0.6875rem;
456
+ height: 0.75rem;
457
+ width: 0.75rem;
339
458
  border-radius: 9999px;
340
459
  background-color: white;
341
460
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
@@ -344,7 +463,7 @@
344
463
  }
345
464
 
346
465
  .lex4-hf-switch[aria-checked="true"] .lex4-hf-switch-knob {
347
- transform: translateX(0.8125rem);
466
+ transform: translateX(0.875rem);
348
467
  }
349
468
 
350
469
  /* ── Settings menu (HF actions) ──────────────────────────── */
@@ -363,8 +482,8 @@
363
482
  }
364
483
 
365
484
  .lex4-editor button.lex4-settings-trigger-icon {
366
- width: 1.875rem;
367
- height: 1.875rem;
485
+ width: 32px;
486
+ height: 32px;
368
487
  justify-content: center;
369
488
  padding: 0;
370
489
  border-radius: 0.5rem;
@@ -925,7 +1044,7 @@
925
1044
  cursor: default;
926
1045
  white-space: nowrap;
927
1046
  margin: 0 0.125rem;
928
- transition: border-color 150ms, background-color 150ms;
1047
+ transition: border-color 150ms, background-color 150ms, box-shadow 150ms;
929
1048
  }
930
1049
 
931
1050
  .lex4-variable-chip::before {
@@ -942,6 +1061,12 @@
942
1061
  border-color: color-mix(in srgb, var(--lex4-variable-accent, var(--color-border-strong)) 40%, var(--color-border));
943
1062
  }
944
1063
 
1064
+ .lex4-variable-chip-selected {
1065
+ border-color: color-mix(in srgb, var(--lex4-variable-accent, var(--color-primary)) 45%, var(--color-primary));
1066
+ background-color: color-mix(in srgb, var(--lex4-variable-bg, var(--color-secondary)) 72%, var(--color-selection-bg));
1067
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-primary) 16%, transparent);
1068
+ }
1069
+
945
1070
  /* ── Document view ───────────────────────────────────────── */
946
1071
  .lex4-document-view {
947
1072
  display: flex;
@@ -1025,6 +1150,11 @@
1025
1150
  font-weight: 500;
1026
1151
  }
1027
1152
 
1153
+ .lex4-heading-h6 {
1154
+ font-size: 0.9375rem;
1155
+ font-weight: 500;
1156
+ }
1157
+
1028
1158
  .lex4-text-bold {
1029
1159
  font-weight: 700;
1030
1160
  }
@@ -1076,9 +1206,10 @@
1076
1206
 
1077
1207
  .lex4-page-placeholder {
1078
1208
  position: absolute;
1079
- top: 0.25rem;
1209
+ top: 0;
1080
1210
  left: 0;
1081
- font-size: 0.8125rem;
1211
+ font-size: inherit;
1212
+ line-height: inherit;
1082
1213
  color: color-mix(in srgb, var(--color-muted-foreground) 82%, transparent);
1083
1214
  pointer-events: none;
1084
1215
  -webkit-user-select: none;
@@ -1,3 +1,4 @@
1
+ import { Lex4Document } from './document';
1
2
  /**
2
3
  * Imperative handle exposed by Lex4Editor via React ref.
3
4
  *
@@ -17,5 +18,6 @@
17
18
  export interface Lex4EditorHandle {
18
19
  setHistorySidebarOpen: (open: boolean) => void;
19
20
  toggleHistorySidebar: () => void;
21
+ insertDocumentContent: (document: Lex4Document) => boolean;
20
22
  }
21
23
  //# sourceMappingURL=editor-handle.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor-handle.d.ts","sourceRoot":"","sources":["../../src/types/editor-handle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,oBAAoB,EAAE,MAAM,IAAI,CAAC;CAClC"}
1
+ {"version":3,"file":"editor-handle.d.ts","sourceRoot":"","sources":["../../src/types/editor-handle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,qBAAqB,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,OAAO,CAAC;CAC5D"}
@@ -5,6 +5,20 @@ import { Lex4Translations } from '../i18n/types';
5
5
  type DeepPartial<T> = {
6
6
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
7
7
  };
8
+ export interface Lex4ToolbarControlConfig {
9
+ /** Controls whether the toolbar control is rendered. Defaults to true. */
10
+ visible?: boolean;
11
+ /** Controls whether the toolbar control renders its text label. Defaults to true. */
12
+ showLabel?: boolean;
13
+ }
14
+ export interface Lex4ToolbarConfig {
15
+ /** Configuration for the history toggle. */
16
+ history?: Lex4ToolbarControlConfig;
17
+ /** Configuration for the variables toggle provided by variablesExtension. */
18
+ variables?: Lex4ToolbarControlConfig;
19
+ /** Configuration for the header/footer toggle group. */
20
+ headerFooter?: Lex4ToolbarControlConfig;
21
+ }
8
22
  /** Public props for the Lex4Editor component */
9
23
  export interface Lex4EditorProps {
10
24
  /** Initial document state. Defaults to a single empty page. */
@@ -36,6 +50,8 @@ export interface Lex4EditorProps {
36
50
  * @example translations={{ toolbar: { undo: 'Desfazer' } }}
37
51
  */
38
52
  translations?: DeepPartial<Lex4Translations>;
53
+ /** Configuration for optional toolbar controls such as history and variables. */
54
+ toolbar?: Lex4ToolbarConfig;
39
55
  /** Additional CSS class for the editor root element */
40
56
  className?: string;
41
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editor-props.d.ts","sourceRoot":"","sources":["../../src/types/editor-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,KAAK,WAAW,CAAC,CAAC,IAAI;KACnB,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WA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E,iBAAiB,CAAC;IAE5B,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,7 @@
1
+ export declare function extractStyleValue(style: string, property: string): string | undefined;
2
+ export declare function mergeStyleDeclaration(existingStyle: string, property: string, value: string): string;
3
+ export declare function extractFontFamilyFromStyle(style: string): string | undefined;
4
+ export declare function extractFontSizePtFromStyle(style: string): number | undefined;
5
+ export declare function mergeFontFamilyStyle(existingStyle: string, fontFamily: string): string;
6
+ export declare function mergeFontSizeStyle(existingStyle: string, size: number): string;
7
+ //# sourceMappingURL=text-style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-style.d.ts","sourceRoot":"","sources":["../../src/utils/text-style.ts"],"names":[],"mappings":"AAAA,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAIrF;AAED,wBAAgB,qBAAqB,CACnC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACZ,MAAM,CAQR;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE5E;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ5E;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAEtF;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9E"}
@@ -0,0 +1,11 @@
1
+ import { LexicalEditor, TextFormatType } from 'lexical';
2
+ import { VariableNode } from './variable-node';
3
+ export declare function getSelectedVariableNodes(editor: LexicalEditor): VariableNode[];
4
+ export declare function toggleSelectedVariableFormat(editor: LexicalEditor, format: TextFormatType): boolean;
5
+ export declare function applyFontFamilyToSelectedVariables(editor: LexicalEditor, fontFamily: string): boolean;
6
+ export declare function applyFontSizeToSelectedVariables(editor: LexicalEditor, size: number): boolean;
7
+ export declare function readSelectedVariableFormatting(editor: LexicalEditor): {
8
+ fontFamily?: string;
9
+ fontSize?: number;
10
+ };
11
+ //# sourceMappingURL=variable-formatting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"variable-formatting.d.ts","sourceRoot":"","sources":["../../src/variables/variable-formatting.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAOjB,OAAO,EAAmB,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAiCrE,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,EAAE,CAa9E;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,cAAc,GACrB,OAAO,CAgBT;AAED,wBAAgB,kCAAkC,CAChD,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,MAAM,GACjB,OAAO,CAMT;AAED,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,aAAa,EACrB,IAAI,EAAE,MAAM,GACX,OAAO,CAMT;AAED,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,aAAa,GAAG;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAWA"}
@@ -1,6 +1,8 @@
1
1
  import { DecoratorNode, DOMConversionMap, DOMExportOutput, LexicalNode, NodeKey, SerializedLexicalNode, Spread } from 'lexical';
2
2
  export type SerializedVariableNode = Spread<{
3
3
  variableKey: string;
4
+ format?: number;
5
+ style?: string;
4
6
  }, SerializedLexicalNode>;
5
7
  /**
6
8
  * VariableNode — a custom Lexical DecoratorNode that represents
@@ -14,10 +16,16 @@ export type SerializedVariableNode = Spread<{
14
16
  */
15
17
  export declare class VariableNode extends DecoratorNode<JSX.Element> {
16
18
  __variableKey: string;
19
+ __format: number;
20
+ __style: string;
17
21
  static getType(): string;
18
22
  static clone(node: VariableNode): VariableNode;
19
- constructor(variableKey: string, key?: NodeKey);
23
+ constructor(variableKey: string, format?: number, style?: string, key?: NodeKey);
20
24
  getVariableKey(): string;
25
+ getFormat(): number;
26
+ setFormat(format: number): this;
27
+ getStyle(): string;
28
+ setStyle(style: string): this;
21
29
  static importJSON(serializedNode: SerializedVariableNode): VariableNode;
22
30
  exportJSON(): SerializedVariableNode;
23
31
  createDOM(): HTMLElement;
@@ -29,6 +37,6 @@ export declare class VariableNode extends DecoratorNode<JSX.Element> {
29
37
  getTextContent(): string;
30
38
  decorate(): JSX.Element;
31
39
  }
32
- export declare function $createVariableNode(variableKey: string): VariableNode;
40
+ export declare function $createVariableNode(variableKey: string, format?: number, style?: string): VariableNode;
33
41
  export declare function $isVariableNode(node: LexicalNode | null | undefined): node is VariableNode;
34
42
  //# sourceMappingURL=variable-node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variable-node.d.ts","sourceRoot":"","sources":["../../src/variables/variable-node.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,qBAAqB,EAC1B,KAAK,MAAM,EACZ,MAAM,SAAS,CAAC;AAGjB,MAAM,MAAM,sBAAsB,GAAG,MAAM,CACzC;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,EACvB,qBAAqB,CACtB,CAAC;AAEF;;;;;;;;;GASG;AACH,qBAAa,YAAa,SAAQ,aAAa,CAAC,GAAG,CAAC,OAAO,CAAC;IAC1D,aAAa,EAAE,MAAM,CAAC;IAEtB,MAAM,CAAC,OAAO,IAAI,MAAM;IAIxB,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY;gBAIlC,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EA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