@webflow/designer-extension-typings 2.0.3 → 2.0.5

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/api.d.ts CHANGED
@@ -68,6 +68,18 @@ interface WebflowApi {
68
68
  * ```
69
69
  */
70
70
  getMediaQuery(): Promise<BreakpointId>;
71
+
72
+ /**
73
+ * Get the current pseudo mode.
74
+ * @returns A Promise that resolves to a PseudoStateKey which is a string representing the current pseudo mode.
75
+ * @example
76
+ * ```ts
77
+ * const pseudoMode = await webflow.getPseudoMode();
78
+ * console.log('Current Pseudo Mode:', pseudoMode);
79
+ * ```
80
+ */
81
+ getPseudoMode(): Promise<null | PseudoStateKey>;
82
+
71
83
  /**
72
84
  * Create a component by promoting a Root Element.
73
85
  * @param name - The name of the component.
@@ -312,10 +324,11 @@ interface WebflowApi {
312
324
  * webflow.notify({ type: 'Info', message: 'Great work!' }); // General notification
313
325
  * webflow.notify({ type: 'Error', message: 'Something went wrong, try again!' }); // Error notification
314
326
  * webflow.notify({ type: 'Success', message: 'Successfully did something!' }); // Success notification
327
+ * webflow.notify({ type: 'Warning', message: 'Something is not right, please check again!' }); // Warning notification
315
328
  * ```
316
329
  */
317
330
  notify(opts: {
318
- type: 'Error' | 'Info' | 'Success';
331
+ type: 'Error' | 'Info' | 'Success' | 'Warning';
319
332
  message: string;
320
333
  }): Promise<void>;
321
334
  /**
@@ -411,6 +424,11 @@ interface WebflowApi {
411
424
 
412
425
  subscribe(event: 'currentappmode', callback: () => void): Unsubscribe;
413
426
 
427
+ subscribe(
428
+ event: 'pseudomode',
429
+ callback: (pseudoMode: null | PseudoStateKey) => void
430
+ ): Unsubscribe;
431
+
414
432
  getIdToken(): Promise<string>;
415
433
  getAppSubscriptions(): Promise<Array<AppSubscription>>;
416
434
  elementPresets: ElementPresets;
@@ -493,6 +511,14 @@ interface WebflowApi {
493
511
  */
494
512
  appModes: {[key in AppMode]: AppMode};
495
513
 
514
+ /**
515
+ * Closes the extension
516
+ * ```ts
517
+ * await webflow.closeExtension();
518
+ * ```
519
+ */
520
+ closeExtension(): Promise<null>;
521
+
496
522
  /**
497
523
  * Gets the current App connection
498
524
  * ```ts
@@ -508,6 +534,14 @@ interface WebflowApi {
508
534
  * ```
509
535
  */
510
536
  getCurrentAppConnectionResource(): Promise<null | AppConnectionResource>;
537
+
538
+ /**
539
+ * Gets the current App launch context (i.e how the app was launched)
540
+ * ```ts
541
+ * const launchContext = await webflow.getLaunchContext();
542
+ * ```
543
+ */
544
+ getLaunchContext(): Promise<null | LaunchContext>;
511
545
  }
512
546
 
513
547
  type Unsubscribe = () => void;
@@ -2,3 +2,8 @@ type AppConnectionResource = {
2
2
  type: 'Element';
3
3
  value: AnyElement;
4
4
  };
5
+
6
+ type LaunchContext = {
7
+ type: 'AppConnection' | 'AppIntent' | 'DeepLink';
8
+ value: null | string | {[key in 'form' | 'image']?: 'create' | 'manage'};
9
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webflow/designer-extension-typings",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "Typings for the Webflow Designer Extension API",
6
6
  "main": "",
@@ -562,3 +562,21 @@ type StyleProperty =
562
562
  | '-webkit-text-fill-color'
563
563
  | '-webkit-text-stroke-color'
564
564
  | '-webkit-text-stroke-width';
565
+
566
+ type PseudoStateKey =
567
+ | 'noPseudo'
568
+ | 'nth-child(odd)'
569
+ | 'nth-child(even)'
570
+ | 'first-child'
571
+ | 'last-child'
572
+ | 'hover'
573
+ | 'active'
574
+ | 'pressed'
575
+ | 'visited'
576
+ | 'focus'
577
+ | 'focus-visible'
578
+ | 'focus-within'
579
+ | 'placeholder'
580
+ | 'empty'
581
+ | 'before'
582
+ | 'after';
package/styles.d.ts CHANGED
@@ -100,21 +100,3 @@ type BreakpointId =
100
100
  | 'medium'
101
101
  | 'small'
102
102
  | 'tiny';
103
-
104
- type PseudoStateKey =
105
- | 'noPseudo'
106
- | 'nth-child(odd)'
107
- | 'nth-child(even)'
108
- | 'first-child'
109
- | 'last-child'
110
- | 'hover'
111
- | 'active'
112
- | 'pressed'
113
- | 'visited'
114
- | 'focus'
115
- | 'focus-visible'
116
- | 'focus-within'
117
- | 'placeholder'
118
- | 'empty'
119
- | 'before'
120
- | 'after';