@uploadcare/file-uploader 1.26.3 → 1.27.0-alpha.1

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 (87) hide show
  1. package/dist/CloudImageEditorActivity-H7IY5ZRN.css +8 -0
  2. package/dist/CloudImageEditorActivity-H7IY5ZRN.layered.css +7 -0
  3. package/dist/CloudImageEditorActivity-LKW4OYEK.js +1 -0
  4. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  5. package/dist/chunk-BMGLMZ7T.js +7 -0
  6. package/dist/chunk-GVVHCZH5.js +7 -0
  7. package/dist/chunk-JYWKOLXZ.js +7 -0
  8. package/dist/chunk-PHLC56Y5.js +7 -0
  9. package/dist/chunk-SX25NGUM.js +8 -0
  10. package/dist/chunk-SX25NGUM.js.LEGAL.txt +70 -0
  11. package/dist/chunk-TMF3R5Q2.js +7 -0
  12. package/dist/cloud-image-editor-ANNQTRKP.css +6 -0
  13. package/dist/cloud-image-editor-ANNQTRKP.layered.css +7 -0
  14. package/dist/cloud-image-editor-JGU7R22E.js +1 -0
  15. package/dist/cloudImageEditorPlugin-IUHTPZGK.css +6 -0
  16. package/dist/cloudImageEditorPlugin-IUHTPZGK.layered.css +7 -0
  17. package/dist/cloudImageEditorPlugin-TRD2OAR2.js +8 -0
  18. package/dist/core.css +6 -0
  19. package/dist/core.d.ts +3168 -0
  20. package/dist/core.js +8 -0
  21. package/dist/core.js.LEGAL.txt +8 -0
  22. package/dist/core.layered.css +7 -0
  23. package/dist/env.js +3 -3
  24. package/dist/index.css +3 -3
  25. package/dist/index.d.ts +433 -106
  26. package/dist/index.js +5 -5
  27. package/dist/index.layered.css +3 -3
  28. package/dist/index.ssr.js +96 -6
  29. package/dist/locales/file-uploader/ar.js +2 -2
  30. package/dist/locales/file-uploader/az.js +2 -2
  31. package/dist/locales/file-uploader/ca.js +2 -2
  32. package/dist/locales/file-uploader/cs.js +2 -2
  33. package/dist/locales/file-uploader/da.js +2 -2
  34. package/dist/locales/file-uploader/de.js +2 -2
  35. package/dist/locales/file-uploader/el.js +2 -2
  36. package/dist/locales/file-uploader/en.js +2 -2
  37. package/dist/locales/file-uploader/es.js +2 -2
  38. package/dist/locales/file-uploader/et.js +2 -2
  39. package/dist/locales/file-uploader/fi.js +2 -2
  40. package/dist/locales/file-uploader/fr.js +2 -2
  41. package/dist/locales/file-uploader/he.js +2 -2
  42. package/dist/locales/file-uploader/hy.js +2 -2
  43. package/dist/locales/file-uploader/is.js +2 -2
  44. package/dist/locales/file-uploader/it.js +2 -2
  45. package/dist/locales/file-uploader/ja.js +2 -2
  46. package/dist/locales/file-uploader/ka.js +2 -2
  47. package/dist/locales/file-uploader/kk.js +2 -2
  48. package/dist/locales/file-uploader/ko.js +2 -2
  49. package/dist/locales/file-uploader/lv.js +2 -2
  50. package/dist/locales/file-uploader/nb.js +2 -2
  51. package/dist/locales/file-uploader/nl.js +2 -2
  52. package/dist/locales/file-uploader/pl.js +2 -2
  53. package/dist/locales/file-uploader/pt.js +2 -2
  54. package/dist/locales/file-uploader/ro.js +2 -2
  55. package/dist/locales/file-uploader/ru.js +2 -2
  56. package/dist/locales/file-uploader/sk.js +2 -2
  57. package/dist/locales/file-uploader/sr.js +2 -2
  58. package/dist/locales/file-uploader/sv.js +2 -2
  59. package/dist/locales/file-uploader/tr.js +2 -2
  60. package/dist/locales/file-uploader/uk.js +2 -2
  61. package/dist/locales/file-uploader/vi.js +2 -2
  62. package/dist/locales/file-uploader/zh-TW.js +2 -2
  63. package/dist/locales/file-uploader/zh.js +2 -2
  64. package/package.json +11 -1
  65. package/web/file-uploader.iife.min.d.ts +433 -106
  66. package/web/file-uploader.iife.min.js +4 -4
  67. package/web/file-uploader.min.d.ts +433 -106
  68. package/web/file-uploader.min.js +4 -4
  69. package/web/uc-basic.layered.min.css +3 -3
  70. package/web/uc-basic.min.css +3 -3
  71. package/web/uc-cloud-image-editor.layered.min.css +3 -3
  72. package/web/uc-cloud-image-editor.min.css +3 -3
  73. package/web/uc-cloud-image-editor.min.d.ts +518 -191
  74. package/web/uc-cloud-image-editor.min.js +4 -4
  75. package/web/uc-file-uploader-inline.layered.min.css +3 -3
  76. package/web/uc-file-uploader-inline.min.css +3 -3
  77. package/web/uc-file-uploader-inline.min.d.ts +433 -106
  78. package/web/uc-file-uploader-inline.min.js +4 -4
  79. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  80. package/web/uc-file-uploader-minimal.min.css +3 -3
  81. package/web/uc-file-uploader-minimal.min.d.ts +433 -106
  82. package/web/uc-file-uploader-minimal.min.js +4 -4
  83. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  84. package/web/uc-file-uploader-regular.min.css +3 -3
  85. package/web/uc-file-uploader-regular.min.d.ts +433 -106
  86. package/web/uc-file-uploader-regular.min.js +4 -4
  87. package/web/uc-img.min.js +4 -4
@@ -1,8 +1,8 @@
1
1
  import * as lit_html from 'lit-html';
2
2
  import { PropertyValues, nothing, LitElement, TemplateResult } from 'lit';
3
- import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
4
3
  import * as _uploadcare_upload_client from '@uploadcare/upload-client';
5
4
  import { UploadcareFile, Metadata, UploadError, NetworkError, UploadcareGroup, FileFromOptions, Queue } from '@uploadcare/upload-client';
