@massimo-cassandro/minimo 1.20.1 → 1.20.2

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.20.1",
3
+ "version": "1.20.2",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -130,7 +130,32 @@ const defaults = {
130
130
  * `ok_btn_class`, `cancel_btn_text`, `cancel_btn_class`, `cancel_focus`, `use_warning_icon`)
131
131
  * are still accepted and internally mapped to their camelCase equivalent, see `legacyParamNames`.
132
132
  *
133
- * @param {ModalAlertParams} params - Dialog parameters (merged with defaults by type).
133
+ * The base param type below is intentionally `object` (not `ModalAlertParams`): TypeScript only
134
+ * expands dotted `@param` properties (needed for editor IntelliSense to list each property) when
135
+ * the base type is the literal `object`; a named typedef there would error (TS8032).
136
+ * @param {object} [params] - Dialog parameters (merged with defaults by type).
137
+ * @param {string} [params.type] - Dialog type: `success`, `error`, `warning`, `info`, or `confirm`.
138
+ * @param {string | null} [params.extraClass] - optional dialog extra class
139
+ * @param {(() => void) | null} [params.onOpen] - optional callback on dialog open
140
+ * @param {(() => void) | null} [params.onClose] - optional callback on dialog close
141
+ * @param {boolean} [params.animation] - if true, dialog will be animated
142
+ * @param {boolean} [params.showMarks] - if true, mark icons will be showed
143
+ * @param {((arg?: *) => void) | null} [params.callback] - optional callback dialog after user choice
144
+ * @param {number | null} [params.timer] - timer for autoclose (ms). `null` for disable
145
+ * @param {string | null} [params.title] - title text
146
+ * @param {string | null} [params.mes] - text message (plain or html)
147
+ * @param {string | null} [params.headingClass] - optional extra class for heading
148
+ * @param {string | null} [params.textClass] - optional extra class for text
149
+ * @param {string | null} [params.icon] - Icon markup used for the dialog; defaults to the type's icon.
150
+ * @param {string | null} [params.altIcon] - Alternate icon markup, used instead of `icon` when `useAltIcon` is `true`.
151
+ * @param {boolean} [params.useAltIcon] - When `true`, uses `altIcon` instead of `icon` (e.g. the `danger` icon on a `warning` dialog, or the `warning` icon on a `confirm` dialog).
152
+ * @param {DomBuilderItem | null} [params.extraBtn] - optional extra button (as domBuilder object)
153
+ * @param {boolean} [params.extraBtnFocus] - true if the extra button should be focused when the dialog box opens (overrides any focus assigned to the 'cancel' button)
154
+ * @param {string} [params.okBtnText] - text for 'ok' button
155
+ * @param {string} [params.okBtnClass] - alternative class for 'ok' button. It replaces the default one
156
+ * @param {string} [params.cancelBtnText] - text for 'cancel' button
157
+ * @param {string} [params.cancelBtnClass] - alternative class for 'cancel' button. It replaces the default one
158
+ * @param {boolean} [params.cancelBtnFocus] - true if the cancel button should be focused when the dialog box opens. It has no effect if an extraBtn is set
134
159
  * @returns {Promise<string | boolean | undefined>} Resolves when the dialog closes. If the
135
160
  * dismissing button has a `data-malert-result` attribute, that string is used; otherwise, for
136
161
  * `confirm` dialogs, resolves `true`/`false` for the OK/Cancel button; otherwise `undefined`.
@@ -55,6 +55,11 @@ import * as styles from './slide-up-down-toggle.module.css';
55
55
  * if omitted the CSS value is used
56
56
  * callback {() => void|null} default null — invoked after the transition ends
57
57
  *
58
+ * Kept here for reference: the three exported functions below re-declare these same properties
59
+ * as dotted `@param` entries with base type `object` instead of `SlideOptions`, since TypeScript
60
+ * only expands dotted `@param` properties (needed for editor IntelliSense to list each property)
61
+ * when the base type is the literal `object`; a named typedef there would error (TS8032).
62
+ *
58
63
  * ─── Return value ─────────────────────────────────────────────────────────────
59
64
  *
60
65
  * All three functions return a Promise<void> that resolves when the transition ends.
