afnm-types 0.6.55-injecttest → 0.6.55-injecttest2
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/dist/mod.d.ts +11 -9
- package/package.json +1 -1
package/dist/mod.d.ts
CHANGED
|
@@ -2462,20 +2462,22 @@ export interface ModAPI {
|
|
|
2462
2462
|
/**
|
|
2463
2463
|
* Inject UI into a named slot (dialog title or screen name).
|
|
2464
2464
|
*
|
|
2465
|
-
* The generator receives (api,
|
|
2465
|
+
* The generator receives (api, inject):
|
|
2466
2466
|
* - api: full ModReduxAPI with game state, actions, and components
|
|
2467
|
-
* -
|
|
2468
|
-
*
|
|
2469
|
-
*
|
|
2470
|
-
*
|
|
2467
|
+
* - inject(selector, content, placement?): places content relative to the matched element.
|
|
2468
|
+
* selector can be:
|
|
2469
|
+
* '' the slot root itself
|
|
2470
|
+
* '#my-id' find by id
|
|
2471
|
+
* '.a .b > .c' find by path (searched within the slot root)
|
|
2472
|
+
* someElement a direct HTMLElement reference
|
|
2473
|
+
* placement controls where content appears (see InjectPlacement). Defaults to 'after'.
|
|
2471
2474
|
*
|
|
2472
2475
|
* Slot names for dialogs are the id (e.g. 'combat-victory'). You can find these by inspecting the DOM in dev mode.
|
|
2473
2476
|
* Slot names for screens match the ScreenType value (e.g. 'combat').
|
|
2474
2477
|
*
|
|
2475
2478
|
* @example
|
|
2476
|
-
*
|
|
2477
|
-
*
|
|
2478
|
-
* return inject('[aria-live="assertive"]',
|
|
2479
|
+
* modAPI.ui.injectUI('combat-victory', (api, inject) => {
|
|
2480
|
+
* inject('[aria-live="assertive"]',
|
|
2479
2481
|
* <api.components.GameButton onClick={() => api.actions.changeQi(100)}>
|
|
2480
2482
|
* Absorb Qi
|
|
2481
2483
|
* </api.components.GameButton>,
|
|
@@ -2483,7 +2485,7 @@ export interface ModAPI {
|
|
|
2483
2485
|
* );
|
|
2484
2486
|
* });
|
|
2485
2487
|
*/
|
|
2486
|
-
injectUI: (slotName: string, generator: (api: ModReduxAPI,
|
|
2488
|
+
injectUI: (slotName: string, generator: (api: ModReduxAPI, inject: (selector: string | HTMLElement, content: React.ReactNode, placement?: InjectPlacement) => void) => void) => void;
|
|
2487
2489
|
/**
|
|
2488
2490
|
* Subscribe to any Redux state changes. The callback receives the new state.
|
|
2489
2491
|
* Returns an unsubscribe function.
|