@gorilla-engine-sdk/ge-dialogs-lib 0.5.7

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 (47) hide show
  1. package/LICENSE.md +64 -0
  2. package/README.md +376 -0
  3. package/dist/Dialogs.d.ts +8 -0
  4. package/dist/Dialogs.js +51 -0
  5. package/dist/DialogsStyleState.d.ts +127 -0
  6. package/dist/DialogsStyleState.js +97 -0
  7. package/dist/ErrorBoundary.d.ts +13 -0
  8. package/dist/ErrorBoundary.js +58 -0
  9. package/dist/dialogsDefaultStyle.d.ts +2 -0
  10. package/dist/dialogsDefaultStyle.js +87 -0
  11. package/dist/index.d.ts +13 -0
  12. package/dist/index.js +32 -0
  13. package/dist/modals/MessageModal.d.ts +7 -0
  14. package/dist/modals/MessageModal.js +55 -0
  15. package/dist/modals/ModalContext.d.ts +18 -0
  16. package/dist/modals/ModalContext.js +52 -0
  17. package/dist/modals/ModalProvider.d.ts +25 -0
  18. package/dist/modals/ModalProvider.js +75 -0
  19. package/dist/modals/ModalRoot.d.ts +30 -0
  20. package/dist/modals/ModalRoot.js +64 -0
  21. package/dist/modals/components/FooterButtons.d.ts +15 -0
  22. package/dist/modals/components/FooterButtons.js +59 -0
  23. package/dist/modals/components/Modal.d.ts +27 -0
  24. package/dist/modals/components/Modal.js +124 -0
  25. package/dist/modals/useModal.d.ts +12 -0
  26. package/dist/modals/useModal.js +55 -0
  27. package/dist/notifications/DefaultNotification.d.ts +10 -0
  28. package/dist/notifications/DefaultNotification.js +87 -0
  29. package/dist/notifications/NotificationContext.d.ts +18 -0
  30. package/dist/notifications/NotificationContext.js +52 -0
  31. package/dist/notifications/NotificationProvider.d.ts +17 -0
  32. package/dist/notifications/NotificationProvider.js +73 -0
  33. package/dist/notifications/NotificationRoot.d.ts +30 -0
  34. package/dist/notifications/NotificationRoot.js +71 -0
  35. package/dist/notifications/useNotification.d.ts +19 -0
  36. package/dist/notifications/useNotification.js +98 -0
  37. package/dist/tooltips/DefaultToolTip.d.ts +9 -0
  38. package/dist/tooltips/DefaultToolTip.js +119 -0
  39. package/dist/tooltips/ToolTipContext.d.ts +18 -0
  40. package/dist/tooltips/ToolTipContext.js +52 -0
  41. package/dist/tooltips/ToolTipProvider.d.ts +25 -0
  42. package/dist/tooltips/ToolTipProvider.js +92 -0
  43. package/dist/tooltips/ToolTipRoot.d.ts +30 -0
  44. package/dist/tooltips/ToolTipRoot.js +61 -0
  45. package/dist/tooltips/useToolTip.d.ts +14 -0
  46. package/dist/tooltips/useToolTip.js +102 -0
  47. package/package.json +44 -0
