@massimo-cassandro/minimo 1.21.5 → 1.21.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "1.21.5",
3
+ "version": "1.21.6",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -88,8 +88,8 @@
88
88
  }
89
89
  },
90
90
  "devDependencies": {
91
- "@massimo-cassandro/eslint-config": "^3.0.13",
92
- "@massimo-cassandro/stylelint-config": "^2.3.13",
91
+ "@massimo-cassandro/eslint-config": "^3.0.14",
92
+ "@massimo-cassandro/stylelint-config": "^2.3.14",
93
93
  "@types/node": "^26.2.0",
94
94
  "jsdom": "^29.1.1",
95
95
  "style-dictionary": "^5.5.1"
@@ -54,8 +54,9 @@ function closeDialog(el) {
54
54
  * @param {string | number | null} [params.dialogMaxHeight=null] - optional dialog max-height value - if set, overrides main css custom prop
55
55
  * @param {string | null} [params.iframeUrl=null] - URL to load in an iframe.
56
56
  * @param {string | null} [params.ajaxUrl=null] - URL for Ajax content loading.
57
+ * @param {((el: HTMLDialogElement) => void) | null} [params.openCallback=null] - Called with the dialog element after opening, receives the dialog element (`openCallback(dialogEl)`).
58
+ * @param {((el: HTMLDialogElement) => void) | null} [params.closeCallback=null] - Called with the dialog element just before it is removed, receives the dialog element (`closeCallback(dialogEl)`). NB: `dialogEl` is removed immediately after closing.
57
59
  * @param {((data: *, el: Element) => void) | null} [params.ajaxCallback=null] - Called with the Ajax response and the content element.
58
- * @param {((el: HTMLDialogElement) => void) | null} [params.closeCallback=null] - Called with the dialog element just before it is removed.
59
60
  * @param {boolean} [params.addScrollbarPadding=false] - Adds right padding to compensate for the scrollbar.
60
61
  * @param {string | DomBuilderItem[] | null} [params.headerContent=null] - Header content: plain text, HTML, or a domBuilder array.
61
62
  * @param {string | DomBuilderItem[] | null} [params.footerContent=null] - Footer content: plain text, HTML, or a domBuilder array.
@@ -93,10 +94,7 @@ export function modalPopup({
93
94
  ajaxUrl = null,
94
95
  ajaxCallback = null,
95
96
 
96
- /** optional callback invoked when the dialog closes;
97
- * receives the dialog element (`closeCallback(dialogEl)`)
98
- * NB: `dialogEl` is removed immediately after
99
- */
97
+ openCallback = null,
100
98
  closeCallback = null,
101
99
  addScrollbarPadding = false, // adds extra right padding to compensate for the scrollbar
102
100
 
@@ -261,6 +259,10 @@ export function modalPopup({
261
259
  // snapshot: dialogEl could be overwritten by a subsequent modalPopup call
262
260
  const thisDialog = /** @type {HTMLDialogElement} */ (dialogEl);
263
261
 
262
+ if(openCallback) {
263
+ openCallback(thisDialog);
264
+ }
265
+
264
266
  // close button listener
265
267
  thisDialog.querySelector(`.${styles.closeButton}`)?.addEventListener('click', () => {
266
268
  closeDialog(thisDialog);