@yuneta/gobj-ui 5.11.0 → 5.11.1

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.
@@ -3212,6 +3212,33 @@ function yui_shell_confirm_yesno(shell, message, opts) {
3212
3212
  value: "no"
3213
3213
  }], opts).then((v) => v === "yes");
3214
3214
  }
3215
+ /***************************************************************
3216
+ * A DESTRUCTIVE confirmation: the button that does the damage is
3217
+ * red, not blue.
3218
+ *
3219
+ * yui_shell_confirm_yesno() puts its yes in `is-link`, which is
3220
+ * the right colour for "do you want to continue" and the wrong
3221
+ * one for "this deletes an account": the two read the same at a
3222
+ * glance, and the destructive one is the one that must not be
3223
+ * clicked by reflex. The safe answer is also the LAST button,
3224
+ * so Escape, the backdrop and the X all resolve to it.
3225
+ *
3226
+ * Returns a Promise<boolean>: true only if the red button was
3227
+ * pressed.
3228
+ ***************************************************************/
3229
+ function yui_shell_confirm_danger(shell, message, opts) {
3230
+ let confirm_label = opts && opts.confirm_label || "Delete";
3231
+ let cancel_label = opts && opts.cancel_label || "Cancel";
3232
+ if (!opts || !opts.type) opts = Object.assign({}, opts, { type: "danger" });
3233
+ return build_dialog(shell, message, [{
3234
+ label: confirm_label,
3235
+ value: "confirm",
3236
+ kind: "danger"
3237
+ }, {
3238
+ label: cancel_label,
3239
+ value: "cancel"
3240
+ }], opts).then((v) => v === "confirm");
3241
+ }
3215
3242
  function yui_shell_confirm_yesnocancel(shell, message, opts) {
3216
3243
  let yes_label = opts && opts.yes_label || "Yes";
3217
3244
  let no_label = opts && opts.no_label || "No";
@@ -53796,6 +53823,7 @@ exports.yui_is_dark = yui_is_dark;
53796
53823
  exports.yui_mount_service_view = yui_mount_service_view;
53797
53824
  exports.yui_shell_close_drawer = yui_shell_close_drawer;
53798
53825
  exports.yui_shell_close_dropdown = yui_shell_close_dropdown;
53826
+ exports.yui_shell_confirm_danger = yui_shell_confirm_danger;
53799
53827
  exports.yui_shell_confirm_ok = yui_shell_confirm_ok;
53800
53828
  exports.yui_shell_confirm_yesno = yui_shell_confirm_yesno;
53801
53829
  exports.yui_shell_confirm_yesnocancel = yui_shell_confirm_yesnocancel;
@@ -3207,6 +3207,33 @@ function yui_shell_confirm_yesno(shell, message, opts) {
3207
3207
  value: "no"
3208
3208
  }], opts).then((v) => v === "yes");
3209
3209
  }
