@effect-app/vue-components 2.10.8 → 2.10.10
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/types/components/OmegaForm/OmegaFormStuff.d.ts +3 -1
- package/dist/types/components/OmegaForm/OmegaTaggedUnion.vue.d.ts +6 -6
- package/dist/types/components/OmegaForm/useOmegaForm.d.ts +1 -0
- package/dist/vue-components.es10.js +127 -126
- package/dist/vue-components.es12.js +204 -199
- package/dist/vue-components.es6.js +34 -27
- package/dist/vue-components.es8.js +42 -26
- package/package.json +1 -1
- package/src/components/OmegaForm/OmegaFormStuff.ts +42 -12
- package/src/components/OmegaForm/OmegaInput.vue +18 -1
- package/src/components/OmegaForm/OmegaTaggedUnion.vue +40 -1
- package/src/components/OmegaForm/useOmegaForm.ts +3 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { defineComponent as F, computed as l, useAttrs as A, inject as M, createBlock as i, openBlock as f, resolveDynamicComponent as S, withCtx as u, createCommentVNode as w, mergeProps as I, unref as L, createSlots as P, renderSlot as c, normalizeProps as d, guardReactiveProps as v } from "vue";
|
|
2
|
+
import { useIntl as j } from "./vue-components.es3.js";
|
|
3
|
+
import { generateInputStandardSchemaFromFieldMeta as B } from "./vue-components.es12.js";
|
|
4
|
+
import E from "./vue-components.es7.js";
|
|
5
|
+
import { useErrorLabel as N } from "./vue-components.es10.js";
|
|
6
|
+
const V = /* @__PURE__ */ F({
|
|
6
7
|
inheritAttrs: !1,
|
|
7
8
|
__name: "OmegaInput",
|
|
8
9
|
props: {
|
|
@@ -13,50 +14,56 @@ const D = /* @__PURE__ */ y({
|
|
|
13
14
|
inputClass: {}
|
|
14
15
|
},
|
|
15
16
|
setup(a) {
|
|
16
|
-
const e = a,
|
|
17
|
+
const e = a, n = l(() => e.name), p = A(), g = l(() => {
|
|
17
18
|
if (e.inputClass !== null)
|
|
18
|
-
return e.inputClass !== void 0 ? e.inputClass :
|
|
19
|
-
}),
|
|
19
|
+
return e.inputClass !== void 0 ? e.inputClass : p.class;
|
|
20
|
+
}), s = M(
|
|
20
21
|
"getMetaFromArray",
|
|
21
22
|
null
|
|
22
|
-
),
|
|
23
|
-
|
|
23
|
+
), o = l(() => s?.value && s.value(e.name) ? s.value(n.value) : e.form.meta[n.value]), $ = l(() => {
|
|
24
|
+
const t = o.value;
|
|
25
|
+
if (!t) return n.value;
|
|
26
|
+
const r = t;
|
|
27
|
+
return `${n.value}-${r.type}-${r.minLength ?? ""}-${r.maxLength ?? ""}-${r.minimum ?? ""}-${r.maximum ?? ""}`;
|
|
28
|
+
}), { trans: C } = j(), b = l(() => {
|
|
29
|
+
if (!o.value)
|
|
24
30
|
throw console.log(e.name, Object.keys(e.form.meta), e.form.meta), new Error("Meta is undefined");
|
|
25
|
-
return
|
|
26
|
-
}),
|
|
27
|
-
return (t,
|
|
31
|
+
return B(o.value, C);
|
|
32
|
+
}), h = N(e.form);
|
|
33
|
+
return (t, r) => (f(), i(S(a.form.Field), {
|
|
34
|
+
key: $.value,
|
|
28
35
|
name: a.name,
|
|
29
36
|
validators: {
|
|
30
|
-
onChange:
|
|
37
|
+
onChange: b.value,
|
|
31
38
|
...a.validators
|
|
32
39
|
}
|
|
33
40
|
}, {
|
|
34
|
-
default:
|
|
35
|
-
|
|
36
|
-
field:
|
|
37
|
-
state:
|
|
41
|
+
default: u(({ field: y, state: k }) => [
|
|
42
|
+
o.value ? (f(), i(E, I({ key: 0 }, { ...t.$attrs, ...t.$props, inputClass: g.value }, {
|
|
43
|
+
field: y,
|
|
44
|
+
state: k,
|
|
38
45
|
register: a.form.registerField,
|
|
39
|
-
label: a.label ??
|
|
40
|
-
meta:
|
|
41
|
-
}),
|
|
42
|
-
default:
|
|
43
|
-
|
|
46
|
+
label: a.label ?? L(h)(n.value),
|
|
47
|
+
meta: o.value
|
|
48
|
+
}), P({
|
|
49
|
+
default: u((m) => [
|
|
50
|
+
c(t.$slots, "default", d(v(m)))
|
|
44
51
|
]),
|
|
45
52
|
_: 2
|
|
46
53
|
}, [
|
|
47
54
|
t.$slots.label ? {
|
|
48
55
|
name: "label",
|
|
49
|
-
fn:
|
|
50
|
-
|
|
56
|
+
fn: u((m) => [
|
|
57
|
+
c(t.$slots, "label", d(v(m)))
|
|
51
58
|
]),
|
|
52
59
|
key: "0"
|
|
53
60
|
} : void 0
|
|
54
|
-
]), 1040, ["field", "state", "register", "label", "meta"])) :
|
|
61
|
+
]), 1040, ["field", "state", "register", "label", "meta"])) : w("", !0)
|
|
55
62
|
]),
|
|
56
63
|
_: 3
|
|
57
64
|
}, 8, ["name", "validators"]));
|
|
58
65
|
}
|
|
59
66
|
});
|
|
60
67
|
export {
|
|
61
|
-
|
|
68
|
+
V as default
|
|
62
69
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as M, ref as C, computed as s, watch as b, provide as k, createBlock as F, openBlock as O, unref as f, withCtx as c, renderSlot as o, createVNode as i, createCommentVNode as S, normalizeProps as g, guardReactiveProps as d, createSlots as V, renderList as w } from "vue";
|
|
2
|
+
import A from "./vue-components.es9.js";
|
|
3
|
+
const N = /* @__PURE__ */ M({
|
|
4
4
|
__name: "OmegaTaggedUnion",
|
|
5
5
|
props: {
|
|
6
6
|
name: {},
|
|
@@ -9,39 +9,55 @@ const h = /* @__PURE__ */ d({
|
|
|
9
9
|
options: {},
|
|
10
10
|
label: {}
|
|
11
11
|
},
|
|
12
|
-
setup(
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
setup(t) {
|
|
13
|
+
const n = t, r = C(null), v = s(() => n.name ? `${n.name}._tag` : "_tag"), $ = n.form.useStore((e) => e.values);
|
|
14
|
+
b(
|
|
15
|
+
() => v.value.split(".").reduce((l, a) => l?.[a], $.value),
|
|
16
|
+
(e) => {
|
|
17
|
+
r.value = e ?? null;
|
|
18
|
+
},
|
|
19
|
+
{ immediate: !0 }
|
|
20
|
+
);
|
|
21
|
+
const y = s(() => {
|
|
22
|
+
const e = r.value;
|
|
23
|
+
return (a) => {
|
|
24
|
+
if (!e) return null;
|
|
25
|
+
const m = n.form.unionMeta[e];
|
|
26
|
+
return m ? m[a] ?? null : null;
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
return k("getMetaFromArray", y), (e, l) => (O(), F(f(t.form).Field, {
|
|
30
|
+
name: t.name ? `${t.name}._tag` : "_tag"
|
|
15
31
|
}, {
|
|
16
|
-
default:
|
|
17
|
-
|
|
18
|
-
f(
|
|
19
|
-
name:
|
|
20
|
-
label:
|
|
21
|
-
type:
|
|
22
|
-
options:
|
|
32
|
+
default: c((a) => [
|
|
33
|
+
o(e.$slots, "OmegaCustomInput", g(d(a)), () => [
|
|
34
|
+
i(f(t.form).Input, {
|
|
35
|
+
name: t.name ? `${t.name}._tag` : "_tag",
|
|
36
|
+
label: t.label,
|
|
37
|
+
type: t.type ?? "select",
|
|
38
|
+
options: t.options
|
|
23
39
|
}, null, 8, ["name", "label", "type", "options"])
|
|
24
40
|
]),
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
field:
|
|
28
|
-
state:
|
|
29
|
-
name:
|
|
30
|
-
form:
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
name:
|
|
34
|
-
fn:
|
|
35
|
-
|
|
41
|
+
o(e.$slots, "default"),
|
|
42
|
+
i(A, {
|
|
43
|
+
field: a.field,
|
|
44
|
+
state: a.state.value,
|
|
45
|
+
name: t.name,
|
|
46
|
+
form: t.form
|
|
47
|
+
}, V({ _: 2 }, [
|
|
48
|
+
w(e.$slots, (m, u) => ({
|
|
49
|
+
name: u,
|
|
50
|
+
fn: c((h) => [
|
|
51
|
+
o(e.$slots, u, g(d(h)))
|
|
36
52
|
])
|
|
37
53
|
}))
|
|
38
54
|
]), 1032, ["field", "state", "name", "form"]),
|
|
39
|
-
|
|
55
|
+
a.state.value ? o(e.$slots, "OmegaCommon", { key: 0 }) : S("", !0)
|
|
40
56
|
]),
|
|
41
57
|
_: 3
|
|
42
58
|
}, 8, ["name"]));
|
|
43
59
|
}
|
|
44
60
|
});
|
|
45
61
|
export {
|
|
46
|
-
|
|
62
|
+
N as default
|
|
47
63
|
};
|
package/package.json
CHANGED
|
@@ -653,7 +653,7 @@ export const createMeta = <T = any>(
|
|
|
653
653
|
)
|
|
654
654
|
.pipe(Option.getOrElse(() => ({}))) as Record<string, unknown>
|
|
655
655
|
|
|
656
|
-
meta = { ...
|
|
656
|
+
meta = { ...JSONAnnotation, ...meta }
|
|
657
657
|
|
|
658
658
|
if ("from" in property) {
|
|
659
659
|
return createMeta<T>({
|
|
@@ -681,12 +681,31 @@ export const createMeta = <T = any>(
|
|
|
681
681
|
return acc
|
|
682
682
|
}
|
|
683
683
|
|
|
684
|
+
// Helper to flatten nested meta structure into dot-notation keys
|
|
685
|
+
const flattenMeta = <T>(meta: MetaRecord<T> | FieldMeta, parentKey: string = ""): MetaRecord<T> => {
|
|
686
|
+
const result: MetaRecord<T> = {}
|
|
687
|
+
|
|
688
|
+
for (const key in meta) {
|
|
689
|
+
const value = (meta as any)[key]
|
|
690
|
+
const newKey = parentKey ? `${parentKey}.${key}` : key
|
|
691
|
+
|
|
692
|
+
if (value && typeof value === "object" && "type" in value) {
|
|
693
|
+
result[newKey as DeepKeys<T>] = value as FieldMeta
|
|
694
|
+
} else if (value && typeof value === "object") {
|
|
695
|
+
Object.assign(result, flattenMeta<T>(value, newKey))
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
return result
|
|
700
|
+
}
|
|
701
|
+
|
|
684
702
|
const metadataFromAst = <From, To>(
|
|
685
703
|
schema: S.Schema<To, From, never>
|
|
686
|
-
): { meta: MetaRecord<To>; defaultValues: Record<string, any
|
|
704
|
+
): { meta: MetaRecord<To>; defaultValues: Record<string, any>; unionMeta: Record<string, MetaRecord<To>> } => {
|
|
687
705
|
const ast = schema.ast
|
|
688
706
|
const newMeta: MetaRecord<To> = {}
|
|
689
707
|
const defaultValues: Record<string, any> = {}
|
|
708
|
+
const unionMeta: Record<string, MetaRecord<To>> = {}
|
|
690
709
|
|
|
691
710
|
if (ast._tag === "Transformation" || ast._tag === "Refinement") {
|
|
692
711
|
return metadataFromAst(S.make(ast.from))
|
|
@@ -709,7 +728,7 @@ const metadataFromAst = <From, To>(
|
|
|
709
728
|
// Extract discriminator values from each union member
|
|
710
729
|
const discriminatorValues: any[] = []
|
|
711
730
|
|
|
712
|
-
//
|
|
731
|
+
// Store metadata for each union member by its tag value
|
|
713
732
|
for (const memberType of nonNullTypes) {
|
|
714
733
|
if ("propertySignatures" in memberType) {
|
|
715
734
|
// Find the discriminator field (usually _tag)
|
|
@@ -717,8 +736,10 @@ const metadataFromAst = <From, To>(
|
|
|
717
736
|
(p: any) => p.name.toString() === "_tag"
|
|
718
737
|
)
|
|
719
738
|
|
|
739
|
+
let tagValue: string | null = null
|
|
720
740
|
if (tagProp && S.AST.isLiteral(tagProp.type)) {
|
|
721
|
-
|
|
741
|
+
tagValue = tagProp.type.literal as string
|
|
742
|
+
discriminatorValues.push(tagValue)
|
|
722
743
|
}
|
|
723
744
|
|
|
724
745
|
// Create metadata for this member's properties
|
|
@@ -726,7 +747,12 @@ const metadataFromAst = <From, To>(
|
|
|
726
747
|
propertySignatures: memberType.propertySignatures
|
|
727
748
|
})
|
|
728
749
|
|
|
729
|
-
//
|
|
750
|
+
// Store per-tag metadata for reactive lookup
|
|
751
|
+
if (tagValue) {
|
|
752
|
+
unionMeta[tagValue] = flattenMeta<To>(memberMeta)
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// Merge into result (for backward compatibility)
|
|
730
756
|
Object.assign(newMeta, memberMeta)
|
|
731
757
|
}
|
|
732
758
|
}
|
|
@@ -740,7 +766,7 @@ const metadataFromAst = <From, To>(
|
|
|
740
766
|
} as FieldMeta
|
|
741
767
|
}
|
|
742
768
|
|
|
743
|
-
return { meta: newMeta, defaultValues }
|
|
769
|
+
return { meta: newMeta, defaultValues, unionMeta }
|
|
744
770
|
}
|
|
745
771
|
}
|
|
746
772
|
|
|
@@ -750,7 +776,7 @@ const metadataFromAst = <From, To>(
|
|
|
750
776
|
})
|
|
751
777
|
|
|
752
778
|
if (Object.values(meta).every((value) => value && "type" in value)) {
|
|
753
|
-
return { meta: meta as MetaRecord<To>, defaultValues }
|
|
779
|
+
return { meta: meta as MetaRecord<To>, defaultValues, unionMeta }
|
|
754
780
|
}
|
|
755
781
|
|
|
756
782
|
const flattenObject = (
|
|
@@ -770,7 +796,7 @@ const metadataFromAst = <From, To>(
|
|
|
770
796
|
flattenObject(meta)
|
|
771
797
|
}
|
|
772
798
|
|
|
773
|
-
return { meta: newMeta, defaultValues }
|
|
799
|
+
return { meta: newMeta, defaultValues, unionMeta }
|
|
774
800
|
}
|
|
775
801
|
|
|
776
802
|
export const duplicateSchema = <From, To>(
|
|
@@ -784,16 +810,20 @@ export const generateMetaFromSchema = <From, To>(
|
|
|
784
810
|
): {
|
|
785
811
|
schema: S.Schema<To, From, never>
|
|
786
812
|
meta: MetaRecord<To>
|
|
813
|
+
unionMeta: Record<string, MetaRecord<To>>
|
|
787
814
|
} => {
|
|
788
|
-
const { meta } = metadataFromAst(schema)
|
|
815
|
+
const { meta, unionMeta } = metadataFromAst(schema)
|
|
789
816
|
|
|
790
|
-
return { schema, meta }
|
|
817
|
+
return { schema, meta, unionMeta }
|
|
791
818
|
}
|
|
792
819
|
|
|
793
820
|
export const generateInputStandardSchemaFromFieldMeta = (
|
|
794
|
-
meta: FieldMeta
|
|
821
|
+
meta: FieldMeta,
|
|
822
|
+
trans?: ReturnType<typeof useIntl>["trans"]
|
|
795
823
|
): StandardSchemaV1<any, any> => {
|
|
796
|
-
|
|
824
|
+
if (!trans) {
|
|
825
|
+
trans = useIntl().trans
|
|
826
|
+
}
|
|
797
827
|
let schema: S.Schema<any, any, never>
|
|
798
828
|
switch (meta.type) {
|
|
799
829
|
case "string":
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
3
|
:is="form.Field"
|
|
4
|
+
:key="fieldKey"
|
|
4
5
|
:name="name"
|
|
5
6
|
:validators="{
|
|
6
7
|
onChange: schema,
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
>
|
|
42
43
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
43
44
|
import { computed, inject, type Ref, useAttrs } from "vue"
|
|
45
|
+
import { useIntl } from "../../utils"
|
|
44
46
|
import { type FieldMeta, generateInputStandardSchemaFromFieldMeta, type OmegaInputPropsBase } from "./OmegaFormStuff"
|
|
45
47
|
import OmegaInternalInput from "./OmegaInternalInput.vue"
|
|
46
48
|
import { useErrorLabel } from "./useOmegaForm"
|
|
@@ -80,12 +82,27 @@ const meta = computed(() => {
|
|
|
80
82
|
return props.form.meta[propsName.value]
|
|
81
83
|
})
|
|
82
84
|
|
|
85
|
+
// Key to force Field re-mount when meta type changes (for TaggedUnion support)
|
|
86
|
+
const fieldKey = computed(() => {
|
|
87
|
+
const m = meta.value
|
|
88
|
+
if (!m) return propsName.value
|
|
89
|
+
// Include type and key constraints in the key so Field re-mounts when validation rules change
|
|
90
|
+
// Cast to any since not all FieldMeta variants have these properties
|
|
91
|
+
const fm = m as any
|
|
92
|
+
return `${propsName.value}-${fm.type}-${fm.minLength ?? ""}-${fm.maxLength ?? ""}-${fm.minimum ?? ""}-${
|
|
93
|
+
fm.maximum ?? ""
|
|
94
|
+
}`
|
|
95
|
+
})
|
|
96
|
+
|
|
97
|
+
// Call useIntl during setup to avoid issues when computed re-evaluates
|
|
98
|
+
const { trans } = useIntl()
|
|
99
|
+
|
|
83
100
|
const schema = computed(() => {
|
|
84
101
|
if (!meta.value) {
|
|
85
102
|
console.log(props.name, Object.keys(props.form.meta), props.form.meta)
|
|
86
103
|
throw new Error("Meta is undefined")
|
|
87
104
|
}
|
|
88
|
-
return generateInputStandardSchemaFromFieldMeta(meta.value)
|
|
105
|
+
return generateInputStandardSchemaFromFieldMeta(meta.value, trans)
|
|
89
106
|
})
|
|
90
107
|
|
|
91
108
|
const errori18n = useErrorLabel(props.form)
|
|
@@ -6,18 +6,57 @@
|
|
|
6
6
|
Name extends DeepKeys<From> | undefined = DeepKeys<From>"
|
|
7
7
|
>
|
|
8
8
|
import { type DeepKeys } from "@tanstack/vue-form"
|
|
9
|
+
import { computed, provide, ref, watch } from "vue"
|
|
9
10
|
import { type TaggedUnionOption } from "./InputProps"
|
|
10
11
|
import { type FieldPath } from "./OmegaFormStuff"
|
|
11
12
|
import OmegaTaggedUnionInternal from "./OmegaTaggedUnionInternal.vue"
|
|
12
13
|
import { type useOmegaForm } from "./useOmegaForm"
|
|
13
14
|
|
|
14
|
-
defineProps<{
|
|
15
|
+
const props = defineProps<{
|
|
15
16
|
name?: Name
|
|
16
17
|
form: ReturnType<typeof useOmegaForm<From, To>>
|
|
17
18
|
type?: "select" | "radio"
|
|
18
19
|
options: TaggedUnionOption<From, Name>[]
|
|
19
20
|
label?: string
|
|
20
21
|
}>()
|
|
22
|
+
|
|
23
|
+
// Track the current tag value reactively
|
|
24
|
+
const currentTag = ref<string | null>(null)
|
|
25
|
+
|
|
26
|
+
// Watch the form's _tag field value
|
|
27
|
+
const tagPath = computed(() => props.name ? `${props.name}._tag` : "_tag")
|
|
28
|
+
const formValues = props.form.useStore((state) => state.values)
|
|
29
|
+
watch(
|
|
30
|
+
() => {
|
|
31
|
+
const path = tagPath.value
|
|
32
|
+
// Navigate to the nested value
|
|
33
|
+
return path.split(".").reduce((acc: any, key) => acc?.[key], formValues.value) as string | null
|
|
34
|
+
},
|
|
35
|
+
(newTag) => {
|
|
36
|
+
currentTag.value = newTag ?? null
|
|
37
|
+
},
|
|
38
|
+
{ immediate: true }
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
// Provide tag-specific metadata to all child Input components
|
|
42
|
+
const getMetaFromArray = computed(() => {
|
|
43
|
+
const tag = currentTag.value
|
|
44
|
+
|
|
45
|
+
const getMeta = (path: string) => {
|
|
46
|
+
if (!tag) return null
|
|
47
|
+
|
|
48
|
+
// Get the tag-specific metadata
|
|
49
|
+
const tagMeta = props.form.unionMeta[tag]
|
|
50
|
+
if (!tagMeta) return null
|
|
51
|
+
|
|
52
|
+
// Look up the meta for this path
|
|
53
|
+
return tagMeta[path as keyof typeof tagMeta] ?? null
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return getMeta
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
provide("getMetaFromArray", getMetaFromArray)
|
|
21
60
|
</script>
|
|
22
61
|
|
|
23
62
|
<template>
|
|
@@ -217,6 +217,7 @@ export type OmegaConfig<T> = {
|
|
|
217
217
|
|
|
218
218
|
export interface OF<From, To> extends OmegaFormApi<From, To> {
|
|
219
219
|
meta: MetaRecord<From>
|
|
220
|
+
unionMeta: Record<string, MetaRecord<From>>
|
|
220
221
|
clear: () => void
|
|
221
222
|
i18nNamespace?: string
|
|
222
223
|
ignorePreventCloseEvents?: boolean
|
|
@@ -682,7 +683,7 @@ export const useOmegaForm = <
|
|
|
682
683
|
const standardSchema = S.standardSchemaV1(schema)
|
|
683
684
|
const decode = S.decode(schema)
|
|
684
685
|
|
|
685
|
-
const { meta } = generateMetaFromSchema(schema)
|
|
686
|
+
const { meta, unionMeta } = generateMetaFromSchema(schema)
|
|
686
687
|
|
|
687
688
|
const persistencyKey = computed(() => {
|
|
688
689
|
if (omegaConfig?.persistency?.id) {
|
|
@@ -952,6 +953,7 @@ export const useOmegaForm = <
|
|
|
952
953
|
i18nNamespace: omegaConfig?.i18nNamespace,
|
|
953
954
|
ignorePreventCloseEvents: omegaConfig?.ignorePreventCloseEvents,
|
|
954
955
|
meta,
|
|
956
|
+
unionMeta,
|
|
955
957
|
clear,
|
|
956
958
|
handleSubmit: (meta?: Record<string, any>) => {
|
|
957
959
|
const span = api.trace.getSpan(api.context.active())
|