5
+ import * as lit_html_directives_ref_js from 'lit-html/directives/ref.js';
6
6
  import { Ref } from 'lit/directives/ref.js';
7
7
  import { TelemetryRequest } from '@uploadcare/quality-insights';
8
8
 
@@ -230,6 +230,81 @@ declare global {
230
230
  }
231
231
  }
232
232
 
233
+ declare class A11y implements ISharedInstance {
234
+ private _destroyKeyUX;
235
+ private readonly _scopedWindow;
236
+ constructor();
237
+ registerBlock(scope: LitBlock): void;
238
+ destroy(): void;
239
+ }
240
+
241
+ declare class LocaleManager extends SharedInstance {
242
+ private _localeName;
243
+ constructor(sharedInstancesBag: SharedInstancesBag);
244
+ private _applyOverrides;
245
+ private _applyPluginLocales;
246
+ }
247
+
248
+ /**
249
+ * Custom configuration options registration system for plugins
250
+ */
251
+ type CustomConfigDefinition<T = unknown> = {
252
+ /**
253
+ * Config option name (will be used as property and optionally as attribute)
254
+ */
255
+ name: string;
256
+ /**
257
+ * Default value for the config option
258
+ */
259
+ defaultValue: T;
260
+ /**
261
+ * Whether this config can be set via HTML attribute
262
+ * @default true
263
+ */
264
+ attribute?: boolean;
265
+ /**
266
+ * Convert attribute string to config value
267
+ * Only used if attribute is true
268
+ */
269
+ fromAttribute?: (value: string | null) => T;
270
+ /**
271
+ * Convert config value to attribute string
272
+ * Only used if attribute is true
273
+ */
274
+ toAttribute?: (value: T) => string | null;
275
+ /**
276
+ * Normalize/validate the config value
277
+ */
278
+ normalize?: (value: unknown) => T;
279
+ };
280
+ /**
281
+ * Registry for custom config options defined by plugins
282
+ * This is managed by the PluginManager as a shared instance property
283
+ */
284
+ declare class CustomConfigRegistry {
285
+ private _definitions;
286
+ register<T = unknown>(pluginId: string, definition: CustomConfigDefinition<T>): void;
287
+ unregister(name: string): void;
288
+ unregisterByPlugin(pluginId: string): void;
289
+ get(name: string): CustomConfigDefinition<any> | undefined;
290
+ getAll(): Map<string, CustomConfigDefinition<any>>;
291
+ }
292
+ /**
293
+ * Interface for TypeScript module augmentation
294
+ * Plugins should extend this interface to add their custom config types
295
+ *
296
+ * @example
297
+ * ```typescript
298
+ * declare module '@uploadcare/file-uploader' {
299
+ * interface CustomConfig {
300
+ * 'my-custom-option': string;
301
+ * }
302
+ * }
303
+ * ```
304
+ */
305
+ interface CustomConfig {
306
+ }
307
+
233
308
  declare const InternalEventType: Readonly<{
234
309
  readonly INIT_SOLUTION: "init-solution";
235
310
  readonly CHANGE_CONFIG: "change-config";
@@ -296,6 +371,80 @@ declare class EventEmitter extends SharedInstance {
296
371
  destroy(): void;
297
372
  }
298
373
 
374
+ declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
375
+
376
+ declare class TypedData<T extends Record<string, unknown>> {
377
+ private _ctxId;
378
+ private _data;
379
+ constructor(initialValue: T);
380
+ get uid(): Uid;
381
+ setValue<K extends keyof T>(prop: K, value: T[K]): void;
382
+ setMultipleValues(updObj: Partial<T>): void;
383
+ getValue<K extends keyof T>(prop: K): T[K];
384
+ subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
385
+ destroy(): void;
386
+ }
387
+
388
+ interface UploadEntryData extends Record<string, unknown> {
389
+ file: File | null;
390
+ externalUrl: string | null;
391
+ fileName: string | null;
392
+ fileSize: number | null;
393
+ lastModified: number;
394
+ uploadProgress: number;
395
+ uuid: string | null;
396
+ isImage: boolean;
397
+ mimeType: string | null;
398
+ ctxName: string | null;
399
+ cdnUrl: string | null;
400
+ cdnUrlModifiers: string | null;
401
+ fileInfo: UploadcareFile | null;
402
+ isUploading: boolean;
403
+ abortController: AbortController | null;
404
+ thumbUrl: string | null;
405
+ silent: boolean;
406
+ source: string | null;
407
+ fullPath: string | null;
408
+ metadata: Metadata | null;
409
+ errors: OutputErrorFile[];
410
+ uploadError: Error | null;
411
+ isRemoved: boolean;
412
+ isQueuedForUploading: boolean;
413
+ isValidationPending: boolean;
414
+ isQueuedForValidation: boolean;
415
+ }
416
+ type UploadEntryTypedData = TypedData<UploadEntryData>;
417
+ type UploadEntryKeys = keyof UploadEntryData;
418
+
419
+ type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
420
+ signal?: AbortSignal;
421
+ }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
422
+ type FileValidatorDescriptor = {
423
+ runOn: 'add' | 'upload' | 'change';
424
+ validator: FuncFileValidator;
425
+ };
426
+ type FileValidator = FileValidatorDescriptor | FuncFileValidator;
427
+ type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
428
+ declare class ValidationManager extends SharedInstance {
429
+ private get _uploadCollection();
430
+ private _commonFileValidators;
431
+ private _commonCollectionValidators;
432
+ private _queue;
433
+ private _runQueueDebounced;
434
+ private _isDestroyed;
435
+ private _entryValidationState;
436
+ constructor(sharedInstancesBag: SharedInstancesBag);
437
+ runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
438
+ runCollectionValidators(): void;
439
+ cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
440
+ private _runFileValidatorsForEntry;
441
+ private _addCustomTypeToValidationError;
442
+ private _getEntryValidationState;
443
+ private _getValidatorDescriptors;
444
+ private _getValidatorDescriptorsForEntry;
445
+ destroy(): void;
446
+ }
447
+
299
448
  declare class ActivityHeader extends LitActivityBlock {
300
449
  }
