@shopify/app-bridge-types 0.3.0 → 0.4.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 +6 -0
- package/README.md +23 -0
- package/dist/index.d.ts +8 -0
- package/dist/shopify.ts +59 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#760](https://github.com/Shopify/extensibility/pull/760) [`4f7742e4aacb581a380c76742689dca617c86b6d`](https://github.com/Shopify/extensibility/commit/4f7742e4aacb581a380c76742689dca617c86b6d) Thanks [@Fionoble](https://github.com/Fionoble)! - Add new s-app-\* types
|
|
8
|
+
|
|
3
9
|
## 0.3.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -13,3 +13,26 @@ You can install Shopify App Bridge Types by using [Yarn](https://yarnpkg.com):
|
|
|
13
13
|
```sh
|
|
14
14
|
yarn add --dev @shopify/app-bridge-types
|
|
15
15
|
```
|
|
16
|
+
|
|
17
|
+
## Development
|
|
18
|
+
|
|
19
|
+
### How Types are Generated
|
|
20
|
+
|
|
21
|
+
The types in this package are automatically generated from the `sandboxes/app-bridge-next` source code:
|
|
22
|
+
|
|
23
|
+
1. Types are defined in `sandboxes/app-bridge-next/src/features/`
|
|
24
|
+
2. During build, they're compiled to `sandboxes/app-bridge-next/dist/app-bridge.d.ts`
|
|
25
|
+
3. The build script (`scripts/build.mjs`) processes and copies these types to the `dist` folder
|
|
26
|
+
4. The processed types are then published to npm
|
|
27
|
+
|
|
28
|
+
### Releasing a New Version
|
|
29
|
+
|
|
30
|
+
To release a new version of the types package:
|
|
31
|
+
|
|
32
|
+
1. Make your changes to the type definitions in `sandboxes/app-bridge-next/src/features/`
|
|
33
|
+
2. Run `pnpm changeset` from the root of the repository
|
|
34
|
+
3. Select `@shopify/app-bridge-types` to bump its version
|
|
35
|
+
4. Commit your changes
|
|
36
|
+
5. CI will automatically handle building and publishing the updated package
|
|
37
|
+
|
|
38
|
+
The automation ensures that the types stay in sync with the app-bridge-next implementation.
|
package/dist/index.d.ts
CHANGED
|
@@ -4,11 +4,15 @@ import type {
|
|
|
4
4
|
AppBridgeElements,
|
|
5
5
|
AppBridgeAttributes,
|
|
6
6
|
UIModalElement as BaseUIModalElement,
|
|
7
|
+
SAppWindowElement as BaseSAppWindowElement,
|
|
7
8
|
UINavMenuElement as BaseUINavMenuElement,
|
|
9
|
+
SAppNavElement as BaseSAppNavElement,
|
|
8
10
|
UITitleBarElement as BaseUITitleBarElement,
|
|
9
11
|
UISaveBarElement as BaseUISaveBarElement,
|
|
10
12
|
UIModalAttributes,
|
|
13
|
+
SAppWindowAttributes,
|
|
11
14
|
UINavMenuAttributes,
|
|
15
|
+
SAppNavAttributes,
|
|
12
16
|
UITitleBarAttributes,
|
|
13
17
|
UISaveBarAttributes,
|
|
14
18
|
ToastOptions,
|
|
@@ -20,7 +24,9 @@ import type {
|
|
|
20
24
|
export {
|
|
21
25
|
ShopifyGlobal,
|
|
22
26
|
UIModalAttributes,
|
|
27
|
+
SAppWindowAttributes,
|
|
23
28
|
UINavMenuAttributes,
|
|
29
|
+
SAppNavAttributes,
|
|
24
30
|
UITitleBarAttributes,
|
|
25
31
|
UISaveBarAttributes,
|
|
26
32
|
ToastOptions,
|
|
@@ -37,7 +43,9 @@ declare global {
|
|
|
37
43
|
interface HTMLAnchorElement extends AugmentedElement<'a'> {}
|
|
38
44
|
|
|
39
45
|
interface UIModalElement extends BaseUIModalElement {}
|
|
46
|
+
interface SAppWindowElement extends BaseSAppWindowElement {}
|
|
40
47
|
interface UINavMenuElement extends BaseUINavMenuElement {}
|
|
48
|
+
interface SAppNavElement extends BaseSAppNavElement {}
|
|
41
49
|
interface UITitleBarElement extends BaseUITitleBarElement {}
|
|
42
50
|
interface UISaveBarElement extends BaseUISaveBarElement {}
|
|
43
51
|
|
package/dist/shopify.ts
CHANGED
|
@@ -136,6 +136,7 @@ interface AppBridgeConfig {
|
|
|
136
136
|
|
|
137
137
|
export interface AppBridgeElements {
|
|
138
138
|
'ui-modal': UIModalAttributes;
|
|
139
|
+
's-app-window': SAppWindowAttributes;
|
|
139
140
|
'ui-nav-menu': UINavMenuAttributes;
|
|
140
141
|
's-app-nav': SAppNavAttributes;
|
|
141
142
|
'ui-save-bar': UISaveBarAttributes;
|
|
@@ -948,8 +949,61 @@ export interface SAppNavAttributes {
|
|
|
948
949
|
children?: any;
|
|
949
950
|
}
|
|
950
951
|
|
|
951
|
-
|
|
952
|
+
interface SAppNavElement_2 extends HTMLElement {
|
|
952
953
|
}
|
|
954
|
+
export type { SAppNavElement_2 as SAppNavElement }
|
|
955
|
+
|
|
956
|
+
export interface SAppWindowAttributes {
|
|
957
|
+
/**
|
|
958
|
+
* A unique identifier for the S-App-Window
|
|
959
|
+
*/
|
|
960
|
+
id?: string;
|
|
961
|
+
/**
|
|
962
|
+
* The URL of the content to display within the S-App-Window.
|
|
963
|
+
* S-App-Window only supports src-based content (required).
|
|
964
|
+
*/
|
|
965
|
+
src: string;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
interface _SAppWindowElement {
|
|
969
|
+
/**
|
|
970
|
+
* Always returns undefined for s-app-window (src-only)
|
|
971
|
+
*/
|
|
972
|
+
readonly content: undefined;
|
|
973
|
+
/**
|
|
974
|
+
* A getter/setter for the s-app-window src URL
|
|
975
|
+
*/
|
|
976
|
+
src?: string;
|
|
977
|
+
/**
|
|
978
|
+
* A getter for the Window object of the s-app-window iframe.
|
|
979
|
+
* Only accessible when the s-app-window is open.
|
|
980
|
+
*/
|
|
981
|
+
readonly contentWindow?: Window | null;
|
|
982
|
+
/**
|
|
983
|
+
* Shows the s-app-window element
|
|
984
|
+
*/
|
|
985
|
+
show?(): Promise<void>;
|
|
986
|
+
/**
|
|
987
|
+
* Hides the s-app-window element
|
|
988
|
+
*/
|
|
989
|
+
hide?(): Promise<void>;
|
|
990
|
+
/**
|
|
991
|
+
* Toggles the s-app-window element between showing and hidden states
|
|
992
|
+
*/
|
|
993
|
+
toggle?(): Promise<void>;
|
|
994
|
+
/**
|
|
995
|
+
* Add 'show' | 'hide' event listeners.
|
|
996
|
+
*/
|
|
997
|
+
addEventListener?(type: 'show' | 'hide', listener: EventListenerOrEventListenerObject): void;
|
|
998
|
+
/**
|
|
999
|
+
* Remove 'show' | 'hide' event listeners.
|
|
1000
|
+
*/
|
|
1001
|
+
removeEventListener?(type: 'show' | 'hide', listener: EventListenerOrEventListenerObject): void;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
interface SAppWindowElement_2 extends Omit<HTMLElement, 'addEventListener' | 'removeEventListener'>, Required<Omit<_SAppWindowElement, 'src' | 'contentWindow'>>, Pick<_SAppWindowElement, 'src' | 'contentWindow'> {
|
|
1005
|
+
}
|
|
1006
|
+
export type { SAppWindowElement_2 as SAppWindowElement }
|
|
953
1007
|
|
|
954
1008
|
interface SaveBarApi extends Required<_SaveBarApi> {
|
|
955
1009
|
}
|
|
@@ -1154,7 +1208,7 @@ interface _UIModalElement {
|
|
|
1154
1208
|
/**
|
|
1155
1209
|
* A getter/setter that is used to set modal variant.
|
|
1156
1210
|
*/
|
|
1157
|
-
variant?:
|
|
1211
|
+
variant?: 'small' | 'base' | 'large' | 'max';
|
|
1158
1212
|
/**
|
|
1159
1213
|
* A getter/setter that is used to get the DOM content of the modal
|
|
1160
1214
|
* element and update the content after the modal has been opened.
|
|
@@ -1172,15 +1226,15 @@ interface _UIModalElement {
|
|
|
1172
1226
|
*/
|
|
1173
1227
|
readonly contentWindow?: Window | null;
|
|
1174
1228
|
/**
|
|
1175
|
-
* Shows the
|
|
1229
|
+
* Shows the modal element
|
|
1176
1230
|
*/
|
|
1177
1231
|
show?(): Promise<void>;
|
|
1178
1232
|
/**
|
|
1179
|
-
* Hides the
|
|
1233
|
+
* Hides the modal element
|
|
1180
1234
|
*/
|
|
1181
1235
|
hide?(): Promise<void>;
|
|
1182
1236
|
/**
|
|
1183
|
-
* Toggles the
|
|
1237
|
+
* Toggles the modal element between the showing and hidden states
|
|
1184
1238
|
*/
|
|
1185
1239
|
toggle?(): Promise<void>;
|
|
1186
1240
|
/**
|
|
@@ -1341,8 +1395,6 @@ type UserApi = () => Promise<User>;
|
|
|
1341
1395
|
*/
|
|
1342
1396
|
type UserResult = 'granted-all' | 'declined-all';
|
|
1343
1397
|
|
|
1344
|
-
type Variant = 'small' | 'base' | 'large' | 'max';
|
|
1345
|
-
|
|
1346
1398
|
interface WebVitalsApi {
|
|
1347
1399
|
onReport?: (callback: WebVitalsCallback | null) => Promise<void>;
|
|
1348
1400
|
}
|