Skip to content

Commit 4756ede

Browse files
committed
add tintColor options for prompt buttons
1 parent 07c538d commit 4756ede

File tree

9 files changed

+21
-23
lines changed

9 files changed

+21
-23
lines changed

docs/assets/navigation.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/assets/search.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/classes/Window.html

Lines changed: 3 additions & 5 deletions
Large diffs are not rendered by default.

docs/classes/prompt.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@
2424
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel tsd-member"><a id="isCancellable" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>is<wbr/>Cancellable</span><a href="#isCancellable" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">is<wbr/>Cancellable</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">boolean</span></div><div class="tsd-comment tsd-typography"><p>If true, a &quot;Cancel&quot; button will be included in the dialog. Defaults to <code>true</code>. If the user selects the cancel button, the <code>show()</code> method will return <code>false</code>. If <code>false</code>, no cancel button will be displayed and the user must select one of the button name options.</p>
2525
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel tsd-member"><a id="message" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>message</span><a href="#message" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">message</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>A longer message explaining the purpose of the dialog, if needed.</p>
2626
</div><div class="tsd-comment tsd-typography"></div></section><section class="tsd-panel tsd-member"><a id="title" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>title</span><a href="#title" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3><div class="tsd-signature"><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div><div class="tsd-comment tsd-typography"><p>Short title.</p>
27-
</div><div class="tsd-comment tsd-typography"></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Field</h2><section class="tsd-panel tsd-member"><a id="addButton" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>add<wbr/>Button</span><a href="#addButton" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link" id="addButton.addButton-1"><span class="tsd-kind-call-signature">add<wbr/>Button</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-kind-parameter">value</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">isDefault</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">isDestructive</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#addButton.addButton-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Add a button to the array of buttons to be displayed. All buttons should be created before calling <code>show()</code>.</p>
27+
</div><div class="tsd-comment tsd-typography"></div></section></section><section class="tsd-panel-group tsd-member-group"><h2>Field</h2><section class="tsd-panel tsd-member"><a id="addButton" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>add<wbr/>Button</span><a href="#addButton" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link" id="addButton.addButton-1"><span class="tsd-kind-call-signature">add<wbr/>Button</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-kind-parameter">value</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">isDefault</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">isDestructive</span><span class="tsd-signature-symbol">?</span>, <span class="tsd-kind-parameter">tintColor</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#addButton.addButton-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Add a button to the array of buttons to be displayed. All buttons should be created before calling <code>show()</code>.</p>
2828
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><h5><span class="tsd-kind-parameter">name</span>: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"></div></li><li><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">value</span>: <span class="tsd-signature-type">object</span></h5><div class="tsd-comment tsd-typography"><p>only needed to associate a different value than will be displayed in the button. For example, if you call <code>prompt.addButton(&quot;First Button&quot;, 1)</code>, after calling <code>prompt.show()</code> if that button is pressed, the <code>prompt.buttonPressed</code> will contain the number value <code>1</code>.</p>
2929
</div><div class="tsd-comment tsd-typography"></div></li><li><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">isDefault</span>: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>used to specify a single button which will be pinned to the bottom of the prompt and respond to <code>cmd + return</code> as the default button. If only one button is added to a prompt, it is assumed to be the default.</p>
3030
</div><div class="tsd-comment tsd-typography"></div></li><li><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">isDestructive</span>: <span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>if true, present the button as a destructive action, typically a red button, in the intereface.</p>
31+
</div><div class="tsd-comment tsd-typography"></div></li><li><h5><code class="tsd-tag ts-flagOptional">Optional</code> <span class="tsd-kind-parameter">tintColor</span>: <a href="../types/tintColor.html" class="tsd-signature-type tsd-kind-type-alias">tintColor</a></h5><div class="tsd-comment tsd-typography"><p>Optionally override the default tint color of the button for the purpose of providing visual groupings. Tint colors are drawn from the current theme in use.</p>
3132
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">void</span></h4><div class="tsd-comment tsd-typography"></div></li></ul></section><section class="tsd-panel tsd-member"><a id="addDatePicker" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>add<wbr/>Date<wbr/>Picker</span><a href="#addDatePicker" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class="tsd-signature tsd-anchor-link" id="addDatePicker.addDatePicker-1"><span class="tsd-kind-call-signature">add<wbr/>Date<wbr/>Picker</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">name</span>, <span class="tsd-kind-parameter">label</span>, <span class="tsd-kind-parameter">initialDate</span>, <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">?</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">void</span><a href="#addDatePicker.addDatePicker-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24"><use href="#icon-anchor"></use></svg></a></li><li class="tsd-description"><div class="tsd-comment tsd-typography"><p>Add a date and/or time picker to the prompt, with the arguments as below. The <code>fieldValues</code> entry for this will be a date object.</p>
3233
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><h5><span class="tsd-kind-parameter">name</span>: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>Identifier for the field. This will be used as the key in the <code>fieldValues</code> dictionary to access the contents of the field after calling <code>show()</code>.</p>
3334
</div><div class="tsd-comment tsd-typography"></div></li><li><h5><span class="tsd-kind-parameter">label</span>: <span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>User-friendly text label to place next to the field.</p>