@@ -194,7 +199,10 @@ export function disposeSliding(target) {
194
199
  * CSS animates height to 0, then snaps display to none.
195
200
  *
196
201
  * @param {HTMLElement} target
197
- * @param {SlideOptions} [options]
202
+ * @param {object} [options]
203
+ * @param {boolean} [options.wrap=true] - auto-generates a wrapper `<div class="slide">` around `target` (see module docs above); when `false`, the `.slide` class is added directly to `target`.
204
+ * @param {number} [options.duration] - overrides the `--slide-duration` CSS var (ms); if omitted, the CSS value is used.
205
+ * @param {(() => void) | null} [options.callback] - invoked after the transition ends.
198
206
  * @returns {Promise<void>}
199
207
  */
200
208
  export async function slideUp(target, options = {}) {
@@ -210,7 +218,10 @@ export async function slideUp(target, options = {}) {
210
218
  * display snaps to block, then CSS animates height from 0 (via @starting-style) to auto.
211
219
  *
212
220
  * @param {HTMLElement} target
213
- * @param {SlideOptions} [options]
221
+ * @param {object} [options]
222
+ * @param {boolean} [options.wrap=true] - auto-generates a wrapper `<div class="slide">` around `target` (see module docs above); when `false`, the `.slide` class is added directly to `target`.
223
+ * @param {number} [options.duration] - overrides the `--slide-duration` CSS var (ms); if omitted, the CSS value is used.
224
+ * @param {(() => void) | null} [options.callback] - invoked after the transition ends.
214
225
  * @returns {Promise<void>}
215
226
  */
216
227
  export async function slideDown(target, options = {}) {
@@ -226,7 +237,10 @@ export async function slideDown(target, options = {}) {
226
237
  * Reads the current data-slide value on the slide element to decide direction.
227
238
  *
228
239
  * @param {HTMLElement} target
229
- * @param {SlideOptions} [options]
240
+ * @param {object} [options]
241
+ * @param {boolean} [options.wrap=true] - auto-generates a wrapper `<div class="slide">` around `target` (see module docs above); when `false`, the `.slide` class is added directly to `target`.
242
+ * @param {number} [options.duration] - overrides the `--slide-duration` CSS var (ms); if omitted, the CSS value is used.
243
+ * @param {(() => void) | null} [options.callback] - invoked after the transition ends.
230
244
  * @returns {Promise<void>}
231
245
  */
232
246
  export async function slideToggle(target, options = {}) {
@@ -23,8 +23,22 @@
23
23
  * Returns an HTML `<time>` element string displaying the date in relative or absolute form.
24
24
  * Relative dates are auto-refreshed every minute via a shared `setInterval`.
25
25
  *
26
+ * The base param type below is intentionally `object` (not `RelativeDateOptions`): TypeScript only
27
+ * expands dotted `@param` properties (needed for editor IntelliSense to list each property) when
28
+ * the base type is the literal `object`; a named typedef there would error (TS8032).
26
29
  * @param {Date | string} date - Date to display (Date object or ISO string)
27
- * @param {RelativeDateOptions} [options={}]
30
+ * @param {object} [options={}]
31
+ * @param {boolean} [options.useRelativeTime=true] - Show times near the date as "in xx minutes" (before) or "now" (within `relativeTimeMinutesAfter`)
32
+ * @param {string} [options.nowString] - String to display when the date is right now
33
+ * @param {number} [options.relativeTimeMinutesBefore] - Minutes before the date within which to show "in xx minutes"
34
+ * @param {number} [options.relativeTimeMinutesAfter] - Minutes after the date within which to show the now string
35
+ * @param {boolean} [options.relativeTimeShowTime] - Show the actual time alongside relative date labels
36
+ * @param {string} [options.relativeTimeShowTimeMarkup] - HTML markup for the time portion; `@@time@@` is replaced with the localized time string
37
+ * @param {boolean} [options.firstLetterUpperCase] - Capitalize the first letter of the returned string
38
+ * @param {Intl.DateTimeFormatOptions} [options.dateFormat] - Format for non-relative dates (beyond day after tomorrow)
39
+ * @param {Intl.DateTimeFormatOptions} [options.timeFormat] - Format for time displayed in relative date labels
40
+ * @param {string[]} [options.relativeStrings] - Labels for yesterday / today / tomorrow / day after tomorrow (in chronological order)
41
+ * @param {string} [options.locale] - Locale string for date/time formatting
28
42
  * @returns {string} HTML `<time>` element as a string
29
43
  *
30
44
  * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat