@atscript/vue-wf 0.1.67 → 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.
- package/dist/{as-wf-finish-B7mz8kVT.mjs → as-wf-finish-CfbsKJhX.mjs} +30 -30
- package/dist/as-wf-finish.d.mts +1 -1
- package/dist/as-wf-finish.mjs +1 -1
- package/dist/{as-wf-finish.vue-BrMzuLaH.d.mts → as-wf-finish.vue-H_xgcelS.d.mts} +1 -1
- package/dist/{as-wf-form-5tml-xzd.mjs → as-wf-form-CwWizwko.mjs} +1 -1
- package/dist/as-wf-form.d.mts +1 -1
- package/dist/as-wf-form.mjs +1 -2
- package/dist/{as-wf-form.vue-FiaBQQEu.d.mts → as-wf-form.vue-CXAonfNF.d.mts} +7 -7
- package/dist/{index-KRfH1NOi.d.mts → index-DZLKOai5.d.mts} +6 -6
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +2 -2
- package/package.json +10 -10
|
@@ -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
|
|
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
|
|
85
|
-
if (!
|
|
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(
|
|
89
|
+
totalSeconds.value = Math.ceil(n.timeoutMs / 1e3);
|
|
90
90
|
secondsRemaining.value = totalSeconds.value;
|
|
91
91
|
autoTimer = setTimeout(() => {
|
|
92
92
|
clearAutoTimers();
|
|
93
|
-
runAction(
|
|
94
|
-
},
|
|
93
|
+
runAction(n.action);
|
|
94
|
+
}, n.timeoutMs);
|
|
95
95
|
countdownInterval = setInterval(() => {
|
|
96
96
|
const elapsed = Date.now() - autoStartedAt;
|
|
97
|
-
const remainMs = Math.max(0,
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
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
|
|
104
|
-
if (!
|
|
105
|
-
const behavior =
|
|
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(
|
|
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
|
|
116
|
-
if (!
|
|
117
|
-
if (
|
|
118
|
-
runAction(
|
|
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 (
|
|
121
|
+
if (n.trigger === "auto") startAutoTimer();
|
|
122
122
|
}
|
|
123
123
|
onMounted(() => applyMode());
|
|
124
|
-
watch(() => props.payload, (
|
|
125
|
-
if (
|
|
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(() =>
|
|
131
|
-
const manualOptions = computed(() =>
|
|
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
|
|
144
|
-
if (
|
|
145
|
-
const behavior =
|
|
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:
|
|
147
|
+
label: n.skipButton.label,
|
|
148
148
|
behavior
|
|
149
149
|
};
|
|
150
150
|
});
|
|
151
151
|
return (_ctx, _cache) => {
|
|
152
|
-
return
|
|
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
|
-
|
|
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": `${
|
|
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
|
-
|
|
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)
|
package/dist/as-wf-finish.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-wf-finish.vue-
|
|
1
|
+
import { t as _default } from "./as-wf-finish.vue-H_xgcelS.mjs";
|
|
2
2
|
export { _default as default };
|
package/dist/as-wf-finish.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as as_wf_finish_default } from "./as-wf-finish-
|
|
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 {
|
|
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-
|
|
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";
|
package/dist/as-wf-form.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as _default } from "./as-wf-form.vue-
|
|
1
|
+
import { t as _default } from "./as-wf-form.vue-CXAonfNF.mjs";
|
|
2
2
|
export { _default as default };
|
package/dist/as-wf-form.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
@@ -196,26 +196,26 @@ type __VLS_Slots = {} & {
|
|
|
196
196
|
'form.footer'?: (props: typeof __VLS_58) => any;
|
|
197
197
|
};
|
|
198
198
|
declare const __VLS_base: vue.DefineComponent<AsWfFormProps, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
|
|
199
|
-
|
|
199
|
+
dismiss: () => any;
|
|
200
|
+
action: (action: WfAction) => any;
|
|
200
201
|
error: (error: {
|
|
201
202
|
message: string;
|
|
202
203
|
status?: number;
|
|
203
204
|
}) => any;
|
|
205
|
+
finished: (response: unknown) => any;
|
|
204
206
|
submit: (data: unknown) => any;
|
|
205
207
|
loading: (isLoading: boolean) => any;
|
|
206
|
-
dismiss: () => any;
|
|
207
|
-
action: (action: WfAction) => any;
|
|
208
208
|
form: (def: FormDef, context?: Record<string, unknown> | undefined) => any;
|
|
209
209
|
}, string, vue.PublicProps, Readonly<AsWfFormProps> & Readonly<{
|
|
210
|
-
|
|
210
|
+
onDismiss?: (() => any) | undefined;
|
|
211
|
+
onAction?: ((action: WfAction) => any) | undefined;
|
|
211
212
|
onError?: ((error: {
|
|
212
213
|
message: string;
|
|
213
214
|
status?: number;
|
|
214
215
|
}) => any) | undefined;
|
|
216
|
+
onFinished?: ((response: unknown) => any) | undefined;
|
|
215
217
|
onSubmit?: ((data: unknown) => any) | undefined;
|
|
216
218
|
onLoading?: ((isLoading: boolean) => any) | undefined;
|
|
217
|
-
onDismiss?: (() => any) | undefined;
|
|
218
|
-
onAction?: ((action: WfAction) => any) | undefined;
|
|
219
219
|
onForm?: ((def: FormDef, context?: Record<string, unknown> | undefined) => any) | undefined;
|
|
220
220
|
}>, {
|
|
221
221
|
tokenTransport: "body" | "cookie" | "query";
|
|
@@ -3,7 +3,7 @@ interface WfFinished<TData = unknown> {
|
|
|
3
3
|
finished: true;
|
|
4
4
|
data?: TData;
|
|
5
5
|
message?: WfMessage;
|
|
6
|
-
|
|
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
|
|
15
|
-
|
|
14
|
+
type WfNext = {
|
|
15
|
+
trigger: "immediate";
|
|
16
16
|
action: WfAction;
|
|
17
17
|
} | {
|
|
18
|
-
|
|
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
|
-
|
|
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 {
|
|
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
|
|
2
|
-
import { i as useWfForm, n as UseWfFormOptions, r as UseWfFormReturn, t as _default$1 } from "./as-wf-form.vue-
|
|
3
|
-
import { t as _default } from "./as-wf-finish.vue-
|
|
4
|
-
export { _default as AsWfFinish, _default$1 as AsWfForm, type UseWfFormOptions, type UseWfFormReturn, type WfAction, type WfButton, type WfFinished, type
|
|
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-
|
|
2
|
-
import { t as as_wf_finish_default } from "./as-wf-finish-
|
|
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.
|
|
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.
|
|
53
|
+
"@atscript/ui": "^0.1.69"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@atscript/core": "^0.1.
|
|
57
|
-
"@atscript/typescript": "^0.1.
|
|
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.
|
|
62
|
-
"vitest": "npm:@voidzero-dev/vite-plus-test@
|
|
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/
|
|
66
|
-
"@atscript/
|
|
65
|
+
"@atscript/moost-wf": "^0.1.69",
|
|
66
|
+
"@atscript/vue-form": "^0.1.69"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@atscript/typescript": "^0.1.
|
|
69
|
+
"@atscript/typescript": "^0.1.58",
|
|
70
70
|
"vue": "^3",
|
|
71
|
-
"@atscript/vue-form": "^0.1.
|
|
71
|
+
"@atscript/vue-form": "^0.1.69"
|
|
72
72
|
},
|
|
73
73
|
"scripts": {
|
|
74
74
|
"build": "node ../../scripts/gen-exports.mjs && vp pack",
|