docs/drafts-definitions.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,6 +4312,8 @@ type keyboardTypes =
43124312

43134313
type capitalizationTypes = 'none' | 'sentences' | 'words'
43144314

4315+
type tintColor = 'gray' | 'red' | 'pink' | 'orange' | 'yellow' | 'green' |'blue' | 'indigo' | 'violet'
4316+
43154317
/**
43164318
* Prompts allow the creation and display of custom dialogs to request information or confirmation from the user.
43174319
*
@@ -4537,9 +4539,10 @@ declare class Prompt {
45374539
* @param value only needed to associate a different value than will be displayed in the button. For example, if you call `prompt.addButton("First Button", 1)`, after calling `prompt.show()` if that button is pressed, the `prompt.buttonPressed` will contain the number value `1`.
45384540
* @param isDefault used to specify a single button which will be pinned to the bottom of the prompt and respond to `cmd + return` as the default button. If only one button is added to a prompt, it is assumed to be the default.
45394541
* @param isDestructive if true, present the button as a destructive action, typically a red button, in the intereface.
4542+
* @param tintColor Optionally override the default tint color of the button for the purpose of providing visual groupings. Tint colors are drawn from the current theme in use.
45404543
* @category Field
45414544
*/
4542-
addButton(name: string, value?: object, isDefault?: boolean, isDestructive?: boolean): void
4545+
addButton(name: string, value?: object, isDefault?: boolean, isDestructive?: boolean, tintColor?: tintColor): void
45434546

45444547
/**
45454548
* Displays the prompt. Returns `true` if the user selected one of the buttons in the buttons array, `false` if the user selected the "Cancel" button. After the dialog has been shown, the `buttonPressed` property will contain the name of the button selected by the user.
@@ -5601,12 +5604,6 @@ declare class Window {
56015604
* @category Interface
56025605
*/
56035606
loadActionBarGroup(actionGroup: ActionGroup): boolean
5604-
5605-
/**
5606-
* @deprecated replaced by `loadActionBarGroup`.
5607-
* @category Deprecated
5608-
*/
5609-
loadKeyboardActionGroup(actionGroup: ActionGroup): boolean
56105607
}
56115608
/**
56125609
* Script integration with WordPress sites via the [WordPress XML-RPC API](https://codex.wordpress.org/XML-RPC_WordPress_API). Currently this object has one runMethod function which can be used to call any method available in the XML-RPC interface.

docs/modules.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
<a href="types/syntaxType.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2097152"></use></svg><span>syntax<wbr/>Type</span></a>
9191
<a href="types/textRange.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2097152"></use></svg><span>text<wbr/>Range</span></a>
9292
<a href="types/themeType.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2097152"></use></svg><span>theme<wbr/>Type</span></a>
93+
<a href="types/tintColor.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-2097152"></use></svg><span>tint<wbr/>Color</span></a>
9394
<a href="variables/action-1.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-32"></use></svg><span>action</span></a>
9495
<a href="variables/app-1.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-32"></use></svg><span>app</span></a>
9596
<a href="variables/context-1.html" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24"><use href="#icon-32"></use></svg><span>context</span></a>

docs/types/tintColor.html

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

src-individual/Prompt.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ type keyboardTypes =
1111

1212
type capitalizationTypes = 'none' | 'sentences' | 'words'
1313

14+
type tintColor = 'gray' | 'red' | 'pink' | 'orange' | 'yellow' | 'green' |'blue' | 'indigo' | 'violet'
15+
1416
/**
1517
* Prompts allow the creation and display of custom dialogs to request information or confirmation from the user.
1618
*
@@ -236,9 +238,10 @@ declare class Prompt {
236238
* @param value only needed to associate a different value than will be displayed in the button. For example, if you call `prompt.addButton("First Button", 1)`, after calling `prompt.show()` if that button is pressed, the `prompt.buttonPressed` will contain the number value `1`.
237239
* @param isDefault used to specify a single button which will be pinned to the bottom of the prompt and respond to `cmd + return` as the default button. If only one button is added to a prompt, it is assumed to be the default.
238240
* @param isDestructive if true, present the button as a destructive action, typically a red button, in the intereface.
241+
* @param tintColor Optionally override the default tint color of the button for the purpose of providing visual groupings. Tint colors are drawn from the current theme in use.
239242
* @category Field
240243
*/
241-
addButton(name: string, value?: object, isDefault?: boolean, isDestructive?: boolean): void
244+
addButton(name: string, value?: object, isDefault?: boolean, isDestructive?: boolean, tintColor?: tintColor): void
242245