3210
+ /***************************************************************
3211
+ * A DESTRUCTIVE confirmation: the button that does the damage is
3212
+ * red, not blue.
3213
+ *
3214
+ * yui_shell_confirm_yesno() puts its yes in `is-link`, which is
3215
+ * the right colour for "do you want to continue" and the wrong
3216
+ * one for "this deletes an account": the two read the same at a
3217
+ * glance, and the destructive one is the one that must not be
3218
+ * clicked by reflex. The safe answer is also the LAST button,
3219
+ * so Escape, the backdrop and the X all resolve to it.
3220
+ *
3221
+ * Returns a Promise<boolean>: true only if the red button was
3222
+ * pressed.
3223
+ ***************************************************************/
3224
+ function yui_shell_confirm_danger(shell, message, opts) {
3225
+ let confirm_label = opts && opts.confirm_label || "Delete";
3226
+ let cancel_label = opts && opts.cancel_label || "Cancel";
3227
+ if (!opts || !opts.type) opts = Object.assign({}, opts, { type: "danger" });
3228
+ return build_dialog(shell, message, [{
3229
+ label: confirm_label,
3230
+ value: "confirm",
3231
+ kind: "danger"
3232
+ }, {
3233
+ label: cancel_label,
3234
+ value: "cancel"
3235
+ }], opts).then((v) => v === "confirm");
3236
+ }
3210
3237
  function yui_shell_confirm_yesnocancel(shell, message, opts) {
3211
3238
  let yes_label = opts && opts.yes_label || "Yes";
3212
3239
  let no_label = opts && opts.no_label || "No";
@@ -53717,6 +53744,6 @@ function setup_frontend_view(self) {
53717
53744
  return win;
53718
53745
  }
53719
53746
  //#endregion
53720
- export { EditControl, MarkerControl, YUI_PERIODS, YUI_PERIODS_DEFAULT, YUI_ROLLING, addClasses, apply_dev_traces, attach_clear, build_dev_panel, dev_window_was_open, disableElements, enableElements, epoch_to_local_input, epoch_to_ms, expose_view_container, fmt_epoch, getStrokeColor, infer_period, info_traffic, inject_svg_icons, is_current_period, iso_week, local_input_to_epoch, ms_to_epoch, period_bounds, period_bounds_epoch, period_label, period_name, period_shift, period_spec, period_start, refresh_clear, register_c_g6_nodes_tree, register_c_yui_form, register_c_yui_gobj_tree_js, register_c_yui_json, register_c_yui_json_graph, register_c_yui_map, register_c_yui_nav, register_c_yui_pager, register_c_yui_period, register_c_yui_service_view, register_c_yui_shell, register_c_yui_treedb_graph, register_c_yui_treedb_schema, register_c_yui_treedb_topic_with_form, register_c_yui_treedb_topics, register_c_yui_uplot, register_c_yui_window, register_c_yui_window_manager, register_c_yui_wizard, removeChildElements, removeClasses, rolling_bounds, safe_locale, set_active_state, set_cancel_state, set_submit_state, setup_dev, setup_frontend_view, toggleClasses, yui_is_dark, yui_mount_service_view, yui_shell_close_drawer, yui_shell_close_dropdown, yui_shell_confirm_ok, yui_shell_confirm_yesno, yui_shell_confirm_yesnocancel, yui_shell_navigate, yui_shell_open_drawer, yui_shell_overlay_dismissed, yui_shell_pop_escape, yui_shell_push_escape, yui_shell_refresh_avatars, yui_shell_register_event_handler, yui_shell_register_overlay, yui_shell_set_avatar_provider, yui_shell_set_connection_state, yui_shell_set_sub_routes, yui_shell_set_toolbar_item_badge, yui_shell_set_toolbar_item_icon, yui_shell_set_translator, yui_shell_show_error, yui_shell_show_info, yui_shell_show_modal, yui_shell_show_route_map, yui_shell_show_warning, yui_shell_toggle_drawer, yui_shell_unpark_route, yui_theme_now, yui_toolbar, yui_watch_theme };
53747
+ export { EditControl, MarkerControl, YUI_PERIODS, YUI_PERIODS_DEFAULT, YUI_ROLLING, addClasses, apply_dev_traces, attach_clear, build_dev_panel, dev_window_was_open, disableElements, enableElements, epoch_to_local_input, epoch_to_ms, expose_view_container, fmt_epoch, getStrokeColor, infer_period, info_traffic, inject_svg_icons, is_current_period, iso_week, local_input_to_epoch, ms_to_epoch, period_bounds, period_bounds_epoch, period_label, period_name, period_shift, period_spec, period_start, refresh_clear, register_c_g6_nodes_tree, register_c_yui_form, register_c_yui_gobj_tree_js, register_c_yui_json, register_c_yui_json_graph, register_c_yui_map, register_c_yui_nav, register_c_yui_pager, register_c_yui_period, register_c_yui_service_view, register_c_yui_shell, register_c_yui_treedb_graph, register_c_yui_treedb_schema, register_c_yui_treedb_topic_with_form, register_c_yui_treedb_topics, register_c_yui_uplot, register_c_yui_window, register_c_yui_window_manager, register_c_yui_wizard, removeChildElements, removeClasses, rolling_bounds, safe_locale, set_active_state, set_cancel_state, set_submit_state, setup_dev, setup_frontend_view, toggleClasses, yui_is_dark, yui_mount_service_view, yui_shell_close_drawer, yui_shell_close_dropdown, yui_shell_confirm_danger, yui_shell_confirm_ok, yui_shell_confirm_yesno, yui_shell_confirm_yesnocancel, yui_shell_navigate, yui_shell_open_drawer, yui_shell_overlay_dismissed, yui_shell_pop_escape, yui_shell_push_escape, yui_shell_refresh_avatars, yui_shell_register_event_handler, yui_shell_register_overlay, yui_shell_set_avatar_provider, yui_shell_set_connection_state, yui_shell_set_sub_routes, yui_shell_set_toolbar_item_badge, yui_shell_set_toolbar_item_icon, yui_shell_set_translator, yui_shell_show_error, yui_shell_show_info, yui_shell_show_modal, yui_shell_show_route_map, yui_shell_show_warning, yui_shell_toggle_drawer, yui_shell_unpark_route, yui_theme_now, yui_toolbar, yui_watch_theme };
53721
53748
 
53722
53749
  //# sourceMappingURL=gobj-ui.es.js.map
package/index.js CHANGED
@@ -69,6 +69,7 @@ export {
69
69
  yui_shell_confirm_ok,
70
70
  yui_shell_confirm_yesno,
71
71
  yui_shell_confirm_yesnocancel,
72
+ yui_shell_confirm_danger,
72
73
  } from "./src/shell_modals.js";
73
74
 
74
75
  /*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yuneta/gobj-ui",
3
- "version": "5.11.0",
3
+ "version": "5.11.1",
4
4
  "type": "module",
5
5
  "main": "dist/gobj-ui.cjs.js",
6
6
  "module": "dist/gobj-ui.es.js",