@atscript/vue-wf 0.1.68 → 0.1.69

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.
@@ -62,7 +62,7 @@ var as_wf_finish_default = /* @__PURE__ */ defineComponent({
62
62
  }
63
63
  if (action.type === "dismiss") emit("dismiss");
64
64
  }
65
- const end = computed(() => props.payload?.end ?? null);
65
+ const next = computed(() => props.payload?.next ?? null);
66
66
  const message = computed(() => props.payload?.message ?? null);
67
67
  let autoTimer;
68
68
  let countdownInterval;
@@ -81,30 +81,30 @@ var as_wf_finish_default = /* @__PURE__ */ defineComponent({
81
81
  }
82
82
  }
83
83
  function startAutoTimer() {
84
- const e = end.value;
85
- if (!e || e.mode !== "auto") return;
84
+ const n = next.value;
85
+ if (!n || n.trigger !== "auto") return;
86
86
  clearAutoTimers();
87
87
  autoCancelled.value = false;
88
88
  autoStartedAt = Date.now();
89
- totalSeconds.value = Math.ceil(e.timeoutMs / 1e3);
89
+ totalSeconds.value = Math.ceil(n.timeoutMs / 1e3);
90
90
  secondsRemaining.value = totalSeconds.value;
91
91
  autoTimer = setTimeout(() => {
92
92
  clearAutoTimers();
93
- runAction(e.action);
94
- }, e.timeoutMs);
93
+ runAction(n.action);
94
+ }, n.timeoutMs);
95
95
  countdownInterval = setInterval(() => {
96
96
  const elapsed = Date.now() - autoStartedAt;
97
- const remainMs = Math.max(0, e.timeoutMs - elapsed);
98
- const next = Math.ceil(remainMs / 1e3);
99
- if (next !== secondsRemaining.value) secondsRemaining.value = next;
97
+ const remainMs = Math.max(0, n.timeoutMs - elapsed);
98
+ const nextSec = Math.ceil(remainMs / 1e3);
99
+ if (nextSec !== secondsRemaining.value) secondsRemaining.value = nextSec;
100
100
  }, 250);
101
101
  }
102
102
  function skipAuto() {
103
- const e = end.value;
104
- if (!e || e.mode !== "auto") return;
105
- const behavior = e.skipButton?.behavior ?? "now";
103
+ const n = next.value;
104
+ if (!n || n.trigger !== "auto") return;
105
+ const behavior = n.skipButton?.behavior ?? "now";
106
106
  clearAutoTimers();
107
- if (behavior === "now") runAction(e.action);
107
+ if (behavior === "now") runAction(n.action);
108
108
  else autoCancelled.value = true;
109
109
  }
