intelliwaketssveltekitv25 0.1.106 → 0.1.107

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.
@@ -136,6 +136,14 @@ export declare function nextPrevArrows(el: HTMLElement, prePost?: TNextPrevArrow
136
136
  export declare function textAreaAltEnter(el: HTMLTextAreaElement): {
137
137
  destroy(): void;
138
138
  };
139
+ /**
140
+ * A Svelte "Use Action" for a <textarea> object that stops propagation of the Enter key />
141
+ *
142
+ * @param el
143
+ */
144
+ export declare function textEnterStopPropagation(el: HTMLTextAreaElement): {
145
+ destroy(): void;
146
+ };
139
147
  export type TErrorMessageStack = {
140
148
  message: string;
141
149
  stack: string;
package/dist/Functions.js CHANGED
@@ -36,7 +36,7 @@ export const IsMetaKey = (e) => e.ctrlKey ||
36
36
  'Enter'
37
37
  ].includes(e.key);
38
38
  export const CaptureGPS = () => {
39
- return new Promise(resolve => {
39
+ return new Promise((resolve) => {
40
40
  if (navigator.geolocation) {
41
41
  navigator.geolocation.getCurrentPosition(function (position) {
42
42
  resolve(position);
@@ -237,7 +237,7 @@ export function upDownArrows(el, prePost) {
237
237
  let preID = prePost?.preID;
238
238
  if (!preID) {
239
239
  const listLength = prePost?.list?.length ?? 0;
240
- const currentIdx = (prePost?.list ?? []).findIndex(item => item.id == currentID);
240
+ const currentIdx = (prePost?.list ?? []).findIndex((item) => item.id == currentID);
241
241
  if (currentIdx === 0) {
242
242
  preID = CleanNumberNull((prePost?.list ?? [])[listLength - 1]?.id);
243
243
  }
@@ -262,7 +262,7 @@ export function upDownArrows(el, prePost) {
262
262
  let postID = prePost?.postID;
263
263
  if (!postID) {
264
264
  const listLength = prePost?.list?.length ?? 0;
265
- const currentIdx = (prePost?.list ?? []).findIndex(item => item.id == currentID);
265
+ const currentIdx = (prePost?.list ?? []).findIndex((item) => item.id == currentID);
266
266
  if (currentIdx === listLength - 1) {
267
267
  postID = CleanNumberNull((prePost?.list ?? [])[0]?.id);
268
268
  }
@@ -323,7 +323,9 @@ export function nextPrevArrows(el, prePost) {
323
323
  const currentField = components.slice(1).join('_');
324
324
  const currentID = CleanNumberNull(components.shift());
325
325
  if (currentID !== null && !!currentField) {
326
- const preField = prePost?.preField ?? (prePost?.fieldList ?? [])[(prePost?.fieldList?.indexOf(currentField) ?? -2) - 1] ?? (prePost?.fieldList ?? [])[(prePost?.fieldList ?? []).length - 1];
326
+ const preField = prePost?.preField ??
327
+ (prePost?.fieldList ?? [])[(prePost?.fieldList?.indexOf(currentField) ?? -2) - 1] ??
328
+ (prePost?.fieldList ?? [])[(prePost?.fieldList ?? []).length - 1];
327
329
  if (preField) {
328
330
  const element = document.getElementById(`${currentID}_${preField}`);
329
331
  if (element) {
@@ -341,7 +343,9 @@ export function nextPrevArrows(el, prePost) {
341
343
  const currentField = components.slice(1).join('_');
342
344
  const currentID = CleanNumberNull(components.shift());
343
345
  if (currentID !== null && !!currentField) {
344
- const postField = prePost?.postField ?? (prePost?.fieldList ?? [])[(prePost?.fieldList?.indexOf(currentField) ?? -2) + 1] ?? (prePost?.fieldList ?? [])[0];
346
+ const postField = prePost?.postField ??
347
+ (prePost?.fieldList ?? [])[(prePost?.fieldList?.indexOf(currentField) ?? -2) + 1] ??
348
+ (prePost?.fieldList ?? [])[0];
345
349
  if (postField) {
346
350
  const element = document.getElementById(`${currentID}_${postField}`);
347
351
  if (element) {
@@ -381,7 +385,7 @@ export function textAreaAltEnter(el) {
381
385
  const text = e.target.value;
382
386
  const before = text.substring(0, start);
383
387
  const after = text.substring(end, text.length);
384
- el.value = (before + '\r\n' + after);
388
+ el.value = before + '\r\n' + after;
385
389
  el.selectionStart = el.selectionEnd = start + 1;
386
390
  e.target.blur();
387
391
  e.target.focus();
@@ -389,7 +393,12 @@ export function textAreaAltEnter(el) {
389
393
  }
390
394
  };
391
395
  const handleKeyDown = (e) => {
392
- if (!!e.target && !!e.target.form && e.key === 'Enter' && !e.altKey && !e.ctrlKey && !e.shiftKey) {
396
+ if (!!e.target &&
397
+ !!e.target.form &&
398
+ e.key === 'Enter' &&
399
+ !e.altKey &&
400
+ !e.ctrlKey &&
401
+ !e.shiftKey) {
393
402
  e.preventDefault();
394
403
  e.target.form.dispatchEvent(new Event('submit', { cancelable: true }));
395
404
  }
@@ -405,6 +414,26 @@ export function textAreaAltEnter(el) {
405
414
  }
406
415
  };
407
416
  }
417
+ /**
418
+ * A Svelte "Use Action" for a <textarea> object that stops propagation of the Enter key />
419
+ *
420
+ * @param el
421
+ */
422
+ export function textEnterStopPropagation(el) {
423
+ const handleKeyDown = (e) => {
424
+ if (!!e.target && e.key === 'Enter') {
425
+ e.stopPropagation();
426
+ }
427
+ };
428
+ // el.addEventListener('focus', handleFocus)
429
+ el.addEventListener('keydown', handleKeyDown);
430
+ return {
431
+ destroy() {
432
+ // el.removeEventListener('focus', handleFocus)
433
+ el.removeEventListener('keydown', handleKeyDown);
434
+ }
435
+ };
436
+ }
408
437
  export const ErrorMessageStack = (e) => ({
409
438
  message: e?.message ?? e?.error?.message ?? e?.reason?.message ?? 'Unknown message',
410
439
  stack: e?.stack ?? e?.error?.stack ?? e?.reason?.stack ?? 'Unknown stack'
@@ -419,8 +448,7 @@ export function selectOnFocus(el) {
419
448
  let okToSelect = true;
420
449
  const handleFocus = async () => {
421
450
  okToSelect = true;
422
- await tick()
423
- .then(() => setTimeout(() => {
451
+ await tick().then(() => setTimeout(() => {
424
452
  if (okToSelect && el && typeof el.select === 'function') {
425
453
  el.select();
426
454
  }
@@ -448,13 +476,13 @@ export function clickSubmitOnChange(el) {
448
476
  let firing = false;
449
477
  const submitButton = el.querySelector('button[type="submit"]') ?? el.querySelector('button:not([type])');
450
478
  const handleChange = async () => {
451
- await tick()
452
- .then(() => {
479
+ await tick().then(() => {
453
480
  if (!firing) {
454
481
  if (submitButton) {
455
482
  submitButton.click();
456
483
  }
457
484
  else {
485
+ ;
458
486
  el.requestSubmit();
459
487
  }
460
488
  }
@@ -471,6 +499,7 @@ export function clickSubmitOnChange(el) {
471
499
  submitButton.click();
472
500
  }
473
501
  else {
502
+ ;
474
503
  el.requestSubmit();
475
504
  }
476
505
  }
@@ -494,13 +523,13 @@ export function clickSubmitOnFocusOut(el) {
494
523
  let firing = false;
495
524
  const submitButton = el.querySelector('button[type="submit"]') ?? el.querySelector('button:not([type])');
496
525
  const handleFocusOut = async () => {
497
- await tick()
498
- .then(() => {
526
+ await tick().then(() => {
499
527
  if (!firing) {
500
528
  if (submitButton) {
501
529
  submitButton.click();
502
530
  }
503
531
  else {
532
+ ;
504
533
  el.requestSubmit();
505
534
  }
506
535
  }
@@ -517,6 +546,7 @@ export function clickSubmitOnFocusOut(el) {
517
546
  submitButton.click();
518
547
  }
519
548
  else {
549
+ ;
520
550
  el.requestSubmit();
521
551
  }
522
552
  }
@@ -558,7 +588,8 @@ export async function setSearchParam(key, value) {
558
588
  * @returns {boolean} True if the device is a mobile or tablet device, false otherwise.
559
589
  */
560
590
  export function IsMobileOrTablet() {
561
- return browser && /Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
591
+ return (browser &&
592
+ /Mobi|Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
562
593
  }
563
594
  /**
564
595
  * Downloads a given string as a file with the specified filename.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "intelliwaketssveltekitv25",
3
- "version": "0.1.106",
3
+ "version": "0.1.107",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.ts",