package/LICENSE.md ADDED
@@ -0,0 +1,64 @@
1
+ **IMPORTANT NOTICE: PLEASE READ CAREFULLY BEFORE DOWNLOADING, INSTALLING OR USING THE GORILLA ENGINE SDK:**
2
+
3
+ - BY SIGNING THIS AGREEMENT, OR CLICKING ON THE “ACCEPT” BUTTON BELOW (IF AVAILABLE), OR BY DOWNLOADING, INSTALLING, OR USING THE GORILLA ENGINE SDK, YOU AGREE TO THE TERMS OF THIS AGREEMENT, AND ALL INCORPORATED TERMS INCLUDING GORILLA ENGINE’S PRIVACY POLICY, AS APPLICABLE, WHICH WILL BIND YOU.
4
+
5
+ - IF YOU DO NOT AGREE TO THE TERMS OF THIS AGREEMENT, WE WILL NOT LICENSE THE GORILLA ENGINE SDK TO YOU AND YOU MUST DISCONTINUE THE INSTALLATION OR DOWNLOAD PROCESS OR CEASE USE OF THE UJAM GORILLA ENGINE SDK.
6
+
7
+ **GORILLA ENGINE FREE TIER LICENSE**
8
+
9
+ This Gorilla Engine Free Tier License ("Agreement") is entered between UJAM, Inc., a Delaware corporation (hereinafter "UJAM" or "we") and you (“Licensee” or “you”) and becomes effective once you download, install, or use the GORILLA ENGINE SDK.
10
+
11
+ 1. OBJECT OF AGREEMENT. This Agreement governs UJAM’s GORILLA ENGINE SDK (“SDK”) and all related software and documentation and any update, upgrades or bug fixes (collectively referred to as the "UJAM GORILLA ENGINE SDK SERVICE").
12
+
13
+ 2. GRANT OF LICENSE: Subject to your full compliance with all of the terms and conditions of this Agreement, we grant you a non-exclusive, revocable, nonsublicensable (except as specifically provided herein), non-transferable license to use the UJAM GORILLA ENGINE SDK SERVICE solely to: (i) download, install, and use the UJAM GORILLA ENGINE SDK SERVICE for the sole purpose of building audio plugins such as virtual instruments and effects ("Application") and using such Application for music productions and live performances. **HOWEVER, YOU MUST NOT SHARE OR OTHERWISE EXPLOIT YOUR GORILLA ENGINE BASED APPLICATION WITH ANY THIRD PARTY UNTIL YOU HAVE ACQUIRED ONE OF THE ADD-ON LICENSES AS FURTHER DESCRIBED IN SECTION 8 OF THIS AGREEMENT.** If you have any questions regarding this license and allowed uses of the SDK, please reach out to us via email at support@gorilla-engine.com.
14
+
15
+ 3. LICENSE RESTRICTIONS AND OBLIGATIONS: Except as expressly and unambiguously authorized under this Agreement, you must not
16
+ 1. copy, rent, lease, sell, transfer, assign, sublicense, disassemble, reverse engineer or decompile (except to the limited extent expressly authorized by applicable statutory law), modify, create derivative works from, or alter any part of the UJAM GORILLA ENGINE SDK SERVICE;
17
+ 2. sublicense your Application to end-users until you have acquired a license as further described in Section 8 of this Agreement.
18
+ 3. use any automated means, including, without limitation, agents, robots, scripts or spiders, to access the UJAM GORILLA ENGINE SDK SERVICE or bypass the UJAM GORILLA ENGINE SDK SERVICE or to interfere or attempt to interfere with the proper working of the UJAM GORILLA ENGINE SDK SERVICE;
19
+ 4. use the UJAM GORILLA ENGINE SDK SERVICE as a dynamic-link library (for clarity: the SDK shall solely be used as a statically linked library); (g) use the SDK or any part of the SDK in connection with building or distributing your own or a third-party SDK or framework; or (h) use the Licensed Software to train artificial intelligence, your own or a third-party algorithm, and/or any other kind of machine learning processes.
20
+ 5. use the UJAM GORILLA ENGINE SDK SERVICE for the benefit of a third party, other than end users of your Applications as expressly authorized by this Agreement;
21
+ 6. use the UJAM GORILLA ENGINE SDK SERVICE to implement or enhance a product or service that is competitive with the UJAM GORILLA ENGINE SDK SERVICE;
22
+ 7. modify and/or rename the UJAM binary libraries; or
23
+ 8. otherwise engage in activity that interrupts the proper working of the UJAM GORILLA ENGINE SDK SERVICE or is otherwise fraudulent or illegal.
24
+
25
+ Furthermore, you agree
26
+
27
+ 9. display attribution on all embodiments and uses of the Gorilla Engine SDK by displaying the language “powered by Gorilla Engine” ; and
28
+ 10. to contact UJAM once you intend to Distribute (as defined in Section 8\) your Application to obtain the appropriate license to do so – which you agree is required for such a scenario (as further described in Section 8 below).
29
+
30
+ We reserve the right to discontinue, modify, cease support of, and alter the pricing structure of this Agreement (the Gorilla Engine Free Tier License) of the UJAM GORILLA ENGINE SDK SERVICE.
31
+
32
+ 10. LICENSE TO UJAM: You hereby grant to us the non-exclusive, perpetual, worldwide, royalty-free right and license to any and all content ("Content") provided by you or your end users in connection with your use or your end users' use of the SDK, including but not limited to feedback or other contributions made towards the UJAM GORILLA ENGINE SDK SERVICE (including so-called re-usable components, made available by UJAM via its repositories), in order for us to provide and improve the UJAM GORILLA ENGINE SDK SERVICE. You represent and warrant that all Content provided by you shall not violate any third party rights and shall be free of any and all claims.
33
+
34
+ 11. REPRESENTATIONS AND WARRANTIES: You represent and warrant that you: (i) are fully authorized to enter into this agreement; (ii) shall use the UJAM GORILLA ENGINE SDK SERVICE in compliance with all applicable local, state, national and foreign laws, treaties and regulations, including those related to data privacy, international communications, export laws and the transmission of technical or personal data laws; (iii) shall not (and shall not permit any third party, including a permitted sublicensee to), directly or indirectly, take any action or upload, download, post, submit or otherwise distribute or facilitate distribution of Content or any material on or through the UJAM GORILLA ENGINE SDK SERVICE, that: (a) infringes any patent, trademark, trade secret, copyright, right of publicity/privacy or other right of any third party or induces infringement thereof; (b) breaches any third party contract or obligation; (c) is unlawful, threatening, abusive, harassing, defamatory, deceptive, fraudulent, invasive of another's privacy, tortious, obscene, offensive, or profane.
35
+
36
+ 12. OWNERSHIP AND PROPRIETARY RIGHTS: As between UJAM and Licensee (and any permitted sublicensees), the SDK and all intellectual property rights in and to the UJAM GORILLA ENGINE SDK SERVICE, are and shall at all times remain the sole and exclusive property of UJAM and are protected by applicable intellectual property laws and treaties. You shall not obscure, remove or otherwise alter our copyright or trademark notices or other proprietary rights' notices affixed to or within the SDK or elsewhere.
37
+
38
+ 13. SUPPORT AND UPGRADES: This Agreement does not entitle you to any support for the SDK, unless you enter into a separate agreement with us in writing, either signed by both parties or agreed upon via click-through agreement. Any such support provided by us shall be subject to the terms and disclaimers of this Agreement.
39
+
40
+ 14. ADD-ON LICENSES FOR A PERMITTED DISTRIBUTION OF GORILLA ENGINE BASED APPLICATION:
41
+ 1. **Add-On Licenses (Upgrade to Pro Tier):** You agree to contact UJAM to obtain one of our commercial license (including the so-called “Pro Tier” License, including available optional Add-On upgrades which can be ) (collectively referred to as “Add-On Licenses”), whichever deemed to be appropriate for your intended use of the SDK, to Distribute (as defined below in subsection ii.) your Gorilla Engine based Application to end-users. Such Add-On License shall supersede this Agreement, as agreed to by the parties.
42
+ 2. **Failure to comply with Section 8:** If you fail to comply with Section 8(i) by Distributing the SDK as part of an Application beyond the allowed use under this Agreement, you shall immediately contact UJAM and pay to UJAM a royalty per each Distribution (as defined below) in an amount as solely determined by UJAM. A Distribution refers to either an embedded, pre-bundled, pre-installed platform application or software application that is downloaded, delivered, or served to a user or device by any means of distribution including directly from you or through any platform, including cloud based platforms. In avoidance of doubt, any subscription or rental shall be considered a Distribution.
43
+ 3. **Audit Rights**: Should (i) you fail to obtain an Add-On License and distribute the SDK as part of an Application, or should (ii) UJAM believe that you distribute the Application without having obtained an Add-On License, then UJAM shall have the right, upon reasonable notice, to audit/inspect any premises, computer(s), and networks on or in which the SDK is installed or used to monitor compliance with the terms of this Agreement, including but not limited to confirming the number of Distributions of the Application. If an audit reveals any unauthorized use, in addition to all other remedies available to UJAM, you shall be responsible to UJAM for all reasonable expenses related to the audit.
44
+ 4. **Third Party Libraries:** You acknowledge that certain third-party libraries, including JUCE 6 ([https://juce.com/legal/juce-6-license/](https://juce.com/legal/juce-6-license/)), may be used in connection with the SDK, subject to their respective license agreements as further disclosed by UJAM. It is your sole responsibility to abide to such third-party terms, which may include your obligations, amongst others, to provide certain disclosures accompanying your Gorilla Engine based Software and/or acquiring a JUCE license (if applicable).
45
+
46
+ 15. DATA PROTECTION AND PRIVACY: We may collect and process information about you and your use of the Gorilla Engine SDK, some of which may amount to personal data, subject to Gorilla Engine’s Privacy Policy.
47
+
48
+ 16. TRADE SECRETS AND CONFIDENTIAL INFORMATION: You acknowledges that the SDK contains valuable trade secrets of UJAM and, should you access any such trade secrets in violation of this Agreement, you agree to maintain the confidentiality of the trade secrets of the SDK using at least the same degree of care that you use with your own confidential information.
49
+
50
+ 17. WARRANTY DISCLAIMER: THE UJAM GORILLA ENGINE SDK SERVICE, INCLUDING THE SDK, IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, WE DISCLAIM ALL WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, REGARDING THE UJAM GORILLA ENGINE SDK SERVICE, INCLUDING WITHOUT LIMITATION ANY AND ALL IMPLIED WARRANTIES OF MERCHANTABILITY, ACCURACY, RESULTS OF USE, RELIABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AVAILABILITY, PERFORMANCE, BANDWIDTH, AND NON-INFRINGEMENT OF THIRD-PARTY RIGHTS. FURTHER, WE DISCLAIM ANY WARRANTY THAT LICENSEE'S USE OF THE UJAM GORILLA ENGINE SDK SERVICE WILL BE AVAILABLE, UNINTERRUPTED OR ERROR FREE.
51
+
52
+ 18. LIABILITY LIMITATION: REGARDLESS OF WHETHER ANY REMEDY SET FORTH HEREIN FAILS OF ITS ESSENTIAL PURPOSE OR OTHERWISE, AND EXCEPT FOR BODILY INJURY, IN NO EVENT WILL WE OR OUR CONTRACTORS, EMPLOYEES OR AFFILIATES BE LIABLE TO YOU OR TO ANY THIRD PARTY UNDER ANY TORT, CONTRACT, NEGLIGENCE, STRICT LIABILITY OR OTHER LEGAL OR EQUITABLE THEORY FOR ANY LOST PROFITS, LOST OR CORRUPTED DATA, COMPUTER FAILURE OR MALFUNCTION, INFRINGEMENT, INTERRUPTION OF BUSINESS, OR OTHER SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND ARISING OUT OF THE USE OR INABILITY TO USE THE UJAM GORILLA ENGINE SDK SERVICE, EVEN IF WE HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES AND WHETHER OR NOT SUCH LOSS OR DAMAGES ARE FORESEEABLE. IN NO EVENT SHALL OUR TOTAL LIABILITY TO YOU OR ANY THIRD PARTY EXCEED TEN USD DOLLARS. ANY CLAIM ARISING OUT OF OR RELATING TO THIS AGREEMENT MUST BE BROUGHT WITHIN ONE (1) YEAR AFTER THE OCCURRENCE OF THE EVENT GIVING RISE TO SUCH CLAIM.
53
+
54
+ 19. INDEMNITY: You agree that we shall have no liability whatsoever for your or your end users of the UJAM GORILLA ENGINE SDK SERVICE. You shall indemnify, defend and hold us harmless from any and all claims, damages, liabilities, costs, and fees (including reasonable attorneys' fees) arising from your or your end users' use of the UJAM GORILLA ENGINE SDK SERVICE or for any breach of this Agreement, including any breach of the representations and warranties you made herein.
55
+
56
+ 20. TERM AND TERMINATION: This Agreement shall continue until terminated as set forth in this Section. Either party may terminate this Agreement at any time, for any reason, or for no reason including, but not limited to, if you violate any provision of this Agreement. We reserve the right to cancel, amend, or modify the SDK at any time. Any termination of this Agreement shall also terminate the license granted hereunder. Upon termination of this Agreement for any reason, you shall immediately destroy and remove from all computers, hard drives, networks, and other storage media all copies of the SDK, and shall so certify to us that such actions have occurred (including all cached ephemeral copies). Sections 5 (“REPRESENTATIONS AND WARRANTIES”), 6 (“OWNERSHIP AND PROPRIETARY RIGHTS”), 10 (“TRADE SECRETS AND CONFIDENTIAL INFORMATION”), 11 (“WARRANTY DISCLAIMER”), 12 (“LIABILITY LIMITATION”), 13 (“INDEMNITY”), 16 (“GOVERNING LAW”), 18 (“GENERAL PROVISIONS”) shall survive termination of this Agreement.
57
+
58
+ 21. EXPORT CONTROLS: You shall comply with all applicable export laws and restrictions and regulations and you shall not export, or allow the export or re-export of the SDK in violation of any such restrictions, laws, or regulations.
59
+
60
+ 22. GOVERNING LAW: This Agreement shall be governed by New York law, excluding conflict of law provisions. The parties agree to and submit to the exclusive jurisdiction of courts located in New York City, New York. The application of the United Nations Convention of Contracts for the International Sale of Goods is expressly excluded.
61
+
62
+ 23. PREVAILING PARTY. Notwithstanding Section 12 (“LIABILITY LIMITATION”), in the event of any court action relating to enforcement of this Agreement, including injunctive relief, the non-prevailing party shall reimburse the prevailing party for all reasonable attorneys’ fees and costs, including expert witness fees, resulting therefrom.
63
+
64
+ 24. GENERAL PROVISIONS. If any part of this Agreement is found void or unenforceable, it will not affect the validity of the balance of the Agreement, which shall remain valid and enforceable according to its terms. This Agreement may only be modified by written agreement between the Parties. Updates to the UJAM GORILLA ENGINE SDK SERVICE may be licensed to you by UJAM with additional or different terms. UJAM further reserves rights, in its discretion, not to license updates. This is the entire Agreement between UJAM and you relating to the UJAM GORILLA ENGINE SDK SERVICE and it supersedes any prior representations, discussions, undertakings, communications, or advertising relating to the UJAM GORILLA ENGINE SDK SERVICE. This Agreement is not assignable by you.
package/README.md ADDED
@@ -0,0 +1,376 @@
1
+ # @gorilla-engine-sdk/ge-dialogs-lib
2
+
3
+ A React dialog library for Gorilla Engine audio plugin interfaces, featuring:
4
+
5
+ - Blocking and non-blocking modals
6
+ - Ready-to-use message, confirmation, and custom-content modal components
7
+ - Tooltips positioned from Gorilla Engine native component refs
8
+ - Timed notifications with optional stacking
9
+ - Shared, customizable styles for all dialog types
10
+ - Runtime updates when the plugin UI size changes
11
+
12
+ This library is designed for Gorilla Engine React, a custom React reconciler that renders to native Gorilla Engine UI components.
13
+
14
+ ## Install
15
+
16
+ ```bash
17
+ npm install @gorilla-engine-sdk/ge-dialogs-lib
18
+ ```
19
+
20
+ **Peer dependency:** `@gorilla-engine-sdk/gorilla-engine-react` 1.x
21
+
22
+ ## Quick Start
23
+
24
+ Render `Dialogs` around every component that uses a dialog hook. The wrapper installs the modal, tooltip, notification, and style contexts and renders their roots above your application content.
25
+
26
+ ```tsx
27
+ import * as React from 'react';
28
+ import * as GEReact from '@gorilla-engine-sdk/gorilla-engine-react';
29
+ import {
30
+ DefaultModal,
31
+ Dialogs,
32
+ useModal,
33
+ useNotification,
34
+ useToolTip,
35
+ } from '@gorilla-engine-sdk/ge-dialogs-lib';
36
+
37
+ const PLUGIN_WIDTH = 920;
38
+ const PLUGIN_HEIGHT = 590;
39
+
40
+ function PluginUI() {
41
+ const helpButtonRef = React.useRef<any>(null);
42
+ const [showNotification] = useNotification();
43
+ const [showToolTip, hideToolTip] = useToolTip();
44
+ const [showModal, hideModal] = useModal(() => (
45
+ <DefaultModal
46
+ title="Reset settings?"
47
+ message="This restores all settings to their factory values."
48
+ isBlocking
49
+ isBlockingClosable
50
+ closeTrigger
51
+ cancelTrigger
52
+ cancelTriggerLabel="Cancel"
53
+ onCancelTrigger={hideModal}
54
+ approveTrigger
55
+ approveTriggerLabel="Reset"
56
+ onApproveTrigger={() => {
57
+ resetSettings();
58
+ hideModal();
59
+ showNotification({ message: 'Settings reset' });
60
+ }}
61
+ />
62
+ ));
63
+
64
+ return (
65
+ <geLabel width={PLUGIN_WIDTH} height={PLUGIN_HEIGHT}>
66
+ <geButton x={20} y={20} width={140} height={32} text="Reset" onClick={showModal} />
67
+ <geButton
68
+ ref={helpButtonRef}
69
+ x={180}
70
+ y={20}
71
+ width={32}
72
+ height={32}
73
+ text="?"
74
+ onMouseEnter={() => showToolTip(helpButtonRef.current, 'Reset help')}
75
+ onMouseExit={hideToolTip}
76
+ />
77
+ </geLabel>
78
+ );
79
+ }
80
+
81
+ function App() {
82
+ return (
83
+ <Dialogs
84
+ styleState={{
85
+ pluginWidth: PLUGIN_WIDTH,
86
+ pluginHeight: PLUGIN_HEIGHT,
87
+ }}
88
+ >
89
+ <PluginUI />
90
+ </Dialogs>
91
+ );
92
+ }
93
+
94
+ GEReact.createUI(<App />, PLUGIN_WIDTH, PLUGIN_HEIGHT);
95
+ ```
96
+
97
+ ## Modals
98
+
99
+ ### `useModal`
100
+
101
+ ```typescript
102
+ const [showModal, hideModal] = useModal(component, inputs?, isBlocking?, zIndex?);
103
+ ```
104
+
105
+ Registers a function component with the nearest `Dialogs` or `ModalProvider`. It returns stable callbacks that show and hide that modal. Class components are not supported.
106
+
107
+ | Argument | Type | Default | Description |
108
+ | ------------ | ------------------------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
109
+ | `component` | `React.FunctionComponent` | | Function component rendered when the modal is shown. |
110
+ | `inputs` | `React.DependencyList` | `[]` | Values that recreate the registered component when they change. Include every changing value used by the component, or read changing data from a ref. |
111
+ | `isBlocking` | `boolean` | `true` | Compatibility argument. Set blocking behavior on the rendered `Modal` or `DefaultModal` with its `isBlocking` prop. |
112
+ | `zIndex` | `string` | | Optional registration key. Normally the hook generates one automatically. |
113
+
114
+ The modal is also removed when the component using the hook unmounts.
115
+
116
+ ### `DefaultModal`
117
+
118
+ `DefaultModal` displays a title and message using the shared modal style. It accepts all `ModalProps` plus a required `message` string.
119
+
120
+ ```tsx
121
+ const [showError, hideError] = useModal(() => (
122
+ <DefaultModal
123
+ title="Unable to load preset"
124
+ message="The selected preset file could not be read."
125
+ isBlocking
126
+ closeTrigger
127
+ approveTrigger
128
+ approveTriggerLabel="OK"
129
+ onApproveTrigger={hideError}
130
+ onCancelTrigger={hideError}
131
+ />
132
+ ));
133
+ ```
134
+
135
+ The default cancel and approve labels are `Cancel` and `OK`.
136
+
137
+ ### `Modal`
138
+
139
+ Use `Modal` directly when the dialog needs custom native content. Children are rendered below the header inside the modal's horizontal content margins.
140
+
141
+ ```tsx
142
+ const [showRename, hideRename] = useModal(() => (
143
+ <Modal
144
+ title="Rename preset"
145
+ modalWidth={420}
146
+ modalHeight={240}
147
+ isBlocking
148
+ closeTrigger
149
+ cancelTrigger
150
+ cancelTriggerLabel="Cancel"
151
+ onCancelTrigger={hideRename}
152
+ approveTrigger
153
+ approveTriggerLabel="Save"
154
+ onApproveTrigger={() => {
155
+ savePresetName();
156
+ hideRename();
157
+ }}
158
+ >
159
+ <geTextEditor x={0} y={20} width={388} height={32} text="New preset name" />
160
+ </Modal>
161
+ ));
162
+ ```
163
+
164
+ ### `ModalProps`
165
+
166
+ | Property | Type | Description |
167
+ | ------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------- |
168
+ | `title` | `string` | Required title displayed in the modal header. |
169
+ | `modalStyle` | `ModalsStyle` | Complete style override for this modal. |
170
+ | `modalWidth` | `number` | Width override; otherwise the active style's `modalWidth` is used. |
171
+ | `modalHeight` | `number` | Height override; otherwise the active style's `modalHeight` is used. |
172
+ | `x`, `y` | `number` | Absolute position overrides. Alignment rules are used when omitted. |
173
+ | `isBlocking` | `boolean` | Intercepts mouse clicks across the plugin and shows the blocking background. |
174
+ | `isBlockingClosable` | `boolean` | Calls `onCancelTrigger` when the blocking background is clicked. |
175
+ | `blockingBackgroundColor` | `string` | Per-modal blocking background color override. |
176
+ | `closeTrigger` | `boolean` | Shows the header close button. It calls `onCancelTrigger`. |
177
+ | `cancelTrigger` | `boolean` | Shows the footer cancel button. |
178
+ | `cancelTriggerEnabled` | `boolean` | Enables or disables the cancel button. |
179
+ | `cancelTriggerLabel` | `string` | Cancel button text. |
180
+ | `onCancelTrigger` | `() => void` | Handles close, cancel, and closable-background actions. Call `hideModal` here when the modal should close. |
181
+ | `approveTrigger` | `boolean` | Shows the footer approve button. |
182
+ | `approveTriggerEnabled` | `boolean` | Enables or disables the approve button. |
183
+ | `approveTriggerLabel` | `string` | Approve button text. |
184
+ | `onApproveTrigger` | `() => void` | Handles approval. Call `hideModal` here when the modal should close. |
185
+ | `children` | `ReactNode` | Custom Gorilla Engine React content. |
186
+
187
+ ## Tooltips
188
+
189
+ ### `useToolTip`
190
+
191
+ ```typescript
192
+ const [showToolTip, hideToolTip] = useToolTip(options?);
193
+ ```
194
+
195
+ `showToolTip(component, text, style?)` displays a tooltip after the configured delay. Pass the native component instance from a ref, not a browser element. The tooltip is centered below the target when space permits and moves above it near the bottom edge of the plugin.
196
+
197
+ ```tsx
198
+ const buttonRef = React.useRef<any>(null);
199
+ const [showToolTip, hideToolTip] = useToolTip();
200
+
201
+ <geButton
202
+ ref={buttonRef}
203
+ width={32}
204
+ height={32}
205
+ text="?"
206
+ onMouseEnter={() => showToolTip(buttonRef.current, 'Open the user guide')}
207
+ onMouseExit={hideToolTip}
208
+ />;
209
+ ```
210
+
211
+ The optional hook-level `toolTipStyle` applies to every tooltip from that hook. The style passed to `showToolTip` takes precedence over the hook-level and global styles.
212
+
213
+ ## Notifications
214
+
215
+ ### `useNotification`
216
+
217
+ ```typescript
218
+ const [showNotification, hideNotification] = useNotification(options?);
219
+ ```
220
+
221
+ Show a notification by passing a message and, optionally, a complete notification style override:
222
+
223
+ ```tsx
224
+ const [showNotification] = useNotification();
225
+
226
+ showNotification({ message: 'Preset saved successfully' });
227
+
228
+ showNotification({
229
+ message: 'Could not save preset',
230
+ notificationStyle: {
231
+ ...dialogsDefaultStyle.notification!,
232
+ container: {
233
+ ...dialogsDefaultStyle.notification!.container,
234
+ backgroundColor: '9E2A2B',
235
+ },
236
+ },
237
+ });
238
+ ```
239
+
240
+ Notifications dismiss automatically after `notification.duration` milliseconds. The default duration is 2500 ms. Multiple active notifications render together; setting `stackNotifications` enables offset stacking.
241
+
242
+ The hook also returns `hideNotification` for API compatibility. Current notification identifiers are generated internally, so normal integrations should rely on automatic dismissal.
243
+
244
+ ## Styling
245
+
246
+ Pass a `DialogsStylesState` object to `Dialogs`. Only `pluginWidth` and `pluginHeight` are required; omitted modal, tooltip, and notification sections fall back to `dialogsDefaultStyle`.
247
+
248
+ When customizing a section, derive it from the defaults because each supplied section is treated as a complete style object rather than deep-merged.
249
+
250
+ ```tsx
251
+ import {
252
+ Dialogs,
253
+ DialogsStylesState,
254
+ dialogsDefaultStyle,
255
+ } from '@gorilla-engine-sdk/ge-dialogs-lib';
256
+
257
+ const dialogStyles: DialogsStylesState = {
258
+ ...dialogsDefaultStyle,
259
+ pluginWidth: 920,
260
+ pluginHeight: 590,
261
+ modal: {
262
+ ...dialogsDefaultStyle.modal!,
263
+ modal: {
264
+ ...dialogsDefaultStyle.modal!.modal,
265
+ backgroundColor: '2F333F',
266
+ border: { width: 1, color: '3F4354' },
267
+ },
268
+ approveButton: {
269
+ ...dialogsDefaultStyle.modal!.approveButton,
270
+ backgroundColor: '5177E0',
271
+ textColor: 'FFFFFF',
272
+ },
273
+ },
274
+ notification: {
275
+ ...dialogsDefaultStyle.notification!,
276
+ duration: 3000,
277
+ container: {
278
+ ...dialogsDefaultStyle.notification!.container,
279
+ backgroundColor: '20242E',
280
+ },
281
+ },
282
+ toolTip: {
283
+ ...dialogsDefaultStyle.toolTip!,
284
+ showDelay: 500,
285
+ },
286
+ };
287
+
288
+ <Dialogs styleState={dialogStyles}>
289
+ <PluginUI />
290
+ </Dialogs>;
291
+ ```
292
+
293
+ ### Style State
294
+
295
+ | Property | Type | Description |
296
+ | -------------------- | -------------------- | ------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
297
+ | `pluginWidth` | `number` | Width of the full plugin UI and dialog overlay. |
298
+ | `pluginHeight` | `number` | Height of the full plugin UI and dialog overlay. |
299
+ | `modal` | `ModalsStyle` | Modal alignment, dimensions, colors, and component props. |
300
+ | `notification` | `NotificationsStyle` | Notification alignment, duration, container, and label props. |
301
+ | `toolTip` | `ToolTipsStyle` | Tooltip delay, container, and label props. |
302
+ | `stackNotifications` | `{ direction: 'up' | 'down' }` | Enables notification stacking. The direction value is reserved for stack configuration. |
303
+
304
+ All `modal`, `title`, `message`, `dividerLine`, `container`, and `label` style entries accept the corresponding partial Gorilla Engine React component props. Button styles accept partial `GEButtonProps`.
305
+
306
+ ### Updating Plugin Size
307
+
308
+ If the plugin can resize, update the dialog overlay dimensions from a component inside `Dialogs`:
309
+
310
+ ```tsx
311
+ import {
312
+ DialogsStylesDispatchTypes,
313
+ useDialogsStylesStateDispatch,
314
+ } from '@gorilla-engine-sdk/ge-dialogs-lib';
315
+
316
+ function ResizeListener({ width, height }: { width: number; height: number }) {
317
+ const dispatch = useDialogsStylesStateDispatch();
318
+
319
+ React.useEffect(() => {
320
+ dispatch({
321
+ type: DialogsStylesDispatchTypes.changePluginSize,
322
+ payload: { width, height },
323
+ });
324
+ }, [dispatch, width, height]);
325
+
326
+ return null;
327
+ }
328
+ ```
329
+
330
+ Use `useDialogsStylesState()` to read the current style state from descendants.
331
+
332
+ ## Default Layout
333
+
334
+ The exported `dialogsDefaultStyle` uses a 1024 x 768 plugin area with:
335
+
336
+ - A centered 400 x 220 modal and translucent blocking background
337
+ - Notifications aligned 30 px from the bottom-right corner
338
+ - A 400 ms tooltip delay with automatic edge-aware placement
339
+ - Native component colors written as Gorilla Engine hex strings without `#`
340
+
341
+ Override `pluginWidth` and `pluginHeight` to match the dimensions passed to `GEReact.createUI`.
342
+
343
+ ## Exported API
344
+
345
+ | Export | Purpose |
346
+ | ------------------------------- | ---------------------------------------------------------------------- |
347
+ | `Dialogs` | Recommended top-level provider for all dialog types and shared styles. |
348
+ | `DefaultModal` | Message modal built on `Modal`. |
349
+ | `DefaultModalProps` | Props type for `DefaultModal`. |
350
+ | `Modal` | Base modal component for custom content. |
351
+ | `ModalProps` | Props type for `Modal`. |
352
+ | `useModal` | Registers and controls a modal function component. |
353
+ | `useToolTip` | Shows and hides tooltips anchored to native component refs. |
354
+ | `DefaultToolTip` | Default tooltip renderer. Most consumers use it through `useToolTip`. |
355
+ | `useNotification` | Shows timed notifications. |
356
+ | `DialogsStylesState` | Shared dialog style-state type. |
357
+ | `DialogsStylesDispatchTypes` | Action names for style-state updates. |
358
+ | `useDialogsStylesState` | Reads the current shared style state. |
359
+ | `useDialogsStylesStateDispatch` | Dispatches shared style-state updates. |
360
+ | `dialogsDefaultStyle` | Complete default style state. |
361
+ | `ModalProvider` | Low-level modal provider used by `Dialogs`. |
362
+ | `ModalProviderProps` | Props type for `ModalProvider`. |
363
+ | `ErrorBoundary` | Native-label error boundary used by the built-in dialog components. |
364
+ | `GE_DIALOGS_LIB` | Log prefix constant (`[ge-dialogs-lib]`). |
365
+
366
+ For normal application setup, prefer `Dialogs` over constructing the individual providers yourself.
367
+
368
+ ## Error Handling
369
+
370
+ Calling a hook outside its provider throws an error. In practice, ensure the hook is called by a descendant of `Dialogs`, not by the same component that returns the `Dialogs` wrapper.
371
+
372
+ The built-in modal, tooltip, and notification components use `ErrorBoundary`. If rendering fails, it logs the error and replaces that dialog with a native `<geLabel>` containing error information.
373
+
374
+ ## License
375
+
376
+ [GORILLA ENGINE FREE TIER LICENSE](./LICENSE.md)
@@ -0,0 +1,8 @@
1
+ import * as React from 'react';
2
+ import { DialogsStyleState } from './DialogsStyleState';
3
+ type DialogsProps = {
4
+ styleState?: DialogsStyleState;
5
+ children: any;
6
+ };
7
+ export declare function Dialogs(props: DialogsProps): React.JSX.Element;
8
+ export {};
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.Dialogs = Dialogs;
37
+ const React = __importStar(require("react"));
38
+ const NotificationProvider_1 = require("./notifications/NotificationProvider");
39
+ const ToolTipProvider_1 = require("./tooltips/ToolTipProvider");
40
+ const ModalProvider_1 = require("./modals/ModalProvider");
41
+ const DialogsStyleState_1 = require("./DialogsStyleState");
42
+ const dialogsDefaultStyle_1 = require("./dialogsDefaultStyle");
43
+ function Dialogs(props) {
44
+ const styleState = React.useMemo(() => (props.styleState ? props.styleState : dialogsDefaultStyle_1.dialogsDefaultStyle), [props.styleState]);
45
+ return (React.createElement(React.Fragment, null,
46
+ React.createElement(DialogsStyleState_1.DialogsStylesProvider, { state: styleState },
47
+ React.createElement(NotificationProvider_1.NotificationProvider, { styleState: props.styleState },
48
+ React.createElement(ToolTipProvider_1.ToolTipProvider, { styleState: props.styleState },
49
+ React.createElement(ModalProvider_1.ModalProvider, { styleState: props.styleState }, props.children))))));
50
+ }
51
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRGlhbG9ncy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9EaWFsb2dzLnRzeCJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQVdBLDBCQWdCQztBQTNCRCw2Q0FBK0I7QUFDL0IsK0VBQTRFO0FBQzVFLGdFQUE2RDtBQUM3RCwwREFBdUQ7QUFDdkQsMkRBQStFO0FBQy9FLCtEQUE0RDtBQU01RCxTQUFnQixPQUFPLENBQUMsS0FBbUI7SUFDekMsTUFBTSxVQUFVLEdBQUcsS0FBSyxDQUFDLE9BQU8sQ0FDOUIsR0FBRyxFQUFFLENBQUMsQ0FBQyxLQUFLLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsVUFBVSxDQUFDLENBQUMsQ0FBQyx5Q0FBbUIsQ0FBQyxFQUNqRSxDQUFDLEtBQUssQ0FBQyxVQUFVLENBQUMsQ0FDbkIsQ0FBQztJQUNGLE9BQU8sQ0FDTDtRQUNFLG9CQUFDLHlDQUFxQixJQUFDLEtBQUssRUFBRSxVQUFVO1lBQ3RDLG9CQUFDLDJDQUFvQixJQUFDLFVBQVUsRUFBRSxLQUFLLENBQUMsVUFBVTtnQkFDaEQsb0JBQUMsaUNBQWUsSUFBQyxVQUFVLEVBQUUsS0FBSyxDQUFDLFVBQVU7b0JBQzNDLG9CQUFDLDZCQUFhLElBQUMsVUFBVSxFQUFFLEtBQUssQ0FBQyxVQUFVLElBQUcsS0FBSyxDQUFDLFFBQVEsQ0FBaUIsQ0FDN0QsQ0FDRyxDQUNELENBQ3ZCLENBQ0osQ0FBQztBQUNKLENBQUMifQ==
@@ -0,0 +1,127 @@
1
+ import * as React from 'react';
2
+ import { GEButtonProps, GELabelProps } from '@gorilla-engine-sdk/gorilla-engine-react';
3
+ export type DialogsStyleState = {
4
+ /** The width of the plugin */
5
+ pluginWidth: number;
6
+ /** The height of the plugin */
7
+ pluginHeight: number;
8
+ /** Definitions of Modals */
9
+ modal?: ModalsStyle;
10
+ /** Definitions of Notifications */
11
+ stackNotifications?: {
12
+ direction: 'up' | 'down';
13
+ };
14
+ notification?: NotificationsStyle;
15
+ /** Definitions of ToolTips */
16
+ toolTip?: ToolTipsStyle;
17
+ };
18
+ export type ModalsStyle = {
19
+ /** Horizontal alignment of dialog */
20
+ horizontalAlign: DialogHorizontalAlign;
21
+ /** Horizontal offset in Pixels */
22
+ horizontalOffset?: number;
23
+ headerHeight: number;
24
+ horizontalContentMargin: number;
25
+ /** Vertical alignment of dialog */
26
+ verticalAlign: DialogVerticalAlign;
27
+ /** Vertical offset in Pixels */
28
+ verticalOffset?: number;
29
+ /** Default width of modal */
30
+ modalWidth: number;
31
+ /** Default height of modal */
32
+ modalHeight: number;
33
+ /** Background/blocking color in case modal is blocking underlying ui */
34
+ blockingBackgroundColor: string;
35
+ /** Modal container - can have all props of geLabel */
36
+ modal: Partial<GELabelProps>;
37
+ /** Modal title - can have all props of geLabel */
38
+ title: Partial<GELabelProps>;
39
+ dividerLine?: Partial<GELabelProps>;
40
+ /** Modal message - can have all props of geLabel */
41
+ message: Partial<GELabelProps>;
42
+ /** Cancel/abort button - can have all props of geLabel */
43
+ cancelButton: Partial<GEButtonProps>;
44
+ /** Approve/ok button - can have all props of geLabel */
45
+ approveButton: Partial<GEButtonProps>;
46
+ /** x/close button - can have all props of geLabel */
47
+ closeButton: Partial<GEButtonProps>;
48
+ /** x/close button positioning. Close button will be top-left/top-right in header-area. space is used for x/y distance */
49
+ closeButtonPosition: {
50
+ position: 'left' | 'right';
51
+ space: number;
52
+ };
53
+ };
54
+ export type NotificationsStyle = {
55
+ /** Horizontal alignment of dialog */
56
+ horizontalAlign: DialogHorizontalAlign;
57
+ /** Horizontal offset in Pixels */
58
+ horizontalOffset?: number;
59
+ /** Vertical alignment of dialog */
60
+ verticalAlign: DialogVerticalAlign;
61
+ /** Vertical offset in Pixels */
62
+ verticalOffset?: number;
63
+ /** Duration in ms - how long the Notification is displayed */
64
+ duration?: number;
65
+ /** Container of Notification - can have all props of geLabel */
66
+ container: Partial<GELabelProps>;
67
+ /** Label of Notification - can have all props of geLabel */
68
+ label: Partial<GELabelProps>;
69
+ };
70
+ export type ToolTipsStyle = {
71
+ /** Delay in ms - how long till ToolTip is displayed */
72
+ showDelay?: number;
73
+ /** Container of ToolTip - can have all props of geLabel */
74
+ container: Partial<GELabelProps>;
75
+ /** Label of ToolTip - can have all props of geLabel */
76
+ label: Partial<GELabelProps>;
77
+ };
78
+ export declare enum DialogHorizontalAlign {
79
+ LEFT = "LEFT",
80
+ RIGHT = "RIGHT",
81
+ CENTER = "CENTER"
82
+ }
83
+ export declare enum DialogVerticalAlign {
84
+ TOP = "top",
85
+ BOTTOM = "bottom",
86
+ CENTER = "center"
87
+ }
88
+ /**
89
+ *
90
+ */
91
+ export declare enum DialogsStylesDispatchTypes {
92
+ changePluginSize = "changePluginSize"
93
+ }
94
+ type DialogsStylesPayload = {
95
+ [DialogsStylesDispatchTypes.changePluginSize]: {
96
+ width: number;
97
+ height: number;
98
+ };
99
+ };
100
+ export type DialogsStylesActions = ActionMap<DialogsStylesPayload>[keyof ActionMap<DialogsStylesPayload>];
101
+ export declare const dialogsStylesReducer: (state: DialogsStyleState, action: DialogsStylesActions) => DialogsStyleState;
102
+ export declare const DialogsStylesContext: React.Context<DialogsStyleState | undefined>;
103
+ export declare const DialogsStylesDispatchContext: React.Context<React.Dispatch<{
104
+ type: DialogsStylesDispatchTypes.changePluginSize;
105
+ payload: {
106
+ width: number;
107
+ height: number;
108
+ };
109
+ }> | undefined>;
110
+ type DialogsStylesProviderProps = {
111
+ state: DialogsStyleState;
112
+ children?: React.ReactNode;
113
+ };
114
+ export declare const DialogsStylesProvider: React.FC<DialogsStylesProviderProps>;
115
+ export declare function useDialogsStylesState(): DialogsStyleState;
116
+ export declare function useDialogsStylesStateDispatch(): React.Dispatch<DialogsStylesActions>;
117
+ export type ActionMap<M extends {
118
+ [index: string]: any;
119
+ }> = {
120
+ [Key in keyof M]: M[Key] extends undefined ? {
121
+ type: Key;
122
+ } : {
123
+ type: Key;
124
+ payload: M[Key];
125
+ };
126
+ };
127
+ export {};