@atscript/vue-wf 0.1.167 → 0.1.168

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.
@@ -344,10 +344,20 @@ var as_wf_form_default = /* @__PURE__ */ defineComponent({
344
344
  emit("submit", raw);
345
345
  wf.submit(raw);
346
346
  }
347
- function onAction(name, data) {
347
+ const asForm = ref(null);
348
+ /** The form's `action` / `unsupported-action`: it always carries the form's data. */
349
+ function onFormAction(name, data) {
348
350
  if (withDataActions.value.has(name)) wf.actionWithData(name, toRaw(data));
349
351
  else wf.action(name);
350
352
  }
353
+ /**
354
+ * Fired by the host (`ref`, slot): a `withData` action without data is fired
355
+ * by the form with its current data — what its own button sends, normalized.
356
+ */
357
+ function onAction(name, data) {
358
+ if (data === void 0 && asForm.value && withDataActions.value.has(name)) asForm.value.action(name);
359
+ else onFormAction(name, data);
360
+ }
351
361
  /** Whether the current step's form declares this action id (host gating). */
352
362
  function supportsAction(name) {
353
363
  return formActions.value.some((a) => a.id === name);
@@ -421,6 +431,8 @@ var as_wf_form_default = /* @__PURE__ */ defineComponent({
421
431
  error: unref(wf).error.value,
422
432
  retry: unref(wf).retry
423
433
  }, () => [createElementVNode("div", _hoisted_5, toDisplayString(unref(wf).error.value?.message ?? unref(t)("UI_ERROR")), 1)]) : createCommentVNode("v-if", true), (openBlock(), createBlock(unref(AsForm), {
434
+ ref_key: "asForm",
435
+ ref: asForm,
424
436
  key: unref(wf).formKey.value,
425
437
  def: unref(wf).formDef.value,
426
438
  "form-data": unref(wf).formData.value,
@@ -434,8 +446,8 @@ var as_wf_form_default = /* @__PURE__ */ defineComponent({
434
446
  "hide-submit": __props.hideSubmit,
435
447
  loading: unref(wf).loading.value,
436
448
  onSubmit,
437
- onAction,
438
- onUnsupportedAction: onAction
449
+ onAction: onFormAction,
450
+ onUnsupportedAction: onFormAction
439
451
  }, createSlots({ _: 2 }, [
440
452
  _ctx.$slots["form.header"] ? {
441
453
  name: "form.header",
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-wf-form.vue-C1mPDpdy.mjs";
1
+ import { t as _default } from "./as-wf-form.vue-CXYFkkFM.mjs";
2
2
  export { _default as default };
@@ -1,2 +1,2 @@
1
- import { t as as_wf_form_default } from "./as-wf-form-ah0D5Nn1.mjs";
1
+ import { t as as_wf_form_default } from "./as-wf-form-Cb-iyrR8.mjs";
2
2
  export { as_wf_form_default as default };
@@ -106,6 +106,10 @@ interface AsWfFormProps extends UseWfFormOptions {
106
106
  navigate?: (url: string) => void | Promise<void>;
107
107
  }
108
108
  declare function onSubmit(data: unknown): void;
109
+ /**
110
+ * Fired by the host (`ref`, slot): a `withData` action without data is fired
111
+ * by the form with its current data — what its own button sends, normalized.
112
+ */
109
113
  declare function onAction(name: string, data?: unknown): void;
110
114
  /** Whether the current step's form declares this action id (host gating). */
111
115
  declare function supportsAction(name: string): boolean;
@@ -157,7 +161,7 @@ declare var __VLS_1: {
157
161
  }, __VLS_33: {
158
162
  error: {};
159
163
  retry: () => Promise<void>;
160
- }, __VLS_46: {
164
+ }, __VLS_48: {
161
165
  title: string | undefined;
162
166
  description: string | undefined;
163
167
  data: Record<string, unknown>;
@@ -178,7 +182,7 @@ declare var __VLS_1: {
178
182
  getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
179
183
  getChanges: () => _atscript_ui0.FormFieldChange[];
180
184
  isDirtyPath: (path: string) => boolean;
181
- }, __VLS_49: {
185
+ }, __VLS_51: {
182
186
  title: string | undefined;
183
187
  description: string | undefined;
184
188
  data: Record<string, unknown>;
@@ -199,7 +203,7 @@ declare var __VLS_1: {
199
203
  getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
200
204
  getChanges: () => _atscript_ui0.FormFieldChange[];
201
205
  isDirtyPath: (path: string) => boolean;
202
- }, __VLS_52: {
206
+ }, __VLS_54: {
203
207
  title: string | undefined;
204
208
  description: string | undefined;
205
209
  data: Record<string, unknown>;
@@ -220,7 +224,7 @@ declare var __VLS_1: {
220
224
  getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
221
225
  getChanges: () => _atscript_ui0.FormFieldChange[];
222
226
  isDirtyPath: (path: string) => boolean;
223
- }, __VLS_55: {
227
+ }, __VLS_57: {
224
228
  message: string;
225
229
  dismiss: () => void;
226
230
  title: string | undefined;
@@ -243,7 +247,7 @@ declare var __VLS_1: {
243
247
  getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
244
248
  getChanges: () => _atscript_ui0.FormFieldChange[];
245
249
  isDirtyPath: (path: string) => boolean;
246
- }, __VLS_58: {
250
+ }, __VLS_60: {
247
251
  text: string;
248
252
  title: string | undefined;
249
253
  description: string | undefined;
@@ -265,7 +269,7 @@ declare var __VLS_1: {
265
269
  getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
266
270
  getChanges: () => _atscript_ui0.FormFieldChange[];
267
271
  isDirtyPath: (path: string) => boolean;
268
- }, __VLS_61: {
272
+ }, __VLS_63: {
269
273
  title: string | undefined;
270
274
  description: string | undefined;
271
275
  data: Record<string, unknown>;
@@ -286,7 +290,7 @@ declare var __VLS_1: {
286
290
  getPatch: (opts?: _atscript_ui0.FormDiffOptions) => Record<string, unknown>;
287
291
  getChanges: () => _atscript_ui0.FormFieldChange[];
288
292
  isDirtyPath: (path: string) => boolean;
289
- }, __VLS_64: {
293
+ }, __VLS_66: {
290
294
  title: string | undefined;
291
295
  description: string | undefined;
292
296
  data: Record<string, unknown>;
@@ -329,19 +333,19 @@ type __VLS_Slots = {} & {
329
333
  } & {
330
334
  'wf.error'?: (props: typeof __VLS_33) => any;
331
335
  } & {
332
- 'form.header'?: (props: typeof __VLS_46) => any;
336
+ 'form.header'?: (props: typeof __VLS_48) => any;
333
337
  } & {
334
- 'form.before'?: (props: typeof __VLS_49) => any;
338
+ 'form.before'?: (props: typeof __VLS_51) => any;
335
339
  } & {
336
- 'form.after'?: (props: typeof __VLS_52) => any;
340
+ 'form.after'?: (props: typeof __VLS_54) => any;
337
341
  } & {
338
- 'form.error'?: (props: typeof __VLS_55) => any;
342
+ 'form.error'?: (props: typeof __VLS_57) => any;
339
343
  } & {
340
- 'form.submit'?: (props: typeof __VLS_58) => any;
344
+ 'form.submit'?: (props: typeof __VLS_60) => any;
341
345
  } & {
342
- 'form.footer'?: (props: typeof __VLS_61) => any;
346
+ 'form.footer'?: (props: typeof __VLS_63) => any;
343
347
  } & {
344
- 'form.loading'?: (props: typeof __VLS_64) => any;
348
+ 'form.loading'?: (props: typeof __VLS_66) => any;
345
349
  };
346
350
  declare const __VLS_base: vue.DefineComponent<AsWfFormProps, {
347
351
  action: typeof onAction;
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
1
  import { a as WfNext, i as WfMessage, n as WfButton, r as WfFinished, t as WfActionRequest } from "./index-C5MmoWFB.mjs";
2
- import { a as useWfForm, i as WfFormError, n as UseWfFormOptions, r as UseWfFormReturn, t as _default$1 } from "./as-wf-form.vue-C1mPDpdy.mjs";
2
+ import { a as useWfForm, i as WfFormError, n as UseWfFormOptions, r as UseWfFormReturn, t as _default$1 } from "./as-wf-form.vue-CXYFkkFM.mjs";
3
3
  import { t as _default } from "./as-wf-finish.vue-BhXMooP3.mjs";
4
4
  export { _default as AsWfFinish, _default$1 as AsWfForm, type UseWfFormOptions, type UseWfFormReturn, type WfActionRequest, type WfButton, type WfFinished, type WfFormError, type WfMessage, type WfNext, useWfForm };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { n as useWfForm, t as as_wf_form_default } from "./as-wf-form-ah0D5Nn1.mjs";
1
+ import { n as useWfForm, t as as_wf_form_default } from "./as-wf-form-Cb-iyrR8.mjs";
2
2
  import { t as as_wf_finish_default } from "./as-wf-finish-DSlzLuDT.mjs";
3
3
  export { as_wf_finish_default as AsWfFinish, as_wf_form_default as AsWfForm, useWfForm };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/vue-wf",
3
- "version": "0.1.167",
3
+ "version": "0.1.168",
4
4
  "description": "Workflow form integration for Vue 3 — HTTP round-trip loop driven by atscript type metadata",
5
5
  "keywords": [
6
6
  "atscript",
@@ -51,25 +51,25 @@
51
51
  "access": "public"
52
52
  },
53
53
  "dependencies": {
54
- "@atscript/ui": "^0.1.167"
54
+ "@atscript/ui": "^0.1.168"
55
55
  },
56
56
  "devDependencies": {
57
- "@atscript/core": "^0.2.8",
58
- "@atscript/typescript": "^0.2.8",
57
+ "@atscript/core": "^0.2.9",
58
+ "@atscript/typescript": "^0.2.9",
59
59
  "@vitejs/plugin-vue": "^6",
60
60
  "@vue/test-utils": "^2",
61
61
  "happy-dom": "^18",
62
- "unplugin-atscript": "^0.2.8",
62
+ "unplugin-atscript": "^0.2.9",
63
63
  "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14",
64
64
  "vue": "^3",
65
65
  "vue-tsc": "~3.2.9",
66
- "@atscript/moost-wf": "^0.1.167",
67
- "@atscript/vue-form": "^0.1.167"
66
+ "@atscript/moost-wf": "^0.1.168",
67
+ "@atscript/vue-form": "^0.1.168"
68
68
  },
69
69
  "peerDependencies": {
70
- "@atscript/typescript": "^0.2.8",
70
+ "@atscript/typescript": "^0.2.9",
71
71
  "vue": "^3",
72
- "@atscript/vue-form": "^0.1.167"
72
+ "@atscript/vue-form": "^0.1.168"
73
73
  },
74
74
  "scripts": {
75
75
  "build": "node ../../scripts/gen-exports.mjs && vp pack",