@shwfed/config 2.10.1 → 2.10.3
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/mcp.mjs +117 -87
- package/dist/module.json +1 -1
- package/dist/preview/assets/{FieldGroup.vue_vue_type_script_setup_true_lang-CuFusz5A.js → FieldGroup.vue_vue_type_script_setup_true_lang-sT5i_dnE.js} +1 -1
- package/dist/preview/assets/badge-ZFj45FMd.js +1 -0
- package/dist/preview/assets/config-2iinn_1E.js +1 -0
- package/dist/preview/assets/config-3rP_f_3o.js +1 -0
- package/dist/preview/assets/config-BBvebIQw.js +1 -0
- package/dist/preview/assets/{config-Djv6EQBY.js → config-BLesYihN.js} +1 -1
- package/dist/preview/assets/config-BwDPPmtn.js +1 -0
- package/dist/preview/assets/{config-BWC-Zw21.js → config-CEBzJOHo.js} +1 -1
- package/dist/preview/assets/config-CSR1JNVB.js +1 -0
- package/dist/preview/assets/config-CgM75jSO.js +1 -0
- package/dist/preview/assets/{config-urZuasV7.js → config-D1uMzMiN.js} +1 -1
- package/dist/preview/assets/config-DZPLqFqt.js +1 -0
- package/dist/preview/assets/config-DfVc2Iy9.js +1 -0
- package/dist/preview/assets/{config-BqSL4UAL.js → config-Rz0II9u6.js} +1 -1
- package/dist/preview/assets/{config-DVjZmomc.js → config-cD091sze.js} +1 -1
- package/dist/preview/assets/config-lskK7grq.js +1 -0
- package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-BzryfjdG.js → definition.vue_vue_type_script_setup_true_lang-Ce_NeQUa.js} +1 -1
- package/dist/preview/assets/index-Zc4Mcm3J.js +761 -0
- package/dist/preview/assets/index-_KA5_QIV.js +1 -0
- package/dist/preview/assets/{index-BnJ5p1Mx.css → index-pkoEF5dC.css} +1 -1
- package/dist/preview/assets/index-snO3CfdE.js +1 -0
- package/dist/preview/assets/item-CBFJ6f6b.js +1 -0
- package/dist/preview/assets/runtime-BIGEoc5L.js +1 -0
- package/dist/preview/assets/runtime-BKqyqEeD.js +1 -0
- package/dist/preview/assets/runtime-CIc3k_jd.js +1 -0
- package/dist/preview/assets/{runtime-CBBae0-H.js → runtime-Cu0RJn8g.js} +1 -1
- package/dist/preview/assets/{runtime-3rajYvjp.js → runtime-CvMryNNx.js} +1 -1
- package/dist/preview/assets/runtime-DO9HS0Rb.js +1 -0
- package/dist/preview/assets/{runtime-4A3oiig9.js → runtime-DQXLscBz.js} +1 -1
- package/dist/preview/assets/runtime-Q_isegB9.js +1 -0
- package/dist/preview/assets/runtime-enspc5HG.js +1 -0
- package/dist/preview/assets/runtime-jWibKv1T.js +1 -0
- package/dist/preview/assets/{schema-meta-BFzIzGiN.js → schema-meta-B5tln_XH.js} +1 -1
- package/dist/preview/index.html +2 -2
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.d.ts +16 -10
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/schema.js +68 -43
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.d.ts +1 -0
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.js +5 -1
- package/dist/runtime/components/config/index.vue +5 -1
- package/dist/runtime/components/config/schema.d.ts +10 -0
- package/dist/runtime/components/config/schema.js +23 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.d.vue.ts +31 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.vue +103 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/config.vue.d.ts +31 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/runtime.d.ts +2 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/runtime.js +63 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.d.ts +21 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.js +63 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/config.d.vue.ts +17 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/config.vue +85 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/config.vue.d.ts +17 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/runtime.d.ts +2 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/runtime.js +36 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.d.ts +14 -0
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.js +38 -0
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/config.vue +74 -8
- package/package.json +1 -1
- package/dist/preview/assets/badge-D5FPHSix.js +0 -1
- package/dist/preview/assets/config-BHPiQ1lB.js +0 -1
- package/dist/preview/assets/config-Bg94Z7XN.js +0 -1
- package/dist/preview/assets/config-CeRBpZbE.js +0 -1
- package/dist/preview/assets/config-CfjcFb_E.js +0 -1
- package/dist/preview/assets/config-DNUKa3lN.js +0 -1
- package/dist/preview/assets/config-PNpa6ENz.js +0 -1
- package/dist/preview/assets/config-ucxtM3wX.js +0 -1
- package/dist/preview/assets/index-BE9O1XgB.js +0 -1
- package/dist/preview/assets/index-DCRQGu0g.js +0 -1
- package/dist/preview/assets/index-yvElpEK3.js +0 -743
- package/dist/preview/assets/item-CTkdtkvl.js +0 -1
- package/dist/preview/assets/runtime-BOGZFWxF.js +0 -1
- package/dist/preview/assets/runtime-BqroTX7H.js +0 -1
- package/dist/preview/assets/runtime-CBuV3vwL.js +0 -1
- package/dist/preview/assets/runtime-CI8yzwXd.js +0 -1
- package/dist/preview/assets/runtime-CcyhgOum.js +0 -1
- package/dist/preview/assets/runtime-CkQ-mNoH.js +0 -1
- package/dist/preview/assets/runtime-DmxKfudS.js +0 -1
|
@@ -84,8 +84,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
84
84
|
readonly target: string;
|
|
85
85
|
readonly operation: string;
|
|
86
86
|
}[] | undefined;
|
|
87
|
-
readonly accessor: string;
|
|
88
87
|
readonly successMessage?: string | undefined;
|
|
88
|
+
readonly accessor: string;
|
|
89
89
|
};
|
|
90
90
|
}) => any;
|
|
91
91
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
@@ -170,8 +170,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
170
170
|
readonly target: string;
|
|
171
171
|
readonly operation: string;
|
|
172
172
|
}[] | undefined;
|
|
173
|
-
readonly accessor: string;
|
|
174
173
|
readonly successMessage?: string | undefined;
|
|
174
|
+
readonly accessor: string;
|
|
175
175
|
};
|
|
176
176
|
}) => any) | undefined;
|
|
177
177
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -84,8 +84,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
84
84
|
readonly target: string;
|
|
85
85
|
readonly operation: string;
|
|
86
86
|
}[] | undefined;
|
|
87
|
-
readonly accessor: string;
|
|
88
87
|
readonly successMessage?: string | undefined;
|
|
88
|
+
readonly accessor: string;
|
|
89
89
|
};
|
|
90
90
|
}) => any;
|
|
91
91
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
@@ -170,8 +170,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
170
170
|
readonly target: string;
|
|
171
171
|
readonly operation: string;
|
|
172
172
|
}[] | undefined;
|
|
173
|
-
readonly accessor: string;
|
|
174
173
|
readonly successMessage?: string | undefined;
|
|
174
|
+
readonly accessor: string;
|
|
175
175
|
};
|
|
176
176
|
}) => any) | undefined;
|
|
177
177
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -84,8 +84,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
84
84
|
readonly target: string;
|
|
85
85
|
readonly operation: string;
|
|
86
86
|
}[] | undefined;
|
|
87
|
-
readonly accessor: string;
|
|
88
87
|
readonly successMessage?: string | undefined;
|
|
88
|
+
readonly accessor: string;
|
|
89
89
|
};
|
|
90
90
|
}) => any;
|
|
91
91
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
@@ -170,8 +170,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
170
170
|
readonly target: string;
|
|
171
171
|
readonly operation: string;
|
|
172
172
|
}[] | undefined;
|
|
173
|
-
readonly accessor: string;
|
|
174
173
|
readonly successMessage?: string | undefined;
|
|
174
|
+
readonly accessor: string;
|
|
175
175
|
};
|
|
176
176
|
}) => any) | undefined;
|
|
177
177
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -84,8 +84,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
84
84
|
readonly target: string;
|
|
85
85
|
readonly operation: string;
|
|
86
86
|
}[] | undefined;
|
|
87
|
-
readonly accessor: string;
|
|
88
87
|
readonly successMessage?: string | undefined;
|
|
88
|
+
readonly accessor: string;
|
|
89
89
|
};
|
|
90
90
|
}) => any;
|
|
91
91
|
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
@@ -170,8 +170,8 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {},
|
|
|
170
170
|
readonly target: string;
|
|
171
171
|
readonly operation: string;
|
|
172
172
|
}[] | undefined;
|
|
173
|
-
readonly accessor: string;
|
|
174
173
|
readonly successMessage?: string | undefined;
|
|
174
|
+
readonly accessor: string;
|
|
175
175
|
};
|
|
176
176
|
}) => any) | undefined;
|
|
177
177
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, defineComponent, inject, onBeforeUnmount, provide, ref, watch } from "vue";
|
|
3
|
-
import { provideCELContext, provideScopeAncestor, provideSelectionRoster, SELECTIONS_VAR } from "../../utils/cel-context";
|
|
3
|
+
import { celBindings, injectCELContext, provideCELContext, provideScopeAncestor, provideSelectionRoster, SELECTIONS_VAR } from "../../utils/cel-context";
|
|
4
4
|
import { BREADCRUMB_EXTENSION_KEY } from "../config/breadcrumb-extension";
|
|
5
5
|
import { TABLE_COLUMN_LAYOUT_KEY } from "./column-layout";
|
|
6
6
|
import { Icon } from "@iconify/vue";
|
|
7
|
-
import { ParseResult, Schema } from "effect";
|
|
7
|
+
import { Effect, ParseResult, Schema } from "effect";
|
|
8
8
|
import { TableConfig, Pagination, ColumnGroup, tableDataSource, configureTableActionsScope, registerDataSourceRequestVars, registerDataSourceResponseVars, metadata as tableMetadata } from "./schema";
|
|
9
9
|
import { COLUMNS, findColumn as findColumnEntry } from "./utils/resolve";
|
|
10
|
+
import { registerRowVariablesIfAbsent } from "./utils/shared";
|
|
10
11
|
import {
|
|
11
12
|
useTreeDnd
|
|
12
13
|
} from "../../composables/useTreeDnd";
|
|
@@ -35,6 +36,9 @@ import ActionsConfigEditor from "../actions/config.vue";
|
|
|
35
36
|
import ShwfedFormConfig from "../form/config.vue";
|
|
36
37
|
import { defaultFormConfig } from "../form/schema";
|
|
37
38
|
import { Environment } from "../../vendor/cel-js/lib/index";
|
|
39
|
+
import { cel as rawCel } from "../../utils/cel";
|
|
40
|
+
import { Button } from "../ui/button";
|
|
41
|
+
import { toast } from "vue-sonner";
|
|
38
42
|
defineOptions({ name: "ShwfedTableConfig" });
|
|
39
43
|
function probeCELContext(register) {
|
|
40
44
|
const probe = new Environment({ unlistedVariablesAreDyn: false });
|
|
@@ -110,6 +114,16 @@ const CellStyleCELContext = defineComponent({
|
|
|
110
114
|
return () => slots.default?.();
|
|
111
115
|
}
|
|
112
116
|
});
|
|
117
|
+
const ColumnCELContext = defineComponent({
|
|
118
|
+
name: "ColumnCELContext",
|
|
119
|
+
setup(_, { slots }) {
|
|
120
|
+
provideCELContext(probeCELContext((env) => {
|
|
121
|
+
configure(env);
|
|
122
|
+
registerRowVariablesIfAbsent(env);
|
|
123
|
+
}));
|
|
124
|
+
return () => slots.default?.();
|
|
125
|
+
}
|
|
126
|
+
});
|
|
113
127
|
const RequestCELContext = defineComponent({
|
|
114
128
|
name: "RequestCELContext",
|
|
115
129
|
setup(_, { slots }) {
|
|
@@ -574,6 +588,33 @@ function patchSelectedColumn(next) {
|
|
|
574
588
|
if (selected.value.kind !== "column") return;
|
|
575
589
|
patchColumn(selected.value.id, next);
|
|
576
590
|
}
|
|
591
|
+
const inheritedCEL = injectCELContext();
|
|
592
|
+
function celForMigration(expression, context) {
|
|
593
|
+
return rawCel(expression, { ...celBindings(inheritedCEL), ...context });
|
|
594
|
+
}
|
|
595
|
+
const migrationContext = { $cel: celForMigration };
|
|
596
|
+
const columnMigrationTarget = computed(() => {
|
|
597
|
+
const e = selectedColumnEntry.value;
|
|
598
|
+
if (!e?.deprecated || !e.supersededBy) return null;
|
|
599
|
+
return findColumnEntry(e.supersededBy.type, e.supersededBy.compatibilityDate) ?? null;
|
|
600
|
+
});
|
|
601
|
+
const canMigrateColumn = computed(() => !!columnMigrationTarget.value?.migrate);
|
|
602
|
+
async function migrateSelectedColumn() {
|
|
603
|
+
const sel = selectedColumnRef.value;
|
|
604
|
+
const target = columnMigrationTarget.value;
|
|
605
|
+
if (!sel || !target?.migrate) return;
|
|
606
|
+
try {
|
|
607
|
+
const next = await Effect.runPromise(target.migrate(sel, migrationContext));
|
|
608
|
+
patchSelectedColumn(next);
|
|
609
|
+
const isSameType = target.type === sel.type;
|
|
610
|
+
toast.success(
|
|
611
|
+
isSameType ? `\u5DF2\u8FC1\u79FB\u5230 ${target.compatibilityDate} \u7248\u672C` : `\u5DF2\u8FC1\u79FB\u5230 ${target.type}@${target.compatibilityDate}`
|
|
612
|
+
);
|
|
613
|
+
} catch (err) {
|
|
614
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
615
|
+
toast.error("\u8FC1\u79FB\u5931\u8D25", { description: message });
|
|
616
|
+
}
|
|
617
|
+
}
|
|
577
618
|
function patchSelectedGroup(next) {
|
|
578
619
|
if (selected.value.kind !== "group") return;
|
|
579
620
|
const id = selected.value.id;
|
|
@@ -1654,12 +1695,37 @@ const tableQueryValue = computed({
|
|
|
1654
1695
|
v-else-if="selectedColumnRef"
|
|
1655
1696
|
:class="columnFullPane ? '' : 'space-y-5'"
|
|
1656
1697
|
>
|
|
1657
|
-
<
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1698
|
+
<div
|
|
1699
|
+
v-if="selectedColumnEntry?.deprecated && selectedColumnEntry.supersededBy"
|
|
1700
|
+
class="mb-4 flex items-center gap-2 rounded border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800"
|
|
1701
|
+
role="alert"
|
|
1702
|
+
>
|
|
1703
|
+
<Icon
|
|
1704
|
+
icon="fluent:warning-20-regular"
|
|
1705
|
+
class="size-4 shrink-0"
|
|
1706
|
+
/>
|
|
1707
|
+
<span class="flex-1">
|
|
1708
|
+
此列类型已弃用,建议迁移至 <span class="tabular-nums font-medium">{{ selectedColumnEntry.supersededBy.type === selectedColumnEntry.type ? selectedColumnEntry.supersededBy.compatibilityDate : `${selectedColumnEntry.supersededBy.type}@${selectedColumnEntry.supersededBy.compatibilityDate}` }}</span>。
|
|
1709
|
+
</span>
|
|
1710
|
+
<Button
|
|
1711
|
+
v-if="canMigrateColumn"
|
|
1712
|
+
variant="ghost"
|
|
1713
|
+
size="sm"
|
|
1714
|
+
class="text-amber-800 hover:bg-amber-100 hover:text-amber-900"
|
|
1715
|
+
data-slot="column-migrate"
|
|
1716
|
+
@click="migrateSelectedColumn"
|
|
1717
|
+
>
|
|
1718
|
+
<Icon icon="fluent:arrow-sync-20-regular" />
|
|
1719
|
+
迁移
|
|
1720
|
+
</Button>
|
|
1721
|
+
</div>
|
|
1722
|
+
<ColumnCELContext v-if="selectedColumnEntry">
|
|
1723
|
+
<component
|
|
1724
|
+
:is="selectedColumnEntry.config"
|
|
1725
|
+
:model-value="selectedColumnRef"
|
|
1726
|
+
@update:model-value="(v) => patchSelectedColumn(v)"
|
|
1727
|
+
/>
|
|
1728
|
+
</ColumnCELContext>
|
|
1663
1729
|
<div
|
|
1664
1730
|
v-else
|
|
1665
1731
|
class="text-xs text-red-500"
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as $,Y as q,v as E,x as F,y as p,o as f,R as O,c as w,S as x,b as m,Z as y,w as I,a as L,h as N,$ as S,a0 as z,B as t,C as A,D as J,E as g,F as P,G as V,H as D,I as G,J as H,A as K,K as R,M as T,a1 as U,a2 as W,N as Y,L as Z,O as Q}from"./index-yvElpEK3.js";const ee=$({name:"ShwfedBlockCardBadge",inheritAttrs:!1,__name:"badge",props:{badge:{}},setup(n){const a=n,{locale:C}=q(),k=T(),o=K(void 0);function i(){return R(k)}const b=t(()=>o.value===void 0?Z():Q(o.value)),c=t(()=>U(a.badge.content,C.value)||""),j=t(()=>c.value?W(c.value,g,{...i(),json:b.value}):""),B=t(()=>{const e=a.badge.show;if(!e)return!0;try{return Y(g(e,{...i(),json:b.value}))}catch(r){return console.warn("[shwfed-card-badge] show evaluation failed",r),!0}});async function s(){const e=a.badge.request;if(!e)return;const r=i(),_=A(function*(){const v=yield*J(yield*g(e,r));return P(v)});try{o.value=await V(D(_,G))}catch(v){console.warn("[shwfed-card-badge] fetch failed",v)}}const l=t(()=>!!a.badge.request&&(a.badge.interval??0)>0),M=t(()=>Math.max(1,a.badge.interval??1)*1e3),u=H(),{pause:h,resume:d}=E(()=>{s()},M,{immediate:!1});return F(()=>{s(),l.value&&u.value&&d()}),p(u,e=>{l.value&&(e?(s(),d()):h())}),p(()=>[a.badge.request??"",a.badge.interval??0].join("|"),()=>{s(),l.value&&u.value?d():h()}),(e,r)=>c.value&&B.value?(f(),O(S,{key:0},[n.badge.dot?(f(),w(m(y),x({key:0,variant:n.badge.variant??"default",class:"size-2.5 min-w-0 rounded-full p-0"},e.$attrs),null,16,["variant"])):(f(),w(m(y),x({key:1,variant:n.badge.variant??"default"},e.$attrs),{default:I(()=>[L(m(N),{source:j.value,class:"max-w-none text-inherit [&_*]:text-inherit [&_p]:m-0"},null,8,["source"])]),_:1},16,["variant"]))],64)):z("",!0)}});export{ee as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as le,u as te,ap as ae,aq as oe,y as I,ar as R,R as c,c as H,a as s,w as n,b as e,as as se,a0 as ne,$ as P,at as ie,t as p,j as v,au as W,av as h,aw as de,B as x,A as ue,Q as j,ax as ce,o as d,ay as K,az as O,ae as q,aA as Y,e as B,f as b,g as _,h as L,i as ve,_ as U,aB as Q,a6 as re,a7 as me,aC as fe,aD as pe,aE as xe,aF as ye}from"./index-yvElpEK3.js";const ke={key:0,class:"flex min-h-96 items-center justify-center p-8 text-sm text-zinc-400"},ge={key:1},Ie={key:2,class:"p-6 text-sm text-red-500"},Be={key:2,class:"flex flex-col gap-4"},be={class:"grid grid-cols-2 gap-4"},_e={key:0,class:"flex gap-2 min-h-96"},Le={class:"flex w-56 shrink-0 flex-col"},Ue={class:"flex flex-1 flex-col gap-2"},Ve={class:"flex-1"},De={key:1,class:"flex flex-col gap-2"},Ee={class:"h-96"},Se=le({name:"ShwfedModalLayoutActionConfig",__name:"config",props:de({configure:{type:Function}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(V){const i=te(V,"modelValue"),X=V,D=x(()=>X.configure??(()=>{})),E=ae(()=>{}),y=a=>re(E,a)??a,r=a=>me(E,a),G=x({get:()=>i.value.slot??fe(),set:a=>{i.value={...i.value,slot:a}}}),t=oe(G,{configure:D.value}),{copy:C,paste:S}=ce(t);function J(a){i.value={...i.value,modalTitle:a}}function T(a,l){const o=l.trim(),g={...i.value};o.length===0?Reflect.deleteProperty(g,a):g[a]=o,i.value=g}function M(){const a=t.layouts.value;t.layouts.value=[...a,{name:"新布局",layout:{columns:1,placements:{}}}],t.activeLayoutIndex.value=a.length}function z(a,l){t.addBlock(a,l)}function w(a){t.removeBlock(a)}function $(a){t.removeBlocks(a)}const u=ue(null),m=x(()=>{const a=u.value;return a?t.blocks.value.find(l=>l.id===a)??null:null}),A=x(()=>{const a=m.value;return a?pe()?.(a.type,a.compatibilityDate)??null:null});function N(a){u.value=a}function Z(){u.value=null}I(()=>t.blocks.value.map(a=>a.id),a=>{const l=u.value;l&&!a.includes(l)&&(u.value=null)});function ee(a){const l=u.value;l&&t.updateBlock(l,a)}const F=j(xe,null);if(F){const a=F.add();I(m,l=>{l?(a.label.value=t.getBlockLabel(l),a.back.value=Z):(a.label.value=null,a.back.value=null)},{immediate:!0}),R(()=>{a.dispose()})}const f=j(ye,null),k=x(()=>f?.target.value??null);return I(u,a=>{f?.drilled&&(f.drilled.value=!!a)},{immediate:!0}),R(()=>{f?.drilled&&(f.drilled.value=!1)}),(a,l)=>(d(),c(P,null,[k.value&&!u.value?(d(),H(se,{key:0,to:k.value},[s(e(O),{class:"flex-1"},{default:n(()=>[s(K,{"model-value":e(t).layouts.value,"active-index":e(t).activeLayoutIndex.value,"onUpdate:modelValue":l[0]||(l[0]=o=>{e(t).layouts.value=o}),"onUpdate:activeIndex":l[1]||(l[1]=o=>{e(t).activeLayoutIndex.value=o})},null,8,["model-value","active-index"])]),_:1}),s(e(Y),{variant:"ghost",size:"sm",onClick:l[2]||(l[2]=o=>M())},{default:n(()=>[s(e(q),{icon:"fluent:add-20-regular",class:"size-4"}),l[17]||(l[17]=v("span",null,"新增布局",-1))]),_:1})],8,["to"])):ne("",!0),u.value?(d(),c(P,{key:1},[m.value?A.value?(d(),c("div",ge,[(d(),H(ie(A.value.config),{"model-value":m.value,configure:D.value,"onUpdate:modelValue":l[3]||(l[3]=o=>ee(o))},null,8,["model-value","configure"]))])):(d(),c("div",Ie," 未注册的块类型:"+p(m.value.type)+"@"+p(m.value.compatibilityDate),1)):(d(),c("div",ke," 块已不存在 "))],64)):(d(),c("div",Be,[s(e(U),{orientation:"vertical"},{default:n(()=>[s(e(B),{class:"text-xs text-zinc-500"},b({default:n(()=>[_(" "+p(y("modalTitle")),1)]),_:2},[r("modalTitle")?{name:"tooltip",fn:n(()=>[s(e(L),{source:r("modalTitle"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(ve),{markdown:"","model-value":i.value.modalTitle,"translate-hint":y("modalTitle"),"onUpdate:modelValue":J},null,8,["model-value","translate-hint"])]),_:1}),v("div",be,[s(e(U),{orientation:"vertical"},{default:n(()=>[s(e(B),{class:"text-xs text-zinc-500"},b({default:n(()=>[_(" "+p(y("modalWidth")),1)]),_:2},[r("modalWidth")?{name:"tooltip",fn:n(()=>[s(e(L),{source:r("modalWidth"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(Q),{"model-value":i.value.modalWidth??"",placeholder:"例:720px / 60vw","onUpdate:modelValue":l[4]||(l[4]=o=>T("modalWidth",String(o)))},null,8,["model-value"])]),_:1}),s(e(U),{orientation:"vertical"},{default:n(()=>[s(e(B),{class:"text-xs text-zinc-500"},b({default:n(()=>[_(" "+p(y("modalMinHeight")),1)]),_:2},[r("modalMinHeight")?{name:"tooltip",fn:n(()=>[s(e(L),{source:r("modalMinHeight"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),s(e(Q),{"model-value":i.value.modalMinHeight??"",placeholder:"例:400px / 60vh","onUpdate:modelValue":l[5]||(l[5]=o=>T("modalMinHeight",String(o)))},null,8,["model-value"])]),_:1})]),k.value?(d(),c("div",De,[s(W,{"model-value":e(t).layouts.value,index:e(t).activeLayoutIndex.value,"onUpdate:modelValue":l[13]||(l[13]=o=>{e(t).layouts.value=o})},null,8,["model-value","index"]),v("div",Ee,[s(h,{"model-value":e(t).layouts.value,"active-index":e(t).activeLayoutIndex.value,"selected-item-ids":e(t).selectedBlockIds.value,items:e(t).blocks.value,"find-entry":e(t).findBlockMeta,"get-item-label":e(t).getBlockLabel,"picker-entries":e(t).pickerEntries.value,"can-delete":!0,"item-noun":"块","onUpdate:modelValue":l[14]||(l[14]=o=>{e(t).layouts.value=o}),"onUpdate:activeIndex":l[15]||(l[15]=o=>{e(t).activeLayoutIndex.value=o}),"onUpdate:selectedItemIds":l[16]||(l[16]=o=>{e(t).selectedBlockIds.value=o}),onAddNew:z,onDrillDown:N,onDeleteItem:w,onDeleteItems:$,onCopyItems:e(C),onPaste:e(S)},null,8,["model-value","active-index","selected-item-ids","items","find-entry","get-item-label","picker-entries","onCopyItems","onPaste"])])])):(d(),c("div",_e,[v("div",Le,[s(e(O),{class:"flex-1"},{default:n(()=>[s(K,{"model-value":e(t).layouts.value,"active-index":e(t).activeLayoutIndex.value,"onUpdate:modelValue":l[6]||(l[6]=o=>{e(t).layouts.value=o}),"onUpdate:activeIndex":l[7]||(l[7]=o=>{e(t).activeLayoutIndex.value=o})},null,8,["model-value","active-index"])]),_:1}),s(e(Y),{variant:"ghost",size:"sm",onClick:l[8]||(l[8]=o=>M())},{default:n(()=>[s(e(q),{icon:"fluent:add-20-regular",class:"size-4"}),l[18]||(l[18]=v("span",null,"新增布局",-1))]),_:1})]),v("div",Ue,[s(W,{"model-value":e(t).layouts.value,index:e(t).activeLayoutIndex.value,"onUpdate:modelValue":l[9]||(l[9]=o=>{e(t).layouts.value=o})},null,8,["model-value","index"]),v("div",Ve,[s(h,{"model-value":e(t).layouts.value,"active-index":e(t).activeLayoutIndex.value,"selected-item-ids":e(t).selectedBlockIds.value,items:e(t).blocks.value,"find-entry":e(t).findBlockMeta,"get-item-label":e(t).getBlockLabel,"picker-entries":e(t).pickerEntries.value,"can-delete":!0,"item-noun":"块","onUpdate:modelValue":l[10]||(l[10]=o=>{e(t).layouts.value=o}),"onUpdate:activeIndex":l[11]||(l[11]=o=>{e(t).activeLayoutIndex.value=o}),"onUpdate:selectedItemIds":l[12]||(l[12]=o=>{e(t).selectedBlockIds.value=o}),onAddNew:z,onDrillDown:N,onDeleteItem:w,onDeleteItems:$,onCopyItems:e(C),onPaste:e(S)},null,8,["model-value","active-index","selected-item-ids","items","find-entry","get-item-label","picker-entries","onCopyItems","onPaste"])])])]))]))],64))}});export{Se as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as V,u as T,a3 as U,c as $,w as l,b as s,o as b,j as g,a as e,_ as u,e as d,f as p,g as m,t as f,h as v,n as _,i as j,a4 as z,k as B,l as F,R as N,$ as R,a5 as C,a6 as D,a7 as H}from"./index-yvElpEK3.js";import{_ as h}from"./FieldGroup.vue_vue_type_script_setup_true_lang-CuFusz5A.js";const q={class:"grid grid-cols-2 gap-4"},L={class:"grid grid-cols-2 gap-4"},O={class:"flex items-start gap-2"},P={class:"grid grid-cols-2 gap-3"},M=V({name:"ShwfedHttpRequestConfirmActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(E){const n=T(E,"modelValue"),k=U(()=>{}),i=r=>D(k,r)??r,a=r=>H(k,r);function c(r){const t={...n.value,...r};for(const[o,x]of Object.entries(r))x===void 0&&Reflect.deleteProperty(t,o);n.value=t}const w=["onSuccess","onWarning","onError","onInfo"];function y(r,t){c({[r]:t.length===0?void 0:t})}function S(r){c({before:r.length===0?void 0:r})}return(r,t)=>(b(),$(s(h),null,{default:l(()=>[g("div",q,[e(s(u),{orientation:"vertical"},{default:l(()=>[e(s(d),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("expression")),1)]),_:2},[a("expression")?{name:"tooltip",fn:l(()=>[e(s(v),{source:a("expression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(_),{"model-value":n.value.expression,multiline:"",placeholder:"例:http.post('/api/foo').body({ id: row.id })","result-type":"HttpRequest",class:"min-h-16","onUpdate:modelValue":t[0]||(t[0]=o=>c({expression:o}))},null,8,["model-value"])]),_:1}),e(s(u),{orientation:"vertical"},{default:l(()=>[e(s(d),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("markdown")),1)]),_:2},[a("markdown")?{name:"tooltip",fn:l(()=>[e(s(v),{source:a("markdown"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(j),{markdown:"","model-value":n.value.markdown,"onUpdate:modelValue":t[1]||(t[1]=o=>c({markdown:o}))},null,8,["model-value"])]),_:1})]),e(s(u),{orientation:"vertical"},{default:l(()=>[e(s(d),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("before")),1)]),_:2},[a("before")?{name:"tooltip",fn:l(()=>[e(s(v),{source:a("before"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(z,{triggers:n.value.before??[],"onUpdate:triggers":t[2]||(t[2]=o=>S(o))},null,8,["triggers"])]),_:1}),g("div",L,[e(s(u),{orientation:"vertical"},{default:l(()=>[e(s(d),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("icon")),1)]),_:2},[a("icon")?{name:"tooltip",fn:l(()=>[e(s(v),{source:a("icon"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(B),{"model-value":n.value.icon??"","onUpdate:modelValue":t[3]||(t[3]=o=>c(o.trim()===""?{icon:void 0}:{icon:o}))},null,8,["model-value"])]),_:1}),e(s(u),{orientation:"vertical"},{default:l(()=>[e(s(d),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("color")),1)]),_:2},[a("color")?{name:"tooltip",fn:l(()=>[e(s(v),{source:a("color"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(F),{"model-value":n.value.color??"","onUpdate:modelValue":t[4]||(t[4]=o=>c(o.trim()===""?{color:void 0}:{color:o}))},null,8,["model-value"])]),_:1})]),g("div",O,[e(s(u),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:l(()=>[e(s(d),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("messageExpression")),1)]),_:2},[a("messageExpression")?{name:"tooltip",fn:l(()=>[e(s(v),{source:a("messageExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(_),{"model-value":n.value.messageExpression??"",placeholder:"例:string(json.message)","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":t[5]||(t[5]=o=>c({messageExpression:o===""?void 0:o}))},null,8,["model-value"])]),_:1}),e(s(u),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:l(()=>[e(s(d),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i("resultExpression")),1)]),_:2},[a("resultExpression")?{name:"tooltip",fn:l(()=>[e(s(v),{source:a("resultExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(s(_),{"model-value":n.value.resultExpression??"",placeholder:"例:json.code == 0 ? 'success' : 'error'","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":t[6]||(t[6]=o=>c({resultExpression:o===""?void 0:o}))},null,8,["model-value"])]),_:1})]),g("div",P,[(b(),N(R,null,C(w,o=>e(s(u),{key:o,orientation:"vertical",class:"min-w-0"},{default:l(()=>[e(s(d),{class:"text-xs text-zinc-500"},p({default:l(()=>[m(" "+f(i(o)),1)]),_:2},[a(o)?{name:"tooltip",fn:l(()=>[e(s(v),{source:a(o),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(z,{triggers:n.value[o]??[],"onUpdate:triggers":x=>y(o,x)},null,8,["triggers","onUpdate:triggers"])]),_:2},1024)),64))])]),_:1}))}});export{M as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as g,u as d,a6 as u,aG as f,R as m,a as s,w as i,b as r,o as p,e as _,g as v,t as x,a4 as h,_ as T,B as V}from"./index-yvElpEK3.js";const w={class:"flex flex-col gap-3"},C=g({name:"ShwfedEventDispatchActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(l){const t=d(l,"modelValue"),o=u(f(),"triggers")??"触发的操作",n=V(()=>t.value.triggers??[]);function c(a){const e={...t.value};a.length===0?Reflect.deleteProperty(e,"triggers"):e.triggers=a,t.value=e}return(a,e)=>(p(),m("div",w,[s(r(T),{orientation:"vertical"},{default:i(()=>[s(r(_),{class:"text-xs text-zinc-500"},{default:i(()=>[v(x(r(o)),1)]),_:1}),s(h,{triggers:n.value,"onUpdate:triggers":c},null,8,["triggers"])]),_:1})]))}});export{C as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as _,u as y,ab as x,ac as b,R as c,j as i,a as n,w as o,b as t,o as l,ad as g,ae as u,af as v,ag as D,$ as h,a5 as $,c as w,ah as S,t as p,ai as k}from"./index-yvElpEK3.js";const B={class:"flex flex-col gap-3"},C={class:"flex-1"},V={class:"ml-auto text-xs tabular-nums text-zinc-400"},N=_({name:"ShwfedPrototypeActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(m){const r=y(m,"modelValue"),f=(()=>{const s=new Map;for(const e of x){if(e.type===b||e.deprecated)continue;const a=s.get(e.type);(!a||e.compatibilityDate>a.compatibilityDate)&&s.set(e.type,{type:e.type,compatibilityDate:e.compatibilityDate,name:e.metadata.name,icon:e.metadata.icon})}return[...s.values()].sort((e,a)=>e.name.localeCompare(a.name,"zh"))})();function d(s,e){r.value={type:s,compatibilityDate:e}}return(s,e)=>(l(),c("div",B,[e[0]||(e[0]=i("p",{class:"text-xs text-zinc-500"}," 原型按钮点击后无任何副作用,用于占位。选择下方任意类型可将其转换为正式按钮 —— 此转换仅能进行一次。 ",-1)),n(t(k),null,{default:o(()=>[n(t(g),{align:"inline-start"},{default:o(()=>[n(t(u),{icon:"fluent:arrow-swap-20-regular"})]),_:1}),n(t(v),null,{default:o(()=>[n(t(D),null,{default:o(()=>[(l(!0),c(h,null,$(t(f),a=>(l(),w(t(S),{key:a.type,value:a.type,onSelect:z=>d(a.type,a.compatibilityDate)},{default:o(()=>[n(t(u),{icon:a.icon,class:"size-4 shrink-0"},null,8,["icon"]),i("span",C,p(a.name),1),i("span",V,p(a.compatibilityDate),1)]),_:2},1032,["value","onSelect"]))),128))]),_:1})]),_:1})]),_:1})]))}});export{N as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as R,u as U,aa as k,R as v,a as e,w as a,b as t,j as _,$ as j,a5 as F,o as E,e as u,f as c,g as d,t as p,h as f,n as g,_ as m,a4 as b,a6 as N,a7 as $}from"./index-yvElpEK3.js";const B={class:"flex flex-col gap-3"},D={class:"flex items-start gap-2"},H={class:"grid grid-cols-2 gap-3"},q=R({name:"ShwfedHttpRequestActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(h){const l=U(h,"modelValue"),x=k(()=>{}),i=o=>N(x,o)??o,n=o=>$(x,o),S=["onSuccess","onWarning","onError","onInfo"];function y(o){const s={...l.value};o.length===0?delete s.messageExpression:s.messageExpression=o,l.value=s}function z(o){const s={...l.value};o.length===0?delete s.resultExpression:s.resultExpression=o,l.value=s}function T(o,s){const r={...l.value};s.length===0?Reflect.deleteProperty(r,o):r[o]=s,l.value=r}function V(o){const s={...l.value};o.length===0?Reflect.deleteProperty(s,"before"):s.before=o,l.value=s}return(o,s)=>(E(),v("div",B,[e(t(m),{orientation:"vertical"},{default:a(()=>[e(t(u),{class:"text-xs text-zinc-500"},c({default:a(()=>[d(" "+p(i("expression")),1)]),_:2},[n("expression")?{name:"tooltip",fn:a(()=>[e(t(f),{source:n("expression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(t(g),{"model-value":l.value.expression,multiline:"",placeholder:"例:http.post('/api/foo').body({ id: row.id })","result-type":"HttpRequest",class:"min-h-16","onUpdate:modelValue":s[0]||(s[0]=r=>l.value={...l.value,expression:r})},null,8,["model-value"])]),_:1}),e(t(m),{orientation:"vertical"},{default:a(()=>[e(t(u),{class:"text-xs text-zinc-500"},c({default:a(()=>[d(" "+p(i("before")),1)]),_:2},[n("before")?{name:"tooltip",fn:a(()=>[e(t(f),{source:n("before"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(b,{triggers:l.value.before??[],"onUpdate:triggers":s[1]||(s[1]=r=>V(r))},null,8,["triggers"])]),_:1}),_("div",D,[e(t(m),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:a(()=>[e(t(u),{class:"text-xs text-zinc-500"},c({default:a(()=>[d(" "+p(i("messageExpression")),1)]),_:2},[n("messageExpression")?{name:"tooltip",fn:a(()=>[e(t(f),{source:n("messageExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(t(g),{"model-value":l.value.messageExpression??"",placeholder:"例:string(json.message)","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":y},null,8,["model-value"])]),_:1}),e(t(m),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:a(()=>[e(t(u),{class:"text-xs text-zinc-500"},c({default:a(()=>[d(" "+p(i("resultExpression")),1)]),_:2},[n("resultExpression")?{name:"tooltip",fn:a(()=>[e(t(f),{source:n("resultExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(t(g),{"model-value":l.value.resultExpression??"",placeholder:"例:json.code == 0 ? 'success' : 'error'","result-type":"string","extra-vars":{json:{type:"dyn",label:"HTTP 响应体(已解析 JSON)"}},"onUpdate:modelValue":z},null,8,["model-value"])]),_:1})]),_("div",H,[(E(),v(j,null,F(S,r=>e(t(m),{key:r,orientation:"vertical",class:"min-w-0"},{default:a(()=>[e(t(u),{class:"text-xs text-zinc-500"},c({default:a(()=>[d(" "+p(i(r)),1)]),_:2},[n(r)?{name:"tooltip",fn:a(()=>[e(t(f),{source:n(r),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(b,{triggers:l.value[r]??[],"onUpdate:triggers":w=>T(r,w)},null,8,["triggers","onUpdate:triggers"])]),_:2},1024)),64))])]))}});export{q as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as k,u as b,aj as S,R as m,a as e,w as l,b as a,o as f,e as _,f as v,g as i,t as r,h as p,n as V,_ as x,ak as h,al as w,am as y,an as z,$ as D,a5 as N,ao as T,a6 as C,a7 as F}from"./index-yvElpEK3.js";const M={class:"flex flex-col gap-3"},B=k({name:"ShwfedNavigationActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(g){const t=b(g,"modelValue"),c=S(()=>{}),d=o=>C(c,o)??o,n=o=>F(c,o),$=[{value:"_self",label:"当前页面打开"},{value:"_blank",label:"新页面打开"}];return(o,u)=>(f(),m("div",M,[e(a(x),{orientation:"vertical"},{default:l(()=>[e(a(_),{class:"text-xs text-zinc-500"},v({default:l(()=>[i(" "+r(d("url")),1)]),_:2},[n("url")?{name:"tooltip",fn:l(()=>[e(a(p),{source:n("url"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(a(V),{"model-value":t.value.url??"",placeholder:"例:'/detail/' + string(row.id)","result-type":"string",multiline:"",class:"min-h-10","onUpdate:modelValue":u[0]||(u[0]=s=>t.value={...t.value,url:s})},null,8,["model-value"])]),_:1}),e(a(x),{orientation:"vertical"},{default:l(()=>[e(a(_),{class:"text-xs text-zinc-500"},v({default:l(()=>[i(" "+r(d("mode")),1)]),_:2},[n("mode")?{name:"tooltip",fn:l(()=>[e(a(p),{source:n("mode"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),e(a(h),{"model-value":t.value.mode??"_self","onUpdate:modelValue":u[1]||(u[1]=s=>t.value={...t.value,mode:s})},{default:l(()=>[e(a(w),{class:"w-full"},{default:l(()=>[e(a(y))]),_:1}),e(a(z),null,{default:l(()=>[(f(),m(D,null,N($,s=>e(a(T),{key:s.value,value:s.value},{default:l(()=>[i(r(s.label),1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])]),_:1})]))}});export{B as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as k,u as y,aH as U,R as V,j as x,a as t,w as n,b as s,$ as D,a5 as F,o as z,e as i,g as u,h as c,n as d,_ as p,aI as g,f,t as _,a4 as H,a6 as $,a7 as B,B as S}from"./index-yvElpEK3.js";const C={class:"flex flex-col gap-3"},L={class:"grid grid-cols-2 gap-3"},N={class:"flex items-start gap-2"},I={class:"grid grid-cols-2 gap-3"},A=k({name:"ShwfedHttpDownloadActionConfig",__name:"config",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(j){const l=y(j,"modelValue"),E=U(()=>{}),m=a=>$(E,a)??a,r=a=>B(E,a),q=["onSuccess","onWarning","onError","onInfo"],h=S({get:()=>l.value.template?.request??"",set:a=>{l.value={...l.value,template:{...l.value.template,request:a}}}}),w=S({get:()=>l.value.template?.download??"",set:a=>{const e=l.value.template??{request:""};if(a.length===0){const{download:o,...v}=e;l.value={...l.value,template:v}}else l.value={...l.value,template:{...e,download:a}}}});function R(a){const e={...l.value};a.length===0?delete e.messageExpression:e.messageExpression=a,l.value=e}function b(a){const e={...l.value};a.length===0?delete e.resultExpression:e.resultExpression=a,l.value=e}function T(a,e){const o={...l.value};e.length===0?Reflect.deleteProperty(o,a):o[a]=e,l.value=o}return(a,e)=>(z(),V("div",C,[x("div",L,[t(s(p),{orientation:"vertical"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},{tooltip:n(()=>[t(s(c),{source:r("template")??"返回 `HttpRequest` 的 CEL 表达式;未配置「下载请求」时直接下载其响应",block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),default:n(()=>[e[2]||(e[2]=u(" 请求 ",-1))]),_:1}),t(s(d),{"model-value":h.value,multiline:"",placeholder:"例:http.get('https://api.example.com/files/123')","result-type":"HttpRequest",class:"min-h-16","onUpdate:modelValue":e[0]||(e[0]=o=>h.value=o)},null,8,["model-value"])]),_:1}),t(s(p),{orientation:"vertical"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},{tooltip:n(()=>[t(s(c),{source:"可选的第二步:用第一步响应 `json` 中的凭据构造真正的下载请求,例如 `json.data.key`",block:"",class:"prose prose-sm prose-zinc"})]),default:n(()=>[e[3]||(e[3]=u(" 下载请求 ",-1))]),_:1}),t(s(d),{"model-value":w.value,multiline:"",placeholder:"例:http.get('https://api.example.com/download').query('key', json.data.key)","result-type":"HttpRequest","extra-vars":{json:s(g)},class:"min-h-16","onUpdate:modelValue":e[1]||(e[1]=o=>w.value=o)},null,8,["model-value","extra-vars"])]),_:1})]),x("div",N,[t(s(p),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},f({default:n(()=>[u(" "+_(m("messageExpression")),1)]),_:2},[r("messageExpression")?{name:"tooltip",fn:n(()=>[t(s(c),{source:r("messageExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),t(s(d),{"model-value":l.value.messageExpression??"",placeholder:"例:string(json.message)","result-type":"string","extra-vars":{json:s(g)},"onUpdate:modelValue":R},null,8,["model-value","extra-vars"])]),_:1}),t(s(p),{orientation:"vertical",class:"flex-1 basis-0 min-w-0"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},f({default:n(()=>[u(" "+_(m("resultExpression")),1)]),_:2},[r("resultExpression")?{name:"tooltip",fn:n(()=>[t(s(c),{source:r("resultExpression"),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),t(s(d),{"model-value":l.value.resultExpression??"",placeholder:"例:json.code == 0 ? 'success' : 'error'","result-type":"string","extra-vars":{json:s(g)},"onUpdate:modelValue":b},null,8,["model-value","extra-vars"])]),_:1})]),x("div",I,[(z(),V(D,null,F(q,o=>t(s(p),{key:o,orientation:"vertical",class:"min-w-0"},{default:n(()=>[t(s(i),{class:"text-xs text-zinc-500"},f({default:n(()=>[u(" "+_(m(o)),1)]),_:2},[r(o)?{name:"tooltip",fn:n(()=>[t(s(c),{source:r(o),block:"",class:"prose prose-sm prose-zinc"},null,8,["source"])]),key:"0"}:void 0]),1024),t(H,{triggers:l.value[o]??[],"onUpdate:triggers":v=>T(o,v)},null,8,["triggers","onUpdate:triggers"])]),_:2},1024)),64))])]))}});export{A as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ba as e}from"./index-yvElpEK3.js";import{bb as f,bc as r,bd as s}from"./index-yvElpEK3.js";export{f as TableConfig,r as createTableConfig,e as default,s as getColumnTechnicalKey};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as H,P as et,Q as it,o as nt,R as st,S as at,b as D,A as P,B as j,x as rt,T as ot,U as W,V as lt,y as ct,W as z,X as ht}from"./index-yvElpEK3.js";const dt=String.raw,pt=(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0})(),ut=typeof CSS<"u"&&CSS.supports&&CSS.supports("line-height","mod(1,1)"),k=typeof matchMedia<"u"?matchMedia("(prefers-reduced-motion: reduce)"):null,C="--_number-flow-d-opacity",V="--_number-flow-d-width",S="--_number-flow-dx",L="--_number-flow-d",mt=(()=>{try{return CSS.registerProperty({name:C,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:S,syntax:"<length>",inherits:!0,initialValue:"0px"}),CSS.registerProperty({name:V,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:L,syntax:"<number>",inherits:!0,initialValue:"0"}),!0}catch{return!1}})(),U="round(nearest, calc(var(--number-flow-mask-height, 0.25em) / 2), 1px)",v=`calc(${U} * 2)`,R="var(--number-flow-mask-width, 0.5em)",y=`calc(${R} / var(--scale-x))`,$="#000 0, transparent 71%",ft=dt`:host{display:inline-block;direction:ltr;white-space:nowrap;isolation:isolate;line-height:1}.number,.number__inner{display:inline-block;transform-origin:left top}:host([data-will-change]) :is(.number,.number__inner,.section,.digit,.digit__num,.symbol){will-change:transform}.number{--scale-x:calc(1 + var(${V}) / var(--width));transform:translateX(var(${S})) scaleX(var(--scale-x));margin:0 calc(-1 * ${R});position:relative;-webkit-mask-image:linear-gradient(to right,transparent 0,#000 ${y},#000 calc(100% - ${y}),transparent ),linear-gradient(to bottom,transparent 0,#000 ${v},#000 calc(100% - ${v}),transparent 100% ),radial-gradient(at bottom right,${$}),radial-gradient(at bottom left,${$}),radial-gradient(at top left,${$}),radial-gradient(at top right,${$});-webkit-mask-size:100% calc(100% - ${v} * 2),calc(100% - ${y} * 2) 100%,${y} ${v},${y} ${v},${y} ${v},${y} ${v};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat}.number__inner{padding:${U} ${R};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${S})))}:host > :not(.number){z-index:5}.section,.symbol{display:inline-block;position:relative;isolation:isolate}.section::after{content:'\200b';display:inline-block}.section--justify-left{transform-origin:center left}.section--justify-right{transform-origin:center right}.section > [inert],.symbol > [inert]{margin:0 !important;position:absolute !important;z-index:-1}.digit{display:inline-block;position:relative;--c:var(--current) + var(${L})}.digit__num,.number .section::after{padding:${U} 0}.digit__num{display:inline-block;--offset-raw:mod(var(--length) + var(--n) - mod(var(--c),var(--length)),var(--length));--offset:calc( var(--offset-raw) - var(--length) * round(down,var(--offset-raw) / (var(--length) / 2),1) );--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y))}.digit__num[inert]{position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y))}.digit:not(.is-spinning) .digit__num[inert]{display:none}.symbol__value{display:inline-block;mix-blend-mode:plus-lighter;white-space:pre}.section--justify-left .symbol > [inert]{left:0}.section--justify-right .symbol > [inert]{right:0}.animate-presence{opacity:calc(1 + var(${C}))}`,gt=HTMLElement,vt=(s,t)=>s==null?t:t==null?s:Math.max(s,t),A=new WeakMap,jt={onUpdate(s,t,e){if(A.set(e,void 0),!e.computedTrend)return;const i=t.integer.concat(t.fraction).filter(o=>o.type==="integer"||o.type==="fraction"),n=s.integer.concat(s.fraction).filter(o=>o.type==="integer"||o.type==="fraction"),r=i.find(o=>!n.find(c=>c.pos===o.pos&&c.value===o.value)),a=n.find(o=>!i.find(c=>o.pos===c.pos&&o.value===c.value));A.set(e,vt(r?.pos,a?.pos))},getDelta(s,t,e){const i=s-t,n=A.get(e.flow);if(!i&&n!=null&&n>=e.pos)return e.length*e.flow.computedTrend}},g=(s,t,e)=>{const i=document.createElement(s),[n,r]=Array.isArray(t)?[void 0,t]:[t,e];return n&&Object.assign(i,n),r?.forEach(a=>i.appendChild(a)),i},yt=(s,t)=>{var e;return t==="left"?s.offsetLeft:(((e=s.offsetParent instanceof HTMLElement?s.offsetParent:null)==null?void 0:e.offsetWidth)??0)-s.offsetWidth-s.offsetLeft},wt=s=>s.offsetWidth>0&&s.offsetHeight>0,_t=(s,t)=>{!customElements.get(s)&&customElements.define(s,t)};function bt(s,t,{reverse:e=!1}={}){const i=s.length;for(let n=e?i-1:0;e?n>=0:n<i;e?n--:n++)t(s[n],n)}function $t(s,t,e,i){const n=t.formatToParts(s);e&&n.unshift({type:"prefix",value:e}),i&&n.push({type:"suffix",value:i});const r=[],a=[],o=[],c=[],l={},d=p=>`${p}:${l[p]=(l[p]??-1)+1}`;let m="",_=!1,b=!1;for(const p of n){m+=p.value;const h=p.type==="minusSign"||p.type==="plusSign"?"sign":p.type;h==="integer"?(_=!0,a.push(...p.value.split("").map(T=>({type:h,value:parseInt(T)})))):h==="group"?a.push({type:h,value:p.value}):h==="decimal"?(b=!0,o.push({type:h,value:p.value,key:d(h)})):h==="fraction"?o.push(...p.value.split("").map(T=>({type:h,value:parseInt(T),key:d(h),pos:-1-l[h]}))):(_||b?c:r).push({type:h,value:p.value,key:d(h)})}const F=[];for(let p=a.length-1;p>=0;p--){const h=a[p];F.unshift(h.type==="integer"?{...h,key:d(h.type),pos:l[h.type]}:{...h,key:d(h.type)})}return{pre:r,integer:F,fraction:o,post:c,valueAsString:m,value:typeof s=="string"?parseFloat(s):s}}const Y=ut&&pt&&mt;let u=class extends gt{constructor(){super(),this.created=!1,this.batched=!1;const{animated:t,...e}=this.constructor.defaultProps;this._animated=this.computedAnimated=t,Object.assign(this,e)}get animated(){return this._animated}set animated(t){var e;this.animated!==t&&(this._animated=t,(e=this.shadowRoot)==null||e.getAnimations().forEach(i=>i.finish()))}set data(t){var e,i;if(t==null)return;const{pre:n,integer:r,fraction:a,post:o,value:c}=t;if(this.created){const l=this._data;this._data=t,this.computedTrend=typeof this.trend=="function"?this.trend(l.value,c):this.trend,this.computedAnimated=Y&&this._animated&&(!this.respectMotionPreference||!((e=k)!=null&&e.matches))&&wt(this)&&this.ownerDocument.visibilityState==="visible",(i=this.plugins)==null||i.forEach(d=>{var m;return(m=d.onUpdate)==null?void 0:m.call(d,t,l,this)}),this.batched||this.willUpdate(),this._pre.update(n),this._num.update({integer:r,fraction:a}),this._post.update(o),this.batched||this.didUpdate()}else{this._data=t,this.attachShadow({mode:"open"});try{this._internals??(this._internals=this.attachInternals()),this._internals.role="img"}catch{}const l=document.createElement("style");this.nonce&&(l.nonce=this.nonce),l.textContent=ft,this.shadowRoot.appendChild(l),this._pre=new O(this,n,{justify:"right",part:"left"}),this.shadowRoot.appendChild(this._pre.el),this._num=new xt(this,r,a),this.shadowRoot.appendChild(this._num.el),this._post=new O(this,o,{justify:"left",part:"right"}),this.shadowRoot.appendChild(this._post.el),this.created=!0}try{this._internals.ariaLabel=t.valueAsString}catch{}}willUpdate(){this._pre.willUpdate(),this._num.willUpdate(),this._post.willUpdate()}didUpdate(){if(!this.computedAnimated)return;this._abortAnimationsFinish?this._abortAnimationsFinish.abort():this.dispatchEvent(new Event("animationsstart")),this._pre.didUpdate(),this._num.didUpdate(),this._post.didUpdate();const t=new AbortController;Promise.all(this.shadowRoot.getAnimations().map(e=>e.finished)).then(()=>{t.signal.aborted||(this.dispatchEvent(new Event("animationsfinish")),this._abortAnimationsFinish=void 0)}),this._abortAnimationsFinish=t}};u.defaultProps={transformTiming:{duration:900,easing:"linear(0,.005,.019,.039,.066,.096,.129,.165,.202,.24,.278,.316,.354,.39,.426,.461,.494,.526,.557,.586,.614,.64,.665,.689,.711,.731,.751,.769,.786,.802,.817,.831,.844,.856,.867,.877,.887,.896,.904,.912,.919,.925,.931,.937,.942,.947,.951,.955,.959,.962,.965,.968,.971,.973,.976,.978,.98,.981,.983,.984,.986,.987,.988,.989,.99,.991,.992,.992,.993,.994,.994,.995,.995,.996,.996,.9963,.9967,.9969,.9972,.9975,.9977,.9979,.9981,.9982,.9984,.9985,.9987,.9988,.9989,1)"},spinTiming:void 0,opacityTiming:{duration:450,easing:"ease-out"},animated:!0,trend:(s,t)=>Math.sign(t-s),respectMotionPreference:!0,plugins:void 0,digits:void 0};class xt{constructor(t,e,i,{className:n,...r}={}){this.flow=t,this._integer=new I(t,e,{justify:"right",part:"integer"}),this._fraction=new I(t,i,{justify:"left",part:"fraction"}),this._inner=g("span",{className:"number__inner"},[this._integer.el,this._fraction.el]),this.el=g("span",{...r,part:"number",className:`number ${n??""}`},[this._inner])}willUpdate(){this._prevWidth=this.el.offsetWidth,this._prevLeft=this.el.getBoundingClientRect().left,this._integer.willUpdate(),this._fraction.willUpdate()}update({integer:t,fraction:e}){this._integer.update(t),this._fraction.update(e)}didUpdate(){const t=this.el.getBoundingClientRect();this._integer.didUpdate(),this._fraction.didUpdate();const e=this._prevLeft-t.left,i=this.el.offsetWidth,n=this._prevWidth-i;this.el.style.setProperty("--width",String(i)),this.el.animate({[S]:[`${e}px`,"0px"],[V]:[n,0]},{...this.flow.transformTiming,composite:"accumulate"})}}let G=class{constructor(t,e,{justify:i,className:n,...r},a){this.flow=t,this.children=new Map,this.onCharRemove=c=>()=>{this.children.delete(c)},this.justify=i;const o=e.map(c=>this.addChar(c).el);this.el=g("span",{...r,className:`section section--justify-${i} ${n??""}`},a?a(o):o)}addChar(t,{startDigitsAtZero:e=!1,...i}={}){const n=t.type==="integer"||t.type==="fraction"?new q(this,t.type,e?0:t.value,t.pos,{...i,onRemove:this.onCharRemove(t.key)}):new kt(this,t.type,t.value,{...i,onRemove:this.onCharRemove(t.key)});return this.children.set(t.key,n),n}unpop(t){t.el.removeAttribute("inert"),t.el.style.top="",t.el.style[this.justify]=""}pop(t){t.forEach(e=>{e.el.style.top=`${e.el.offsetTop}px`,e.el.style[this.justify]=`${yt(e.el,this.justify)}px`}),t.forEach(e=>{e.el.setAttribute("inert",""),e.present=!1})}addNewAndUpdateExisting(t){const e=new Map,i=new Map,n=this.justify==="left",r=n?"prepend":"append";if(bt(t,a=>{let o;this.children.has(a.key)?(o=this.children.get(a.key),i.set(a,o),this.unpop(o),o.present=!0):(o=this.addChar(a,{startDigitsAtZero:!0,animateIn:!0}),e.set(a,o)),this.el[r](o.el)},{reverse:n}),this.flow.computedAnimated){const a=this.el.getBoundingClientRect();e.forEach(o=>{o.willUpdate(a)})}e.forEach((a,o)=>{a.update(o.value)}),i.forEach((a,o)=>{a.update(o.value)})}willUpdate(){const t=this.el.getBoundingClientRect();this._prevOffset=t[this.justify],this.children.forEach(e=>e.willUpdate(t))}didUpdate(){const t=this.el.getBoundingClientRect();this.children.forEach(n=>n.didUpdate(t));const e=t[this.justify],i=this._prevOffset-e;i&&this.children.size&&this.el.animate({transform:[`translateX(${i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}};class I extends G{update(t){const e=new Map;this.children.forEach((i,n)=>{t.find(r=>r.key===n)||e.set(n,i),this.unpop(i)}),this.addNewAndUpdateExisting(t),e.forEach(i=>{i instanceof q&&i.update(0)}),this.pop(e)}}class O extends G{update(t){const e=new Map;this.children.forEach((i,n)=>{t.find(r=>r.key===n)||e.set(n,i)}),this.pop(e),this.addNewAndUpdateExisting(t)}}class M{constructor(t,e,{onRemove:i,animateIn:n=!1}={}){this.flow=t,this.el=e,this._present=!0,this._remove=()=>{var r;this.el.remove(),(r=this._onRemove)==null||r.call(this)},this.el.classList.add("animate-presence"),this.flow.computedAnimated&&n&&this.el.animate({[C]:[-.9999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),this._onRemove=i}get present(){return this._present}set present(t){if(this._present!==t){if(this._present=t,t?this.el.removeAttribute("inert"):this.el.setAttribute("inert",""),!this.flow.computedAnimated){t||this._remove();return}this.el.style.setProperty("--_number-flow-d-opacity",t?"0":"-.999"),this.el.animate({[C]:t?[-.9999,0]:[.999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),t?this.flow.removeEventListener("animationsfinish",this._remove):this.flow.addEventListener("animationsfinish",this._remove,{once:!0})}}}class Z extends M{constructor(t,e,i,n){super(t.flow,i,n),this.section=t,this.value=e,this.el=i}}class q extends Z{constructor(t,e,i,n,r){var a,o;const c=(((o=(a=t.flow.digits)==null?void 0:a[n])==null?void 0:o.max)??9)+1,l=Array.from({length:c}).map((m,_)=>{const b=g("span",{className:"digit__num"},[document.createTextNode(String(_))]);return _!==i&&b.setAttribute("inert",""),b.style.setProperty("--n",String(_)),b}),d=g("span",{part:`digit ${e}-digit`,className:"digit"},l);d.style.setProperty("--current",String(i)),d.style.setProperty("--length",String(c)),super(t,i,d,r),this.pos=n,this._onAnimationsFinish=()=>{this.el.classList.remove("is-spinning")},this._numbers=l,this.length=c}willUpdate(t){const e=this.el.getBoundingClientRect();this._prevValue=this.value;const i=e[this.section.justify]-t[this.section.justify],n=e.width/2;this._prevCenter=this.section.justify==="left"?i+n:i-n}update(t){this.el.style.setProperty("--current",String(t)),this._numbers.forEach((e,i)=>i===t?e.removeAttribute("inert"):e.setAttribute("inert","")),this.value=t}didUpdate(t){const e=this.el.getBoundingClientRect(),i=e[this.section.justify]-t[this.section.justify],n=e.width/2,r=this.section.justify==="left"?i+n:i-n,a=this._prevCenter-r;a&&this.el.animate({transform:[`translateX(${a}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"});const o=this.getDelta();o&&(this.el.classList.add("is-spinning"),this.el.animate({[L]:[-o,0]},{...this.flow.spinTiming??this.flow.transformTiming,composite:"accumulate"}),this.flow.addEventListener("animationsfinish",this._onAnimationsFinish,{once:!0}))}getDelta(){var t;if(this.flow.plugins)for(const n of this.flow.plugins){const r=(t=n.getDelta)==null?void 0:t.call(n,this.value,this._prevValue,this);if(r!=null)return r}const e=this.value-this._prevValue,i=this.flow.computedTrend||Math.sign(e);return i<0&&this.value>this._prevValue?this.value-this.length-this._prevValue:i>0&&this.value<this._prevValue?this.length-this._prevValue+this.value:e}}class kt extends Z{constructor(t,e,i,n){const r=g("span",{className:"symbol__value",textContent:i});super(t,i,g("span",{part:`symbol ${e}`,className:"symbol"},[r]),n),this.type=e,this._children=new Map,this._onChildRemove=a=>()=>{this._children.delete(a)},this._children.set(i,new M(this.flow,r,{onRemove:this._onChildRemove(i)}))}willUpdate(t){if(this.type==="decimal")return;const e=this.el.getBoundingClientRect();this._prevOffset=e[this.section.justify]-t[this.section.justify]}update(t){if(this.value!==t){const e=this._children.get(this.value);e&&(e.present=!1);const i=this._children.get(t);if(i)i.present=!0;else{const n=g("span",{className:"symbol__value",textContent:t});this.el.appendChild(n),this._children.set(t,new M(this.flow,n,{animateIn:!0,onRemove:this._onChildRemove(t)}))}}this.value=t}didUpdate(t){if(this.type==="decimal")return;const e=this.el.getBoundingClientRect()[this.section.justify]-t[this.section.justify],i=this._prevOffset-e;i&&this.el.animate({transform:[`translateX(${i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}const X=String.raw;(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0})();typeof CSS<"u"&&CSS.supports&&CSS.supports("line-height","mod(1,1)");typeof matchMedia<"u"&&matchMedia("(prefers-reduced-motion: reduce)");const J="--_number-flow-d-opacity",Q="--_number-flow-d-width",N="--_number-flow-dx",K="--_number-flow-d";(()=>{try{return CSS.registerProperty({name:J,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:N,syntax:"<length>",inherits:!0,initialValue:"0px"}),CSS.registerProperty({name:Q,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:K,syntax:"<number>",inherits:!0,initialValue:"0"}),!0}catch{return!1}})();const E="round(nearest, calc(var(--number-flow-mask-height, 0.25em) / 2), 1px)",f=`calc(${E} * 2)`,B="var(--number-flow-mask-width, 0.5em)",w=`calc(${B} / var(--scale-x))`,x="#000 0, transparent 71%",Ct=X`:host{display:inline-block;direction:ltr;white-space:nowrap;isolation:isolate;line-height:1}.number,.number__inner{display:inline-block;transform-origin:left top}:host([data-will-change]) :is(.number,.number__inner,.section,.digit,.digit__num,.symbol){will-change:transform}.number{--scale-x:calc(1 + var(${Q}) / var(--width));transform:translateX(var(${N})) scaleX(var(--scale-x));margin:0 calc(-1 * ${B});position:relative;-webkit-mask-image:linear-gradient(to right,transparent 0,#000 ${w},#000 calc(100% - ${w}),transparent ),linear-gradient(to bottom,transparent 0,#000 ${f},#000 calc(100% - ${f}),transparent 100% ),radial-gradient(at bottom right,${x}),radial-gradient(at bottom left,${x}),radial-gradient(at top left,${x}),radial-gradient(at top right,${x});-webkit-mask-size:100% calc(100% - ${f} * 2),calc(100% - ${w} * 2) 100%,${w} ${f},${w} ${f},${w} ${f},${w} ${f};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat}.number__inner{padding:${E} ${B};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${N})))}:host > :not(.number){z-index:5}.section,.symbol{display:inline-block;position:relative;isolation:isolate}.section::after{content:'\200b';display:inline-block}.section--justify-left{transform-origin:center left}.section--justify-right{transform-origin:center right}.section > [inert],.symbol > [inert]{margin:0 !important;position:absolute !important;z-index:-1}.digit{display:inline-block;position:relative;--c:var(--current) + var(${K})}.digit__num,.number .section::after{padding:${E} 0}.digit__num{display:inline-block;--offset-raw:mod(var(--length) + var(--n) - mod(var(--c),var(--length)),var(--length));--offset:calc( var(--offset-raw) - var(--length) * round(down,var(--offset-raw) / (var(--length) / 2),1) );--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y))}.digit__num[inert]{position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y))}.digit:not(.is-spinning) .digit__num[inert]{display:none}.symbol__value{display:inline-block;mix-blend-mode:plus-lighter;white-space:pre}.section--justify-left .symbol > [inert]{left:0}.section--justify-right .symbol > [inert]{right:0}.animate-presence{opacity:calc(1 + var(${J}))}`,St=X`:host{display:inline-block;direction:ltr;white-space:nowrap;line-height:1}span{display:inline-block}:host([data-will-change]) span{will-change:transform}.number,.digit{padding:${E} 0}.symbol{white-space:pre}`,Et=(s="")=>X`:where(number-flow${s}){line-height:1}number-flow${s} > span{font-kerning:none;display:inline-block;padding:${f} 0}`,Tt=s=>[St,Et(s),Ct],tt=Symbol(),Mt=H({__name:"NumberFlowGroup",setup(s){const t=new Set;let e=!1;return lt(tt,(i,n)=>{t.add(i),ct(n,async()=>{e||(e=!0,t.forEach(async r=>{var a;!r.value||!r.value.created||(r.value.willUpdate(),await z(),(a=r.value)==null||a.didUpdate())}),await z(),e=!1)}),ht(()=>{t.delete(i)})}),(i,n)=>et(i.$slots,"default")}}),At=["batched","trend","plugins","animated","transformTiming","spinTiming","opacityTiming","respectMotionPreference","nonce","data-will-change","digits","innerHTML","data"],Nt=H({inheritAttrs:!1,__name:"index",props:{transformTiming:{default:()=>u.defaultProps.transformTiming},spinTiming:{default:()=>u.defaultProps.spinTiming},opacityTiming:{default:()=>u.defaultProps.opacityTiming},animated:{type:Boolean,default:()=>u.defaultProps.animated},respectMotionPreference:{type:Boolean,default:()=>u.defaultProps.respectMotionPreference},trend:{type:[Number,Function],default:()=>u.defaultProps.trend},plugins:{default:()=>u.defaultProps.plugins},digits:{default:()=>u.defaultProps.digits},locales:{},format:{},value:{},prefix:{},suffix:{},nonce:{},willChange:{type:Boolean,default:!1}},emits:["animationsstart","animationsfinish"],setup(s,{expose:t,emit:e}){const i=P();t({el:i});const n=e,r=j(()=>new Intl.NumberFormat(s.locales,s.format)),a=j(()=>$t(s.value,r.value,s.prefix,s.suffix)),o=void 0,c=it(tt,void 0);return c?.(i,a),(l,d)=>(nt(),st("number-flow-vue",at({ref_key:"el",ref:i},l.$attrs,{batched:!!D(c),trend:l.trend,plugins:l.plugins,animated:l.animated,transformTiming:l.transformTiming,spinTiming:l.spinTiming,opacityTiming:l.opacityTiming,respectMotionPreference:l.respectMotionPreference,nonce:l.nonce,"data-will-change":l.willChange?"":void 0,digits:l.digits,innerHTML:D(o),"data-allow-mismatch":"",onAnimationsstart:d[0]||(d[0]=m=>n("animationsstart")),onAnimationsfinish:d[1]||(d[1]=m=>n("animationsfinish")),data:a.value}),null,16,At))}}),Bt=Tt("-vue");_t("number-flow-vue",u);function Vt({respectMotionPreference:s=!0}={}){const t=P(!1),e=P(!1);return rt(()=>{var i;t.value=Y,e.value=((i=k)==null?void 0:i.matches)??!1}),ot(i=>{var n;if(!W(s))return;const r=({matches:a})=>{e.value=a};(n=k)==null||n.addEventListener("change",r),i(()=>{var a;(a=k)==null||a.removeEventListener("change",r)})}),j(()=>t.value&&(!W(s)||!e.value))}export{u as NumberFlowElement,Mt as NumberFlowGroup,jt as continuous,Nt as default,Bt as styles,Vt as useCanAnimate};
|