243246
/**
244247
* Displays the prompt. Returns `true` if the user selected one of the buttons in the buttons array, `false` if the user selected the "Cancel" button. After the dialog has been shown, the `buttonPressed` property will contain the name of the button selected by the user.

src/drafts.d.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4312,6 +4312,8 @@ type keyboardTypes =
43124312

43134313
type capitalizationTypes = 'none' | 'sentences' | 'words'
43144314

4315+
type tintColor = 'gray' | 'red' | 'pink' | 'orange' | 'yellow' | 'green' |'blue' | 'indigo' | 'violet'
4316+
43154317
/**
43164318
* Prompts allow the creation and display of custom dialogs to request information or confirmation from the user.
43174319
*
@@ -4537,9 +4539,10 @@ declare class Prompt {
45374539
* @param value only needed to associate a different value than will be displayed in the button. For example, if you call `prompt.addButton("First Button", 1)`, after calling `prompt.show()` if that button is pressed, the `prompt.buttonPressed` will contain the number value `1`.
45384540
* @param isDefault used to specify a single button which will be pinned to the bottom of the prompt and respond to `cmd + return` as the default button. If only one button is added to a prompt, it is assumed to be the default.
45394541
* @param isDestructive if true, present the button as a destructive action, typically a red button, in the intereface.
4542+
* @param tintColor Optionally override the default tint color of the button for the purpose of providing visual groupings. Tint colors are drawn from the current theme in use.
45404543
* @category Field
45414544
*/
4542-
addButton(name: string, value?: object, isDefault?: boolean, isDestructive?: boolean): void
4545+
addButton(name: string, value?: object, isDefault?: boolean, isDestructive?: boolean, tintColor?: tintColor): void
45434546

45444547
/**
45454548
* Displays the prompt. Returns `true` if the user selected one of the buttons in the buttons array, `false` if the user selected the "Cancel" button. After the dialog has been shown, the `buttonPressed` property will contain the name of the button selected by the user.
@@ -5601,12 +5604,6 @@ declare class Window {
56015604
* @category Interface
56025605
*/
56035606
loadActionBarGroup(actionGroup: ActionGroup): boolean
5604-
5605-
/**
5606-
* @deprecated replaced by `loadActionBarGroup`.
5607-
* @category Deprecated
5608-
*/
5609-
loadKeyboardActionGroup(actionGroup: ActionGroup): boolean
56105607
}
56115608
/**
56125609
* Script integration with WordPress sites via the [WordPress XML-RPC API](https://codex.wordpress.org/XML-RPC_WordPress_API). Currently this object has one runMethod function which can be used to call any method available in the XML-RPC interface.

0 commit comments

Comments
 (0)