301
450
  declare global {
@@ -307,11 +456,14 @@ declare global {
307
456
  declare class Icon extends LitBlock {
308
457
  name: string;
309
458
  private _resolvedHref;
459
+ private _pluginSvg;
310
460
  private _iconHrefResolver;
461
+ private _unsubscribePlugins?;
311
462
  initCallback(): void;
312
463
  protected willUpdate(changedProperties: PropertyValues<this>): void;
313
464
  private _updateResolvedHref;
314
465
  render(): lit_html.TemplateResult<1>;
466
+ disconnectedCallback(): void;
315
467
  }
316
468
  declare global {
317
469
  interface HTMLElementTagNameMap {
@@ -459,25 +611,54 @@ declare global {
459
611
  /**
460
612
  * Config keys that can't be passed as attribute (because they are object or function)
461
613
  */
462
- declare const complexConfigKeys: readonly ["metadata", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
463
- /** Mapping of attribute names to state */
464
- declare const attrStateMapping: Record<string, string>;
614
+ declare const complexConfigKeys: readonly ["metadata", "plugins", "localeDefinitionOverride", "secureUploadsSignatureResolver", "secureDeliveryProxyUrlResolver", "iconHrefResolver", "fileValidators", "collectionValidators", "mediaRecorderOptions"];
465
615
  declare class Config extends LitBlock {
466
616
  attributesMeta: Partial<ConfigPlainType> & {
467
617
  'ctx-name': string;
468
618
  };
469
619
  init$: LitBlock["init$"] & ConfigType;
470
620
  private _computationControllers;
621
+ private _pluginChangeUnsubscribe?;
622
+ private _mutationObserver?;
623
+ /**
624
+ * Mapping of attribute names to custom config keys for plugin-registered configs.
625
+ * Updated dynamically when plugins are registered or changed.
626
+ * Similar to builtinAttrKeyMapping but for custom configs.
627
+ */
628
+ private _customAttrKeyMapping;
629
+ /** Set of all custom config names registered by plugins */
630
+ private _customConfigKeys;
631
+ /**
632
+ * Map of custom config subscriptions (config name -> unsubscribe function)
633
+ * Used to track and clean up subscriptions when plugins change
634
+ */
635
+ private _customConfigSubscriptions;
636
+ /**
637
+ * Check if a key is a custom config (registered by plugins)
638
+ */
639
+ private _isCustomConfig;
640
+ /**
641
+ * Get the custom config definition for a key
642
+ */
643
+ private _getCustomConfigDefinition;
644
+ /**
645
+ * Get attribute names for a config key (kebab-case and lowercase)
646
+ */
647
+ private _getAttributeNames;
471
648
  private _flushValueToAttribute;
472
649
  private _flushValueToState;
473
650
  private _setValue;
474
651
  private _getValue;
475
652
  private _assertSameValueDifferentReference;
653
+ private _processCustomConfigs;
654
+ private _setupCustomConfigs;
655
+ private _setupMutationObserver;
476
656
  initCallback(): void;
477
- attributeChangedCallback(name: keyof typeof attrStateMapping, oldVal: string, newVal: string): void;
657
+ attributeChangedCallback(name: string, oldVal: string, newVal: string): void;
658
+ disconnectedCallback(): void;
478
659
  static get observedAttributes(): string[];
479
660
  }
480
- interface Config extends ConfigType {
661
+ interface Config extends ConfigType, CustomConfig {
481
662
  }
482
663
  declare global {
483
664
  interface HTMLElementTagNameMap {
@@ -485,49 +666,6 @@ declare global {
485
666
  }
486
667
  }
487
668
 
488
- declare class TypedData<T extends Record<string, unknown>> {
489
- private _ctxId;
490
- private _data;
491
- constructor(initialValue: T);
492
- get uid(): Uid;
493
- setValue<K extends keyof T>(prop: K, value: T[K]): void;
494
- setMultipleValues(updObj: Partial<T>): void;
495
- getValue<K extends keyof T>(prop: K): T[K];
496
- subscribe<K extends keyof T>(prop: K, handler: (newVal: T[K]) => void): Unsubscriber;
497
- destroy(): void;
498
- }
499
-
500
- interface UploadEntryData extends Record<string, unknown> {
501
- file: File | null;
502
- externalUrl: string | null;
503
- fileName: string | null;
504
- fileSize: number | null;
505
- lastModified: number;
506
- uploadProgress: number;
507
- uuid: string | null;
508
- isImage: boolean;
509
- mimeType: string | null;
510
- ctxName: string | null;
511
- cdnUrl: string | null;
512
- cdnUrlModifiers: string | null;
513
- fileInfo: UploadcareFile | null;
514
- isUploading: boolean;
515
- abortController: AbortController | null;
516
- thumbUrl: string | null;
517
- silent: boolean;
518
- source: string | null;
519
- fullPath: string | null;
520
- metadata: Metadata | null;
521
- errors: OutputErrorFile[];
522
- uploadError: Error | null;
523
- isRemoved: boolean;
524
- isQueuedForUploading: boolean;
525
- isValidationPending: boolean;
526
- isQueuedForValidation: boolean;
527
- }
528
- type UploadEntryTypedData = TypedData<UploadEntryData>;
529
- type UploadEntryKeys = keyof UploadEntryData;
530
-
531
669
  declare class FileItemConfig extends LitUploaderBlock {
532
670
  private _entrySubs;
533
671
  protected entry: UploadEntryTypedData | null;
@@ -604,12 +742,12 @@ declare class FileItem extends FileItemConfig {
604
742
  private _isFailed;
605
743
  private _isUploading;
606
744
  private _isFocused;
607
- private _isEditable;
608
745
  private _showFileNames;
609
746
  private _ariaLabelStatusFile;
747
+ private _pluginFileActions;
610
748
  private _renderedOnce;
611
749
  private _observer?;
612
- private _handleEdit;
750
+ private _unsubscribePlugins?;
613
751
  private _handleRemove;
614
752
  private _handleUploadClick;
615
753
  private _calculateState;
@@ -621,6 +759,8 @@ declare class FileItem extends FileItemConfig {
621
759
  private _handleEntryId;
622
760
  private _updateShowFileNames;
623
761
  protected willUpdate(changedProperties: PropertyValues<this>): void;
762
+ private _updatePluginFileActions;
763
+ private _handlePluginFileAction;
624
764
  initCallback(): void;
625
765
  connectedCallback(): void;
626
766
  disconnectedCallback(): void;
@@ -799,8 +939,6 @@ declare const CameraSourceTypes: Readonly<{
799
939
  }>;
800
940
  type ModeCameraType = (typeof CameraSourceTypes)[keyof typeof CameraSourceTypes];
801
941
 
802
- declare function buildOutputCollectionState<TCollectionStatus extends OutputCollectionStatus, TGroupFlag extends GroupFlag = 'maybe-has-group'>(bag: SharedInstancesBag): OutputCollectionState<TCollectionStatus, TGroupFlag>;
803
-
804
942
  type ApiAddFileCommonOptions = {
805
943
  silent?: boolean;
806
944
  fileName?: string;
@@ -831,7 +969,7 @@ declare class UploaderPublicApi extends SharedInstance {
831
969
  getOutputCollectionState<TStatus extends OutputCollectionStatus>(): ReturnType<typeof buildOutputCollectionState<TStatus>>;
832
970
  initFlow: (force?: boolean) => void;
833
971
  doneFlow: () => void;
834
- setCurrentActivity: <T extends RegisteredActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] : T extends RegisteredActivityType ? [undefined?] : [never]) => void;
972
+ setCurrentActivity: <T extends ActivityType>(activityType: T, ...params: T extends keyof ActivityParamsMap ? [ActivityParamsMap[T]] extends [never] ? [] : [ActivityParamsMap[T]] : []) => void;
835
973
  getCurrentActivity: () => ActivityType;
836
974
  setModalState: (opened: boolean) => void;
837
975
  private get _sourceList();
@@ -1049,6 +1187,10 @@ type ConfigType = {
1049
1187
  * Expiry threshold for secure uploads.
1050
1188
  */
1051
1189
  secureUploadsExpireThreshold: number;
1190
+ /**
1191
+ * Array of plugins to register with the uploader instance.
1192
+ */
1193
+ plugins: UploaderPlugin[];
1052
1194
  /**
1053
1195
  * Metadata for the file.
1054
1196
  */
@@ -1296,6 +1438,251 @@ type OutputCollectionState<TStatus extends OutputCollectionStatus = OutputCollec
1296
1438
  allEntries: OutputFileEntry[];
1297
1439
  });
1298
1440
 
1441
+ type PluginVersion = string;
1442
+ type PluginIconRegistration = {
1443
+ name: string;
1444
+ svg: string;
1445
+ };
1446
+ type PluginI18nRegistration = Record<string, Record<string, string>>;
1447
+ type PluginSourceRegistration = {
1448
+ id: string;
1449
+ label: string;
1450
+ icon?: string;
1451
+ onSelect: () => Promise<void> | void;
1452
+ };
1453
+ type PluginRenderDispose = () => void;
1454
+ type PluginRender = (el: HTMLElement, activityParams: Record<string, unknown>) => PluginRenderDispose | undefined;
1455
+ type PluginActivityRegistration = {
1456
+ id: string;
1457
+ render: PluginRender;
1458
+ };
1459
+ type PluginFileActionRegistration = {
1460
+ id: string;
1461
+ icon: string;
1462
+ shouldRender: (fileEntry: OutputFileEntry) => boolean;
1463
+ onClick: (fileEntry: OutputFileEntry) => void | Promise<void>;
1464
+ };
1465
+ type PluginRegistryApi = {
1466
+ registerSource: (source: PluginSourceRegistration) => PluginSourceRegistration;
1467
+ registerActivity: (activity: PluginActivityRegistration) => PluginActivityRegistration;
1468
+ registerFileAction: (fileAction: PluginFileActionRegistration) => PluginFileActionRegistration;
1469
+ registerIcon: (icon: PluginIconRegistration) => PluginIconRegistration;
1470
+ registerI18n: (i18n: PluginI18nRegistration) => PluginI18nRegistration;
1471
+ registerConfig: <T = unknown>(definition: CustomConfigDefinition<T>) => void;
1472
+ };
1473
+ /**
1474
+ * API for managing plugin config subscriptions
1475
+ */
1476
+ type PluginConfigApi = {
1477
+ /**
1478
+ * Get the current value of a config option.
1479
+ *
1480
+ * @param configName - The name of the config to get
1481
+ * @returns The current config value
1482
+ *
1483
+ * @example
1484
+ * ```typescript
1485
+ * const theme = pluginApi.config.get('my-theme');
1486
+ * console.log('Current theme:', theme);
1487
+ * ```
1488
+ */
1489
+ get: <T = unknown>(configName: keyof (ConfigType & CustomConfig)) => T;
1490
+ /**
1491
+ * Subscribe to changes in a custom config value.
1492
+ * The callback will be called immediately with the current value,
1493
+ * and then whenever the value changes.
1494
+ *
1495
+ * Subscriptions are automatically cleaned up when the plugin is disposed.
1496
+ *
1497
+ * @param configName - The name of the custom config to subscribe to
1498
+ * @param callback - Function to call with the new value
1499
+ * @returns Unsubscribe function
1500
+ *
1501
+ * @example
1502
+ * ```typescript
1503
+ * pluginApi.config.subscribe('my-option', (value) => {
1504
+ * console.log('Config changed:', value);
1505
+ * });
1506
+ * // Cleanup happens automatically on plugin disposal
1507
+ * ```
1508
+ */
1509
+ subscribe: <T = unknown>(configName: keyof (ConfigType & CustomConfig), callback: (value: T) => void) => () => void;
1510
+ };
1511
+ /**
1512
+ * API for managing plugin activity interactions
1513
+ */
1514
+ type PluginActivityApi = {
1515
+ /**
1516
+ * Get the current activity parameters.
1517
+ *
1518
+ * @returns The current activity parameters object
1519
+ *
1520
+ * @example
1521
+ * ```typescript
1522
+ * const params = pluginApi.activity.getParams();
1523
+ * console.log('Current params:', params);
1524
+ * ```
1525
+ */
1526
+ getParams: () => Record<string, unknown>;
1527
+ /**
1528
+ * Subscribe to changes in activity parameters.
1529
+ * The callback will be called immediately with the current params,
1530
+ * and then whenever the params change.
1531
+ *
1532
+ * Subscriptions are automatically cleaned up when the plugin is disposed.
1533
+ *
1534
+ * @param callback - Function to call with the new params
1535
+ * @returns Unsubscribe function
1536
+ *
1537
+ * @example
1538
+ * ```typescript
1539
+ * pluginApi.activity.subscribeToParams((params) => {
1540
+ * console.log('Activity params changed:', params);
1541
+ * });
1542
+ * // Cleanup happens automatically on plugin disposal
1543
+ * ```
1544
+ */
1545
+ subscribeToParams: (callback: (params: Record<string, unknown>) => void) => () => void;
1546
+ };
1547
+ type PluginApi = {
1548
+ registry: PluginRegistryApi;
1549
+ config: PluginConfigApi;
1550
+ activity: PluginActivityApi;
1551
+ };
1552
+ type PluginUploaderApi = UploaderPublicApi;
1553
+ type PluginExports = {
1554
+ dispose?: () => void;
1555
+ };
1556
+ type PluginSetupResult = PluginExports | void | Promise<PluginExports | void>;
1557
+ type PluginSetupParams = {
1558
+ pluginApi: PluginApi;
1559
+ uploaderApi: PluginUploaderApi;
1560
+ };
1561
+ type UploaderPlugin = {
1562
+ id: string;
1563
+ version: PluginVersion;
1564
+ setup: (params: PluginSetupParams) => PluginSetupResult;
1565
+ };
1566
+ type Owned<T> = T & {
1567
+ pluginId: string;
1568
+ };
1569
+ type PluginRegistrySnapshot = {
1570
+ sources: Owned<PluginSourceRegistration>[];
1571
+ activities: Owned<PluginActivityRegistration>[];
1572
+ fileActions: Owned<PluginFileActionRegistration>[];
1573
+ icons: Owned<PluginIconRegistration>[];
1574
+ i18n: Owned<PluginI18nRegistration>[];
1575
+ };
1576
+
1577
+ declare class PluginManager extends SharedInstance {
1578
+ private _plugins;
1579
+ private _sources;
1580
+ private _activities;
1581
+ private _fileActions;
1582
+ private _icons;
1583
+ private _i18n;
1584
+ private _subscribers;
1585
+ private _pluginsUpdate;
1586
+ readonly configRegistry: CustomConfigRegistry;
1587
+ constructor(sharedInstancesBag: SharedInstancesBag);
1588
+ onPluginsChange(callback: () => void): () => void;
1589
+ private _syncPlugins;
1590
+ private _registerPlugin;
1591
+ private _unregisterPlugin;
1592
+ snapshot(): PluginRegistrySnapshot;
1593
+ destroy(): void;
1594
+ private _register;
1595
+ private _purgeRegistrations;
1596
+ private _notifySubscribers;
1597
+ }
1598
+
1599
+ type CommonEventType = InternalEventKey | EventKey;
1600
+ type TelemetryState = TelemetryRequest & {
1601
+ eventTimestamp: number;
1602
+ location: string;
1603
+ };
1604
+ type TelemetryEventBody = Partial<Pick<TelemetryState, 'payload' | 'config'>> & {
1605
+ modalId?: string;
1606
+ eventType?: CommonEventType;
1607
+ };
1608
+ declare class TelemetryManager extends SharedInstance {
1609
+ private readonly _sessionId;
1610
+ private readonly _telemetryInstance;
1611
+ private _config;
1612
+ private _initialized;
1613
+ private _lastPayload;
1614
+ private readonly _queue;
1615
+ private _isEnabled;
1616
+ constructor(sharedInstancesBag: SharedInstancesBag);
1617
+ private _init;
1618
+ private _setConfig;
1619
+ private _formattingPayload;
1620
+ private _excludedEvents;
1621
+ sendEvent(body: TelemetryEventBody): void;
1622
+ sendEventError(error: unknown, context?: string): void;
1623
+ /**
1624
+ * Method to send telemetry event for Cloud Image Editor.
1625
+ */
1626
+ sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
1627
+ /**
1628
+ * Deeply compares two objects and returns true if they are equal, false otherwise.
1629
+ */
1630
+ private _checkObj;
1631
+ private get _timestamp();
1632
+ private get _solution();
1633
+ private get _activity();
1634
+ private get _location();
1635
+ }
1636
+
1637
+ interface ISharedInstance {
1638
+ destroy?(): void;
1639
+ }
1640
+ declare class SharedInstance {
1641
+ protected _ctx: PubSub<SharedState>;
1642
+ protected _sharedInstancesBag: SharedInstancesBag;
1643
+ private _subscriptions;
1644
+ private _cfgProxy;
1645
+ protected _debugPrint: (...args: unknown[]) => void;
1646
+ constructor(sharedInstancesBag: SharedInstancesBag);
1647
+ protected addSub(unsub: () => void): void;
1648
+ protected get _cfg(): Readonly<ConfigType>;
1649
+ destroy(): void;
1650
+ }
1651
+ declare const instanceKeyMap: {
1652
+ modalManager: "*modalManager";
1653
+ pluginManager: "*pluginManager";
1654
+ telemetryManager: "*telemetryManager";
1655
+ localeManager: "*localeManager";
1656
+ a11y: "*a11y";
1657
+ blocksRegistry: "*blocksRegistry";
1658
+ eventEmitter: "*eventEmitter";
1659
+ uploadCollection: "*uploadCollection";
1660
+ secureUploadsManager: "*secureUploadsManager";
1661
+ api: "*publicApi";
1662
+ validationManager: "*validationManager";
1663
+ };
1664
+ type InstanceTypeMap = {
1665
+ [key in keyof typeof instanceKeyMap]: SharedState[(typeof instanceKeyMap)[key]];
1666
+ };
1667
+ type InstanceName = keyof typeof instanceKeyMap;
1668
+ type SharedInstancesState = Pick<SharedState, (typeof instanceKeyMap)[keyof typeof instanceKeyMap]>;
1669
+ type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
1670
+ declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
1671
+ readonly ctx: PubSub<SharedState>;
1672
+ readonly modalManager: ModalManager | null;
1673
+ readonly pluginManager: PluginManager;
1674
+ readonly telemetryManager: TelemetryManager;
1675
+ readonly localeManager: LocaleManager;
1676
+ readonly a11y: A11y;
1677
+ readonly blocksRegistry: Set<LitBlock>;
1678
+ readonly eventEmitter: EventEmitter;
1679
+ readonly uploadCollection: TypedCollection<UploadEntryData>;
1680
+ readonly secureUploadsManager: SecureUploadsManager;
1681
+ readonly api: UploaderPublicApi;
1682
+ readonly validationManager: ValidationManager;
1683
+ when<TName extends InstanceName>(name: TName, callback: (instance: NonNullable<InstanceTypeMap[TName]>) => void): () => void;
1684
+ };
1685
+
1299
1686
  declare class SecureUploadsManager extends SharedInstance {
1300
1687
  private _secureToken;
1301
1688
  getSecureToken(): Promise<SecureUploadsSignatureAndExpire | null>;
@@ -1410,12 +1797,11 @@ type ActivityParams$1 = {
1410
1797
  internalId: string;
1411
1798
  };
1412
1799
  declare class CloudImageEditorActivity extends LitUploaderBlock {
1413
- couldBeCtxOwner: boolean;
1414
- activityType: "cloud-image-edit";
1415
1800
  private _entry?;
1416
1801
  private _editorConfig;
1417
1802
  get activityParams(): ActivityParams$1;
1418
1803
  initCallback(): void;
1804
+ disconnectedCallback(): void;
1419
1805
  private _handleApply;
1420
1806
  private _handleCancel;
1421
1807
  handleChange(event: CustomEvent<ChangeResult>): void;
@@ -1494,13 +1880,17 @@ declare const ACTIVITY_TYPES: Readonly<{
1494
1880
  CLOUD_IMG_EDIT: "cloud-image-edit";
1495
1881
  EXTERNAL: "external";
1496
1882
  }>;
1497
- type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES];
1498
- type ActivityType = RegisteredActivityType | (string & {}) | null;
1883
+ type RegisteredActivityType = (typeof ACTIVITY_TYPES)[keyof typeof ACTIVITY_TYPES] | keyof CustomActivities;
1884
+ type ActivityType = RegisteredActivityType | null;
1499
1885
 
1500
1886
  declare const ACTIVE_PROP = "___ACTIVITY_IS_ACTIVE___";
1887
+ interface CustomActivities {
1888
+ }
1501
1889
  type ActivityParamsMap = {
1502
1890
  'cloud-image-edit': ActivityParams$1;
1503
1891
  external: ActivityParams;
1892
+ } & {
1893
+ [Key in keyof CustomActivities]: CustomActivities[Key]['params'];
1504
1894
  };
1505
1895
  declare class LitActivityBlock extends LitBlock {
1506
1896
  protected historyTracked: boolean;
@@ -1517,7 +1907,7 @@ declare class LitActivityBlock extends LitBlock {
1517
1907
  private _activate;
1518
1908
  initCallback(): void;
1519
1909
  private _historyFlush;
1520
- private _isActivityRegistered;
1910
+ protected _isActivityRegistered(): boolean;
1521
1911
  private static _activityCallbacks;
1522
1912
  static activities: Readonly<{
1523
1913
  START_FROM: 'start-from';
@@ -1538,8 +1928,8 @@ declare class LitActivityBlock extends LitBlock {
1538
1928
  private _unregisterActivity;
1539
1929
  disconnectedCallback(): void;
1540
1930
  get activityParams(): ActivityParamsMap[keyof ActivityParamsMap];
1541
- get initActivity(): string | null;
1542
- get doneActivity(): string | null;
1931
+ get initActivity(): RegisteredActivityType | null;
1932
+ get doneActivity(): RegisteredActivityType | null;
1543
1933
  historyBack(): void;
1544
1934
  }
1545
1935
 
@@ -1729,18 +2119,20 @@ declare global {
1729
2119
  }
1730
2120
  }
1731
2121
 
2122
+ type SourceButtonConfig = {
2123
+ id: string;
2124
+ label: string;
2125
+ icon?: string;
2126
+ onClick: () => void | Promise<void>;
2127
+ };
1732
2128
  declare class SourceBtn extends LitUploaderBlock {
1733
2129
  couldBeCtxOwner: boolean;
1734
- private _registeredTypes;
1735
- type?: string;
2130
+ source?: SourceButtonConfig;
1736
2131
  private _iconName;
1737
2132
  private _srcTypeKey;
1738
- private _initTypes;
1739
- initCallback(): void;
1740
- private _registerType;
1741
- activate(): void;
1742
- private _applyType;
1743
2133
  protected willUpdate(changedProperties: PropertyValues<this>): void;
2134
+ private _applySource;
2135
+ activate(): void;
1744
2136
  render(): lit_html.TemplateResult<1>;
1745
2137
  }
1746
2138
  declare global {
@@ -1749,9 +2141,11 @@ declare global {
1749
2141
  }
1750
2142
  }
1751
2143
 
1752
- declare class SourceList extends LitBlock {
2144
+ declare class SourceList extends LitUploaderBlock {
1753
2145
  private _rawSourceList;
1754
2146
  private _cameraModes;
2147
+ private _unsubscribePlugins?;
2148
+ private _sources;
1755
2149
  /**
1756
2150
  * CSS-only attribute
1757
2151
  */
@@ -1759,8 +2153,12 @@ declare class SourceList extends LitBlock {
1759
2153
  initCallback(): void;
1760
2154
  protected updated(changedProperties: PropertyValues<this>): void;
1761
2155
  private _updateSources;
1762
- private _sources;
2156
+ private _expandSource;
2157
+ private _makeBuiltInSourceConfig;
2158
+ private _makePluginSourceConfig;
2159
+ private _openActivity;
1763
2160
  render(): lit_html.TemplateResult<1>;
2161
+ disconnectedCallback(): void;
1764
2162
  }
1765
2163
  declare global {
1766
2164
  interface HTMLElementTagNameMap {
@@ -1823,13 +2221,11 @@ declare global {
1823
2221
  }
1824
2222
 
1825
2223
  declare class UrlSource extends LitUploaderBlock {
1826
- couldBeCtxOwner: boolean;
1827
- activityType: ActivityType;
1828
2224
  private _formState;
1829
- initCallback(): void;
1830
2225
  private _inputRef;
1831
2226
  private _handleInput;
1832
2227
  private _handleUpload;
2228
+ firstUpdated(): void;
1833
2229
  render(): lit_html.TemplateResult<1>;
1834
2230
  }
1835
2231
  declare global {
@@ -1853,6 +2249,35 @@ declare global {
1853
2249
  }
1854
2250
  }
1855
2251
 
2252
+ declare class PluginActivityHost extends LitActivityBlock {
2253
+ registration: Owned<PluginActivityRegistration>;
2254
+ activityType: ActivityType;
2255
+ private _dispose?;
2256
+ private _containerRef;
2257
+ initCallback(): void;
2258
+ protected willUpdate(changedProperties: PropertyValues<this>): void;
2259
+ private _ensureRegistered;
2260
+ private _renderActivity;
2261
+ private _disposeActivity;
2262
+ disconnectedCallback(): void;
2263
+ render(): lit_html.TemplateResult<1>;
2264
+ }
2265
+ declare class PluginActivityRenderer extends LitBlock {
2266
+ mode: 'modal' | 'inline';
2267
+ private _activities;
2268
+ private _unsubscribePlugins?;
2269
+ initCallback(): void;
2270
+ private _syncActivities;
2271
+ disconnectedCallback(): void;
2272
+ render(): lit_html.TemplateResult<1>;
2273
+ }
2274
+ declare global {
2275
+ interface HTMLElementTagNameMap {
2276
+ 'uc-plugin-activity-host': PluginActivityHost;
2277
+ 'uc-plugin-activity-renderer': PluginActivityRenderer;
2278
+ }
2279
+ }
2280
+
1856
2281
  declare class FileUploaderRegular extends LitSolutionBlock {
1857
2282
  attributesMeta: {
1858
2283
  headless?: boolean;
@@ -1913,57 +2338,6 @@ declare global {
1913
2338
  }
1914
2339
  }
1915
2340
 
1916
- declare class A11y implements ISharedInstance {
1917
- private _destroyKeyUX;
1918
- private readonly _scopedWindow;
1919
- constructor();
1920
- registerBlock(scope: LitBlock): void;
1921
- destroy(): void;
1922
- }
1923
-
1924
- declare class LocaleManager extends SharedInstance {
1925
- private _localeName;
1926
- constructor(sharedInstancesBag: SharedInstancesBag);
1927
- }
1928
-
1929
- type CommonEventType = InternalEventKey | EventKey;
1930
- type TelemetryState = TelemetryRequest & {
1931
- eventTimestamp: number;
1932
- location: string;
1933
- };
1934
- type TelemetryEventBody = Partial<Pick<TelemetryState, 'payload' | 'config'>> & {
1935
- modalId?: string;
1936
- eventType?: CommonEventType;
1937
- };
1938
- declare class TelemetryManager extends SharedInstance {
1939
- private readonly _sessionId;
1940
- private readonly _telemetryInstance;
1941
- private _config;
1942
- private _initialized;
1943
- private _lastPayload;
1944
- private readonly _queue;
1945
- private _isEnabled;
1946
- constructor(sharedInstancesBag: SharedInstancesBag);
1947
- private _init;
1948
- private _setConfig;
1949
- private _formattingPayload;
1950
- private _excludedEvents;
1951
- sendEvent(body: TelemetryEventBody): void;
1952
- sendEventError(error: unknown, context?: string): void;
1953
- /**
1954
- * Method to send telemetry event for Cloud Image Editor.
1955
- */
1956
- sendEventCloudImageEditor(e: MouseEvent, tabId: string, options?: Record<string, unknown>): void;
1957
- /**
1958
- * Deeply compares two objects and returns true if they are equal, false otherwise.
1959
- */
1960
- private _checkObj;
1961
- private get _timestamp();
1962
- private get _solution();
1963
- private get _activity();
1964
- private get _location();
1965
- }
1966
-
1967
2341
  declare const TabId: Readonly<{
1968
2342
  readonly CROP: "crop";
1969
2343
  readonly TUNING: "tuning";
@@ -2030,9 +2404,9 @@ type SharedConfigState = {
2030
2404
  };
2031
2405
  type BlocksRegistry = Set<LitBlock>;
2032
2406
  type ActivityBlockCtxState = {
2033
- '*currentActivity': string | null;
2407
+ '*currentActivity': RegisteredActivityType | null;
2034
2408
  '*currentActivityParams': Record<string, unknown>;
2035
- '*history': (string | null)[];
2409
+ '*history': (RegisteredActivityType | null)[];
2036
2410
  '*historyBack': (() => void) | null;
2037
2411
  '*closeModal': () => void;
2038
2412
  };
@@ -2099,13 +2473,16 @@ type EditorToolbarState = {
2099
2473
  '*currentOperation': string | null;
2100
2474
  '*operationTooltip': string | null;
2101
2475
  };
2476
+ type SharedContextInstances = Map<string, ISharedInstance>;
2102
2477
  type DynamicBlockState = {
2478
+ '*sharedContextInstances': SharedContextInstances;
2103
2479
  '*blocksRegistry': BlocksRegistry;
2104
2480
  '*eventEmitter': EventEmitter;
2105
2481
  '*localeManager': LocaleManager;
2106
2482
  '*telemetryManager': TelemetryManager;
2107
2483
  '*a11y': A11y;
2108
2484
  '*modalManager': ModalManager | null;
2485
+ '*pluginManager': PluginManager;
2109
2486
  };
2110
2487
  type DynamicUploaderBlockState = {
2111
2488
  '*uploadCollection': TypedCollection<UploadEntryData>;
@@ -2118,65 +2495,6 @@ type LocaleState = {
2118
2495
  };
2119
2496
  type SharedState = SolutionBlockCtxState & SharedConfigState & CloudImageEditorState & EditorImageCropperState & EditorToolbarState & DynamicBlockState & DynamicUploaderBlockState & LocaleState;
2120
2497
 
2121
- interface ISharedInstance {
2122
- destroy?(): void;
2123
- }
2124
- declare class SharedInstance {
2125
- protected _ctx: PubSub<SharedState>;
2126
- protected _sharedInstancesBag: SharedInstancesBag;
2127
- private _subscriptions;
2128
- private _cfgProxy;
2129
- protected _debugPrint: (...args: unknown[]) => void;
2130
- constructor(sharedInstancesBag: SharedInstancesBag);
2131
- protected addSub(unsub: () => void): void;
2132
- protected get _cfg(): Readonly<ConfigType>;
2133
- destroy(): void;
2134
- }
2135
- type SharedInstancesState = Pick<SharedState, '*blocksRegistry' | '*eventEmitter' | '*localeManager' | '*telemetryManager' | '*a11y' | '*modalManager' | '*uploadCollection' | '*publicApi' | '*validationManager' | '*secureUploadsManager'>;
2136
- type SharedInstancesBag = ReturnType<typeof createSharedInstancesBag>;
2137
- declare const createSharedInstancesBag: (getCtx: () => PubSub<SharedState>) => {
2138
- readonly ctx: PubSub<SharedState>;
2139
- readonly modalManager: ModalManager | null;
2140
- readonly telemetryManager: TelemetryManager;
2141
- readonly localeManager: LocaleManager;
2142
- readonly a11y: A11y;
2143
- readonly blocksRegistry: Set<LitBlock>;
2144
- readonly eventEmitter: EventEmitter;
2145
- readonly uploadCollection: TypedCollection<UploadEntryData>;
2146
- readonly secureUploadsManager: SecureUploadsManager;
2147
- readonly api: UploaderPublicApi;
2148
- readonly validationManager: ValidationManager;
2149
- };
2150
-
2151
- type FuncFileValidator = (outputEntry: OutputFileEntry, api: UploaderPublicApi, options?: {
2152
- signal?: AbortSignal;
2153
- }) => undefined | OutputErrorFile | Promise<undefined | OutputErrorFile>;
2154
- type FileValidatorDescriptor = {
2155
- runOn: 'add' | 'upload' | 'change';
2156
- validator: FuncFileValidator;
2157
- };
2158
- type FileValidator = FileValidatorDescriptor | FuncFileValidator;
2159
- type FuncCollectionValidator = (collection: ReturnType<typeof buildOutputCollectionState<OutputCollectionStatus>>, api: UploaderPublicApi) => undefined | OutputErrorCollection;
2160
- declare class ValidationManager extends SharedInstance {
2161
- private get _uploadCollection();
2162
- private _commonFileValidators;
2163
- private _commonCollectionValidators;
2164
- private _queue;
2165
- private _runQueueDebounced;
2166
- private _isDestroyed;
2167
- private _entryValidationState;
2168
- constructor(sharedInstancesBag: SharedInstancesBag);
2169
- runFileValidators(runOn: FileValidatorDescriptor['runOn'], entryIds?: Uid[]): void;
2170
- runCollectionValidators(): void;
2171
- cleanupValidationForEntry(entry: TypedData<UploadEntryData>): void;
2172
- private _runFileValidatorsForEntry;
2173
- private _addCustomTypeToValidationError;
2174
- private _getEntryValidationState;
2175
- private _getValidatorDescriptors;
2176
- private _getValidatorDescriptorsForEntry;
2177
- destroy(): void;
2178
- }
2179
-
2180
2498
  declare const LitBlockBase: typeof LitElement & Constructor<{
2181
2499
  willYield: boolean;
2182
2500
  yield(slot: string, defaultContent?: unknown): unknown;
@@ -2187,7 +2505,6 @@ declare const LitBlockBase: typeof LitElement & Constructor<{
2187
2505
  };
2188
2506
  declare class LitBlock extends LitBlockBase {
2189
2507
  private _cfgProxy;
2190
- protected _sharedContextInstances: Map<keyof SharedInstancesState, ISharedInstance>;
2191
2508
  static styleAttrs: string[];
2192
2509
  activityType: ActivityType;
2193
2510
  init$: {};
@@ -2197,6 +2514,7 @@ declare class LitBlock extends LitBlockBase {
2197
2514
  protected _sharedInstancesBag: {
2198
2515
  readonly ctx: PubSub<SharedState>;
2199
2516
  readonly modalManager: ModalManager | null;
2517
+ readonly pluginManager: PluginManager;
2200
2518
  readonly telemetryManager: TelemetryManager;
2201
2519
  readonly localeManager: LocaleManager;
2202
2520
  readonly a11y: A11y;
@@ -2206,6 +2524,19 @@ declare class LitBlock extends LitBlockBase {
2206
2524
  readonly secureUploadsManager: SecureUploadsManager;
2207
2525
  readonly api: UploaderPublicApi;
2208
2526
  readonly validationManager: ValidationManager;
2527
+ when<TName extends "modalManager" | "pluginManager" | "telemetryManager" | "localeManager" | "a11y" | "blocksRegistry" | "eventEmitter" | "uploadCollection" | "secureUploadsManager" | "api" | "validationManager">(name: TName, callback: (instance: NonNullable<{
2528
+ modalManager: ModalManager | null;
2529
+ pluginManager: PluginManager;
2530
+ telemetryManager: TelemetryManager;
2531
+ localeManager: LocaleManager;
2532
+ a11y: A11y;
2533
+ blocksRegistry: BlocksRegistry;
2534
+ eventEmitter: EventEmitter;
2535
+ uploadCollection: TypedCollection<UploadEntryData>;
2536
+ secureUploadsManager: SecureUploadsManager;
2537
+ api: UploaderPublicApi;
2538
+ validationManager: ValidationManager;
2539
+ }[TName]>) => void): () => void;
2209
2540
  };
2210
2541
  emit(type: Parameters<EventEmitter['emit']>[0], payload?: Parameters<EventEmitter['emit']>[1], options?: Parameters<EventEmitter['emit']>[2]): void;
2211
2542
  hasBlockInCtx(callback: (block: LitBlock) => boolean): boolean;
@@ -2223,11 +2554,7 @@ declare class LitBlock extends LitBlockBase {
2223
2554
  * Called when the last block is removed from the context. Note that inheritors must run their callback before that.
2224
2555
  */
2225
2556
  private destroyCtxCallback;
2226
- /**
2227
- * Adds a shared context instance if it does not exist yet.
2228
- * @param key The shared state key.
2229
- * @param resolver The resolver function that creates the instance.
2230
- */
2557
+ private _getSharedContextInstances;
2231
2558
  protected _addSharedContextInstance<TKey extends keyof SharedInstancesState>(key: TKey, resolver: (sharedInstancesBag: SharedInstancesBag) => NonNullable<SharedInstancesState[TKey]>): void;
2232
2559
  private _destroySharedContextInstances;
2233
2560
  protected _getSharedContextInstance<TKey extends keyof SharedState, TRequired extends boolean = true>(key: TKey, isRequired?: TRequired): TRequired extends true ? NonNullable<SharedState[TKey]> : SharedState[TKey];