@hyperspan/framework 1.0.14 → 1.0.15

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": "@hyperspan/framework",
3
- "version": "1.0.14",
3
+ "version": "1.0.15",
4
4
  "description": "Hyperspan Web Framework",
5
5
  "main": "src/server.ts",
6
6
  "types": "src/server.ts",
@@ -73,7 +73,7 @@
73
73
  "typescript": "^5.9.3"
74
74
  },
75
75
  "dependencies": {
76
- "@hyperspan/html": "^1.0.0",
76
+ "@hyperspan/html": "^1.0.1",
77
77
  "debug": "^4.4.3",
78
78
  "isbot": "^5.1.32",
79
79
  "zod": "^4.1.12"
@@ -58,11 +58,19 @@ function formSubmitToRoute(e: Event, form: HTMLFormElement, opts: TFormSubmitOpt
58
58
  const formData = new FormData(form);
59
59
  const formUrl = form.getAttribute('action') || '';
60
60
  const method = form.getAttribute('method')?.toUpperCase() || 'POST';
61
+ const confirmMessage = form.getAttribute('data-confirm') || '';
61
62
  const headers = {
62
63
  Accept: 'text/html',
63
64
  'X-Request-Type': 'partial',
64
65
  };
65
66
 
67
+ if (confirmMessage) {
68
+ const confirmed = window.confirm(confirmMessage);
69
+ if (!confirmed) {
70
+ return;
71
+ }
72
+ }
73
+
66
74
  const hsActionTag = form.closest('hs-action');
67
75
  const submitBtn = form.querySelector('button[type=submit],input[type=submit]');
68
76
  if (submitBtn) {
@@ -92,6 +100,13 @@ function formSubmitToRoute(e: Event, form: HTMLFormElement, opts: TFormSubmitOpt
92
100
  const target = content.includes('<html') ? window.document.body : hsActionTag || form;
93
101
 
94
102
  Idiomorph.morph(target, content, { morphStyle: 'innerHTML' });
103
+
104
+ // Check for nested hs-action elements and remove them if present
105
+ const outerElement = target.querySelector('hs-action');
106
+ if (outerElement) {
107
+ outerElement.replaceWith(...outerElement.childNodes);
108
+ }
109
+
95
110
  opts.afterResponse && opts.afterResponse();
96
111
  lazyLoadScripts();
97
112
  });