110
110
  function cancelAuto() {
@@ -112,23 +112,23 @@ var as_wf_finish_default = /* @__PURE__ */ defineComponent({
112
112
  autoCancelled.value = true;
113
113
  }
114
114
  function applyMode() {
115
- const e = end.value;
116
- if (!e) return;
117
- if (e.mode === "immediate") {
118
- runAction(e.action);
115
+ const n = next.value;
116
+ if (!n) return;
117
+ if (n.trigger === "immediate") {
118
+ runAction(n.action);
119
119
  return;
120
120
  }
121
- if (e.mode === "auto") startAutoTimer();
121
+ if (n.trigger === "auto") startAutoTimer();
122
122
  }
123
123
  onMounted(() => applyMode());
124
- watch(() => props.payload, (next, prev) => {
125
- if (next === prev) return;
124
+ watch(() => props.payload, (newPayload, prev) => {
125
+ if (newPayload === prev) return;
126
126
  clearAutoTimers();
127
127
  applyMode();
128
128
  });
129
129
  onUnmounted(() => clearAutoTimers());
130
- const manualPrimary = computed(() => end.value?.mode === "manual" ? end.value.primary ?? null : null);
131
- const manualOptions = computed(() => end.value?.mode === "manual" ? end.value.options ?? [] : []);
130
+ const manualPrimary = computed(() => next.value?.trigger === "manual" ? next.value.primary ?? null : null);
131
+ const manualOptions = computed(() => next.value?.trigger === "manual" ? next.value.options ?? [] : []);
132
132
  function onKeydown(ev) {
133
133
  if (ev.key !== "Enter") return;
134
134
  const target = manualPrimary.value ?? manualOptions.value[0] ?? null;
@@ -140,16 +140,16 @@ var as_wf_finish_default = /* @__PURE__ */ defineComponent({
140
140
  runAction(btn.action);
141
141
  }
142
142
  const skipScope = computed(() => {
143
- const e = end.value;
144
- if (e?.mode !== "auto" || !e.skipButton) return null;
145
- const behavior = e.skipButton.behavior ?? "now";
143
+ const n = next.value;
144
+ if (n?.trigger !== "auto" || !n.skipButton) return null;
145
+ const behavior = n.skipButton.behavior ?? "now";
146
146
  return {
147
- label: e.skipButton.label,
147
+ label: n.skipButton.label,
148
148
  behavior
149
149
  };
150
150
  });
151
151
  return (_ctx, _cache) => {
152
- return end.value?.mode === "immediate" ? (openBlock(), createElementBlock("span", _hoisted_1, "Redirecting…")) : (openBlock(), createElementBlock("div", {
152
+ return next.value?.trigger === "immediate" ? (openBlock(), createElementBlock("span", _hoisted_1, "Redirecting…")) : (openBlock(), createElementBlock("div", {
153
153
  key: 1,
154
154
  class: "as-wf-finish",
155
155
  onKeydown
@@ -162,13 +162,13 @@ var as_wf_finish_default = /* @__PURE__ */ defineComponent({
162
162
  "data-level": message.value.level,
163
163
  role: "status"
164
164
  }, toDisplayString(message.value.text), 9, _hoisted_2)]) : createCommentVNode("v-if", true),
165
- end.value?.mode === "auto" && !autoCancelled.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [skipScope.value ? (openBlock(), createElementBlock("div", _hoisted_3, [renderSlot(_ctx.$slots, "skip", {
165
+ next.value?.trigger === "auto" && !autoCancelled.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [skipScope.value ? (openBlock(), createElementBlock("div", _hoisted_3, [renderSlot(_ctx.$slots, "skip", {
166
166
  button: skipScope.value,
167
167
  trigger: skipAuto
168
168
  }, () => [createElementVNode("button", {
169
169
  type: "button",
170
170
  class: "as-wf-finish-skip",
171
- style: normalizeStyle({ "--progress-duration": `${end.value.timeoutMs}ms` }),
171
+ style: normalizeStyle({ "--progress-duration": `${next.value.timeoutMs}ms` }),
172
172
  onClick: skipAuto
173
173
  }, [_cache[1] || (_cache[1] = createElementVNode("span", { class: "as-wf-finish-skip-fill" }, null, -1)), createElementVNode("span", _hoisted_4, toDisplayString(skipScope.value.label), 1)], 4)])])) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "countdown", {
174
174
  secondsRemaining: secondsRemaining.value,
@@ -176,7 +176,7 @@ var as_wf_finish_default = /* @__PURE__ */ defineComponent({
176
176
  skip: skipAuto,
177
177
  cancel: cancelAuto
178
178
  }, () => [createElementVNode("div", _hoisted_5, " Continuing in " + toDisplayString(secondsRemaining.value) + "… ", 1)])], 64)) : createCommentVNode("v-if", true),
179
- end.value?.mode === "manual" ? (openBlock(), createElementBlock("div", _hoisted_6, [manualPrimary.value ? renderSlot(_ctx.$slots, "primary", {
179
+ next.value?.trigger === "manual" ? (openBlock(), createElementBlock("div", _hoisted_6, [manualPrimary.value ? renderSlot(_ctx.$slots, "primary", {
180
180
  key: 0,
181
181
  button: manualPrimary.value,
182
182
  trigger: () => triggerButton(manualPrimary.value)
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-wf-finish.vue-BrMzuLaH.mjs";
1
+ import { t as _default } from "./as-wf-finish.vue-H_xgcelS.mjs";
2
2
  export { _default as default };
@@ -1,2 +1,2 @@
1
- import { t as as_wf_finish_default } from "./as-wf-finish-B7mz8kVT.mjs";
1
+ import { t as as_wf_finish_default } from "./as-wf-finish-CfbsKJhX.mjs";
2
2
  export { as_wf_finish_default as default };
@@ -1,4 +1,4 @@
1
- import { a as WfMessage, n as WfButton, r as WfFinished, t as WfAction } from "./index-KRfH1NOi.mjs";
1
+ import { i as WfMessage, n as WfButton, r as WfFinished, t as WfAction } from "./index-DZLKOai5.mjs";
2
2
  import * as vue from "vue";
3
3
 
4
4
  //#region src/components/defaults/as-wf-finish.vue.d.ts
@@ -1,4 +1,4 @@
1
- import { t as as_wf_finish_default } from "./as-wf-finish-B7mz8kVT.mjs";
1
+ import { t as as_wf_finish_default } from "./as-wf-finish-CfbsKJhX.mjs";
2
2
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, guardReactiveProps, normalizeProps, onMounted, onUnmounted, openBlock, reactive, ref, renderSlot, shallowRef, toDisplayString, toRaw, unref, watch, withCtx } from "vue";
3
3
  import { WF_ACTION_WITH_DATA, createFormData, createFormDef, getFieldMeta } from "@atscript/ui";
4
4
  import { deserializeAnnotatedType } from "@atscript/typescript/utils";
@@ -1,2 +1,2 @@
1
- import { t as _default } from "./as-wf-form.vue-CBujwX55.mjs";
1
+ import { t as _default } from "./as-wf-form.vue-CXAonfNF.mjs";
2
2
  export { _default as default };
@@ -1,3 +1,2 @@
1
- import { t as as_wf_form_default } from "./as-wf-form-5tml-xzd.mjs";
2
- import "./as-wf-finish-B7mz8kVT.mjs";
1
+ import { t as as_wf_form_default } from "./as-wf-form-CwWizwko.mjs";
3
2
  export { as_wf_form_default as default };
@@ -1,4 +1,4 @@
1
- import { a as WfMessage, n as WfButton, r as WfFinished, t as WfAction } from "./index-KRfH1NOi.mjs";
1
+ import { i as WfMessage, n as WfButton, r as WfFinished, t as WfAction } from "./index-DZLKOai5.mjs";
2
2
  import * as vue from "vue";
3
3
  import { Component, Ref, ShallowRef } from "vue";
4
4
  import { ClientFactory, FormDef } from "@atscript/ui";
@@ -3,7 +3,7 @@ interface WfFinished<TData = unknown> {
3
3
  finished: true;
4
4
  data?: TData;
5
5
  message?: WfMessage;
6
- end?: WfFinishedEnd;
6
+ next?: WfNext;
7
7
  aborted?: boolean;
8
8
  reason?: string;
9
9
  }
@@ -11,11 +11,11 @@ interface WfMessage {
11
11
  level: "info" | "success" | "warn" | "error";
12
12
  text: string;
13
13
  }
14
- type WfFinishedEnd = {
15
- mode: "immediate";
14
+ type WfNext = {
15
+ trigger: "immediate";
16
16
  action: WfAction;
17
17
  } | {
18
- mode: "auto";
18
+ trigger: "auto";
19
19
  timeoutMs: number;
20
20
  action: WfAction;
21
21
  skipButton?: {
@@ -23,7 +23,7 @@ type WfFinishedEnd = {
23
23
  behavior?: "now" | "cancel";
24
24
  };
25
25
  } | {
26
- mode: "manual";
26
+ trigger: "manual";
27
27
  primary?: WfButton;
28
28
  options?: WfButton[];
29
29
  };
@@ -41,4 +41,4 @@ type WfAction = {
41
41
  type: "dismiss";
42
42
  };
43
43
  //#endregion
44
- export { WfMessage as a, WfFinishedEnd as i, WfButton as n, WfFinished as r, WfAction as t };
44
+ export { WfNext as a, WfMessage as i, WfButton as n, WfFinished as r, WfAction as t };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as WfMessage, i as WfFinishedEnd, n as WfButton, r as WfFinished, t as WfAction } from "./index-KRfH1NOi.mjs";
2
- import { i as useWfForm, n as UseWfFormOptions, r as UseWfFormReturn, t as _default$1 } from "./as-wf-form.vue-CBujwX55.mjs";
3
- import { t as _default } from "./as-wf-finish.vue-BrMzuLaH.mjs";
4
- export { _default as AsWfFinish, _default$1 as AsWfForm, type UseWfFormOptions, type UseWfFormReturn, type WfAction, type WfButton, type WfFinished, type WfFinishedEnd, type WfMessage, useWfForm };
1
+ import { a as WfNext, i as WfMessage, n as WfButton, r as WfFinished, t as WfAction } from "./index-DZLKOai5.mjs";
2
+ import { i as useWfForm, n as UseWfFormOptions, r as UseWfFormReturn, t as _default$1 } from "./as-wf-form.vue-CXAonfNF.mjs";
3
+ import { t as _default } from "./as-wf-finish.vue-H_xgcelS.mjs";
4
+ export { _default as AsWfFinish, _default$1 as AsWfForm, type UseWfFormOptions, type UseWfFormReturn, type WfAction, type WfButton, type WfFinished, 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-5tml-xzd.mjs";
2
- import { t as as_wf_finish_default } from "./as-wf-finish-B7mz8kVT.mjs";
1
+ import { n as useWfForm, t as as_wf_form_default } from "./as-wf-form-CwWizwko.mjs";
2
+ import { t as as_wf_finish_default } from "./as-wf-finish-CfbsKJhX.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.68",
3
+ "version": "0.1.69",
4
4
  "description": "Workflow form integration for Vue 3 — HTTP round-trip loop driven by atscript type metadata",
5
5
  "keywords": [
6
6
  "atscript",
@@ -50,25 +50,25 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@atscript/ui": "^0.1.68"
53
+ "@atscript/ui": "^0.1.69"
54
54
  },
55
55
  "devDependencies": {
56
- "@atscript/core": "^0.1.56",
57
- "@atscript/typescript": "^0.1.56",
56
+ "@atscript/core": "^0.1.58",
57
+ "@atscript/typescript": "^0.1.58",
58
58
  "@vitejs/plugin-vue": "^6",
59
59
  "@vue/test-utils": "^2",
60
60
  "happy-dom": "^18",
61
- "unplugin-atscript": "^0.1.56",
62
- "vitest": "npm:@voidzero-dev/vite-plus-test@latest",
61
+ "unplugin-atscript": "^0.1.58",
62
+ "vitest": "npm:@voidzero-dev/vite-plus-test@0.1.14",
63
63
  "vue": "^3",
64
64
  "vue-tsc": "^3.2.6",
65
- "@atscript/moost-wf": "^0.1.68",
66
- "@atscript/vue-form": "^0.1.68"
65
+ "@atscript/moost-wf": "^0.1.69",
66
+ "@atscript/vue-form": "^0.1.69"
67
67
  },
68
68
  "peerDependencies": {
69
- "@atscript/typescript": "^0.1.56",
69
+ "@atscript/typescript": "^0.1.58",
70
70
  "vue": "^3",
71
- "@atscript/vue-form": "^0.1.68"
71
+ "@atscript/vue-form": "^0.1.69"
72
72
  },
73
73
  "scripts": {
74
74
  "build": "node ../../scripts/gen-exports.mjs && vp pack",