@shwfed/config 2.7.2 → 2.7.4

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.
Files changed (80) hide show
  1. package/dist/mcp.mjs +1106 -1019
  2. package/dist/module.json +1 -1
  3. package/dist/preview/assets/badge-BKq7Eh7r.js +1 -0
  4. package/dist/preview/assets/{config-OQtpit00.js → config-C2XmKu42.js} +1 -1
  5. package/dist/preview/assets/{config-D8tXo17l.js → config-C31gRv6X.js} +1 -1
  6. package/dist/preview/assets/{config-DtCRvYa9.js → config-CXomiRuI.js} +1 -1
  7. package/dist/preview/assets/{config-B-uvT_pb.js → config-CnsvNcA2.js} +1 -1
  8. package/dist/preview/assets/{config-D9pA2oC8.js → config-DD3McP6M.js} +1 -1
  9. package/dist/preview/assets/{config-BRiILJ2a.js → config-DM58--pQ.js} +1 -1
  10. package/dist/preview/assets/{config-dtgP-3mj.js → config-De_RAxft.js} +1 -1
  11. package/dist/preview/assets/{config-QHRydAV_.js → config-Dg3cJb4i.js} +1 -1
  12. package/dist/preview/assets/{config-CbMKku2N.js → config-DpTBe8_L.js} +1 -1
  13. package/dist/preview/assets/{definition.vue_vue_type_script_setup_true_lang-Dp8O3US_.js → definition.vue_vue_type_script_setup_true_lang-D-K8Bmbj.js} +1 -1
  14. package/dist/preview/assets/{index-BWNTkzpm.js → index-4Jigs5K_.js} +1 -1
  15. package/dist/preview/assets/{index-BBJQYeyQ.js → index-CfwL2UCH.js} +175 -175
  16. package/dist/preview/assets/index-DNHGrCDe.css +1 -0
  17. package/dist/preview/assets/index-DUo1pTg2.js +1 -0
  18. package/dist/preview/assets/{item-BpzTGOEt.js → item-DnUV5B-b.js} +1 -1
  19. package/dist/preview/assets/{runtime-Busbr90M.js → runtime-BCxzICuW.js} +1 -1
  20. package/dist/preview/assets/{runtime-DMsEFiBw.js → runtime-BqhvXsJ-.js} +1 -1
  21. package/dist/preview/assets/{runtime-DfP3qvGT.js → runtime-CG4uOgGu.js} +1 -1
  22. package/dist/preview/assets/{runtime-By0VH4uC.js → runtime-ChaoQZI9.js} +1 -1
  23. package/dist/preview/assets/{runtime-C29fORZL.js → runtime-DAfJmoV1.js} +1 -1
  24. package/dist/preview/assets/{runtime-BjB2wvFX.js → runtime-Dhi2Tk84.js} +1 -1
  25. package/dist/preview/assets/{runtime-B5S6icpw.js → runtime-Dj43RjZC.js} +1 -1
  26. package/dist/preview/assets/{runtime-BDyVuoP3.js → runtime-DnlIppMg.js} +1 -1
  27. package/dist/preview/assets/{runtime-DiTvLHpE.js → runtime-W5CcSnyo.js} +1 -1
  28. package/dist/preview/index.html +2 -2
  29. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/config.d.vue.ts +2 -0
  30. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/config.vue +27 -0
  31. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/config.vue.d.ts +2 -0
  32. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/runtime.d.vue.ts +2 -0
  33. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/runtime.vue +18 -0
  34. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/runtime.vue.d.ts +2 -0
  35. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/schema.d.ts +2 -1
  36. package/dist/runtime/components/config/blocks/2026-05-06/com.shwfed.block.markdown/schema.js +10 -1
  37. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/badge.vue +11 -1
  38. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.d.vue.ts +2 -0
  39. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.vue +48 -21
  40. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/config.vue.d.ts +2 -0
  41. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/runtime.d.vue.ts +2 -0
  42. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/runtime.vue.d.ts +2 -0
  43. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.d.ts +2 -0
  44. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.card/schema.js +11 -0
  45. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/config.d.vue.ts +34 -0
  46. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/config.vue +153 -0
  47. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/config.vue.d.ts +34 -0
  48. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.d.vue.ts +34 -0
  49. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.vue +41 -0
  50. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/runtime.vue.d.ts +34 -0
  51. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/schema.d.ts +33 -0
  52. package/dist/runtime/components/config/blocks/2026-06-02/com.shwfed.block.icon/schema.js +45 -0
  53. package/dist/runtime/components/config/config.vue +135 -22
  54. package/dist/runtime/components/config/index.d.vue.ts +4 -0
  55. package/dist/runtime/components/config/index.vue +26 -2
  56. package/dist/runtime/components/config/index.vue.d.ts +4 -0
  57. package/dist/runtime/components/config/schema.d.ts +20 -0
  58. package/dist/runtime/components/config/schema.js +15 -1
  59. package/dist/runtime/components/form/FormUnitRenderer.vue +2 -8
  60. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.d.vue.ts +2 -2
  61. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-remote/config.vue.d.ts +2 -2
  62. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.d.vue.ts +2 -2
  63. package/dist/runtime/components/table/columns/2026-05-24/com.shwfed.table.column.combobox-single.remote.options-static/config.vue.d.ts +2 -2
  64. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.d.vue.ts +2 -2
  65. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-remote/config.vue.d.ts +2 -2
  66. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.d.vue.ts +2 -2
  67. package/dist/runtime/components/table/columns/2026-05-25/com.shwfed.table.column.combobox-multi.remote.options-static/config.vue.d.ts +2 -2
  68. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.d.vue.ts +2 -2
  69. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-multi.remote/config.vue.d.ts +2 -2
  70. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.d.vue.ts +2 -2
  71. package/dist/runtime/components/table/columns/2026-05-26/com.shwfed.table.column.combobox-single.remote/config.vue.d.ts +2 -2
  72. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.d.vue.ts +2 -2
  73. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-multi/config.vue.d.ts +2 -2
  74. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.d.vue.ts +2 -2
  75. package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.combobox-single/config.vue.d.ts +2 -2
  76. package/dist/runtime/share/slot-renderer.vue +2 -8
  77. package/package.json +1 -1
  78. package/dist/preview/assets/badge-CJpxWUkB.js +0 -1
  79. package/dist/preview/assets/index-ChitoGhE.js +0 -1
  80. package/dist/preview/assets/index-DFKLSxdT.css +0 -1
@@ -1,5 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  import { Locale } from "../../../../../share/locale.js";
3
+ import { Expression } from "../../../../../share/expression.js";
3
4
  export const type = "com.shwfed.block.markdown";
4
5
  export const compatibilityDate = "2026-05-06";
5
6
  export const metadata = {
@@ -8,7 +9,11 @@ export const metadata = {
8
9
  w: { initial: 8, min: 2, max: Infinity },
9
10
  h: { initial: 2, min: 2, max: Infinity }
10
11
  };
11
- export function schema(_configure, _blockRef) {
12
+ export function schema(configure, _blockRef) {
13
+ const CelStyle = Expression({
14
+ configure,
15
+ resultType: (t) => t === "string" || t === "dyn" || t.startsWith("map") || t.startsWith("optional")
16
+ });
12
17
  return Schema.Struct({
13
18
  id: Schema.UUID.annotations({ description: "\u5757\u552F\u4E00\u6807\u8BC6" }),
14
19
  type: Schema.tag(type),
@@ -17,6 +22,10 @@ export function schema(_configure, _blockRef) {
17
22
  title: "\u5185\u90E8\u540D\u79F0",
18
23
  description: "\u4EC5\u5728\u7F16\u8F91\u5668\u5185\u53EF\u89C1\u7684\u5757\u540D\uFF0C\u7528\u4E8E\u5728\u4FA7\u8FB9\u680F\u548C\u5E03\u5C40\u7F16\u8F91\u5668\u4E2D\u8BC6\u522B\u5757\uFF1B\u8FD0\u884C\u65F6\u4E0D\u5C55\u793A"
19
24
  })),
25
+ style: Schema.optional(CelStyle).annotations({
26
+ title: "\u6837\u5F0F",
27
+ description: "\u8FD4\u56DE\u5E94\u7528\u5728 Markdown \u5757\u6839\u5143\u7D20\u4E0A\u7684\u6837\u5F0F\u7684 CEL \u8868\u8FBE\u5F0F\uFF0C\u53EF\u8FD4\u56DE CSS \u5B57\u7B26\u4E32\uFF08\u5982 `'padding: 2rem'`\uFF09\u6216\u6837\u5F0F\u5BF9\u8C61\uFF08\u5982 `{'padding': '2rem'}`\uFF09\uFF1B\u7559\u7A7A\u5219\u4E0D\u8BBE\u989D\u5916\u6837\u5F0F"
28
+ }),
20
29
  content: Locale.annotations({
21
30
  title: "\u5185\u5BB9",
22
31
  description: "\u6E32\u67D3\u4E3A Markdown \u7684\u591A\u8BED\u8A00\u6587\u672C"
@@ -28,6 +28,16 @@ const rendered = computed(() => {
28
28
  if (!template.value) return "";
29
29
  return interpolateMarkdown(template.value, cel, { ...baseContext(), json: jsonOption.value });
30
30
  });
31
+ const visible = computed(() => {
32
+ const expr = props.badge.show;
33
+ if (!expr) return true;
34
+ try {
35
+ return Effect.runSync(cel(expr, { ...baseContext(), json: jsonOption.value }));
36
+ } catch (e) {
37
+ console.warn("[shwfed-card-badge] show evaluation failed", e);
38
+ return true;
39
+ }
40
+ });
31
41
  async function refresh() {
32
42
  const req = props.badge.request;
33
43
  if (!req) return;
@@ -70,7 +80,7 @@ watch(
70
80
  </script>
71
81
 
72
82
  <template>
73
- <template v-if="template">
83
+ <template v-if="template && visible">
74
84
  <Badge
75
85
  v-if="badge.dot"
76
86
  :variant="badge.variant ?? 'default'"
@@ -43,6 +43,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
43
43
  readonly locale: "en" | "ja" | "ko";
44
44
  readonly message: string;
45
45
  }[]] | undefined;
46
+ readonly show?: string | undefined;
46
47
  readonly dot?: boolean | undefined;
47
48
  readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
48
49
  readonly request?: string | undefined;
@@ -85,6 +86,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
85
86
  readonly locale: "en" | "ja" | "ko";
86
87
  readonly message: string;
87
88
  }[]] | undefined;
89
+ readonly show?: string | undefined;
88
90
  readonly dot?: boolean | undefined;
89
91
  readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
90
92
  readonly request?: string | undefined;
@@ -59,7 +59,7 @@ const slotAccessor = computed({
59
59
  }
60
60
  });
61
61
  const editor = useSlotEditor(slotAccessor, { configure: configure.value });
62
- const viewMode = ref("content");
62
+ const viewMode = ref("general");
63
63
  function selectContent() {
64
64
  viewMode.value = "content";
65
65
  drilledBlockId.value = null;
@@ -103,6 +103,9 @@ function setBadgeRequest(v) {
103
103
  function setBadgeContent(v) {
104
104
  patchBadge({ content: isLocaleBlank(v) ? void 0 : v });
105
105
  }
106
+ function setBadgeShow(v) {
107
+ patchBadge({ show: v.trim().length > 0 ? v : void 0 });
108
+ }
106
109
  function setBadgeInterval(v) {
107
110
  patchBadge({ interval: typeof v === "number" && v > 0 ? Math.round(v) : void 0 });
108
111
  }
@@ -190,38 +193,38 @@ if (breadcrumbExt) {
190
193
  >
191
194
  <div
192
195
  class="row pl-2"
193
- :class="viewMode === 'content' ? 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] text-(--primary)' : 'text-zinc-700 hover:bg-zinc-50'"
194
- @click="selectContent()"
196
+ :class="viewMode === 'general' ? 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] text-(--primary)' : 'text-zinc-700 hover:bg-zinc-50'"
197
+ @click="selectGeneral()"
195
198
  >
196
199
  <Icon
197
- icon="fluent:apps-list-20-regular"
200
+ icon="fluent:settings-20-regular"
198
201
  class="size-4 shrink-0"
199
202
  />
200
- <span class="flex-1 truncate">内容</span>
203
+ <span class="flex-1 truncate">通用配置</span>
201
204
  </div>
202
205
 
203
206
  <div
204
207
  class="row pl-2"
205
- :class="viewMode === 'badge' ? 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] text-(--primary)' : 'text-zinc-700 hover:bg-zinc-50'"
206
- @click="selectBadge()"
208
+ :class="viewMode === 'content' ? 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] text-(--primary)' : 'text-zinc-700 hover:bg-zinc-50'"
209
+ @click="selectContent()"
207
210
  >
208
211
  <Icon
209
- icon="fluent:badge-20-regular"
212
+ icon="fluent:apps-list-20-regular"
210
213
  class="size-4 shrink-0"
211
214
  />
212
- <span class="flex-1 truncate">徽章</span>
215
+ <span class="flex-1 truncate">内容</span>
213
216
  </div>
214
217
 
215
218
  <div
216
219
  class="row pl-2"
217
- :class="viewMode === 'general' ? 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] text-(--primary)' : 'text-zinc-700 hover:bg-zinc-50'"
218
- @click="selectGeneral()"
220
+ :class="viewMode === 'badge' ? 'bg-[color-mix(in_srgb,var(--primary)_10%,white)] text-(--primary)' : 'text-zinc-700 hover:bg-zinc-50'"
221
+ @click="selectBadge()"
219
222
  >
220
223
  <Icon
221
- icon="fluent:settings-20-regular"
224
+ icon="fluent:badge-20-regular"
222
225
  class="size-4 shrink-0"
223
226
  />
224
- <span class="flex-1 truncate">通用配置</span>
227
+ <span class="flex-1 truncate">徽章</span>
225
228
  </div>
226
229
 
227
230
  <Separator class="my-2" />
@@ -352,6 +355,30 @@ if (breadcrumbExt) {
352
355
 
353
356
  <!-- Badge settings. -->
354
357
  <template v-else-if="viewMode === 'badge'">
358
+ <Field orientation="vertical">
359
+ <FieldLabel class="text-xs text-zinc-500">
360
+ <template
361
+ v-if="badgeDescription('request')"
362
+ #tooltip
363
+ >
364
+ <Markdown
365
+ :source="badgeDescription('request')"
366
+ block
367
+ class="prose prose-sm prose-zinc"
368
+ />
369
+ </template>
370
+ {{ badgeTitle("request") }}
371
+ </FieldLabel>
372
+ <ExpressionEditor
373
+ :model-value="badge.request ?? ''"
374
+ placeholder="可选;如 http.get('/api/notifications')"
375
+ result-type="HttpRequest"
376
+ multiline
377
+ class="min-h-20"
378
+ @update:model-value="(v) => setBadgeRequest(v)"
379
+ />
380
+ </Field>
381
+
355
382
  <Field orientation="vertical">
356
383
  <FieldLabel class="text-xs text-zinc-500">
357
384
  <template
@@ -377,24 +404,24 @@ if (breadcrumbExt) {
377
404
  <Field orientation="vertical">
378
405
  <FieldLabel class="text-xs text-zinc-500">
379
406
  <template
380
- v-if="badgeDescription('request')"
407
+ v-if="badgeDescription('show')"
381
408
  #tooltip
382
409
  >
383
410
  <Markdown
384
- :source="badgeDescription('request')"
411
+ :source="badgeDescription('show')"
385
412
  block
386
413
  class="prose prose-sm prose-zinc"
387
414
  />
388
415
  </template>
389
- {{ badgeTitle("request") }}
416
+ {{ badgeTitle("show") }}
390
417
  </FieldLabel>
391
418
  <ExpressionEditor
392
- :model-value="badge.request ?? ''"
393
- placeholder="可选;如 http.get('/api/notifications')"
394
- result-type="HttpRequest"
419
+ :model-value="badge.show ?? ''"
420
+ placeholder="例:json.?data.?total.orValue(0) != 0"
421
+ result-type="bool"
395
422
  multiline
396
- class="min-h-20"
397
- @update:model-value="(v) => setBadgeRequest(v)"
423
+ class="min-h-12"
424
+ @update:model-value="(v) => setBadgeShow(v)"
398
425
  />
399
426
  </Field>
400
427
 
@@ -43,6 +43,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
43
43
  readonly locale: "en" | "ja" | "ko";
44
44
  readonly message: string;
45
45
  }[]] | undefined;
46
+ readonly show?: string | undefined;
46
47
  readonly dot?: boolean | undefined;
47
48
  readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
48
49
  readonly request?: string | undefined;
@@ -85,6 +86,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
85
86
  readonly locale: "en" | "ja" | "ko";
86
87
  readonly message: string;
87
88
  }[]] | undefined;
89
+ readonly show?: string | undefined;
88
90
  readonly dot?: boolean | undefined;
89
91
  readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
90
92
  readonly request?: string | undefined;
@@ -43,6 +43,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
43
43
  readonly locale: "en" | "ja" | "ko";
44
44
  readonly message: string;
45
45
  }[]] | undefined;
46
+ readonly show?: string | undefined;
46
47
  readonly dot?: boolean | undefined;
47
48
  readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
48
49
  readonly request?: string | undefined;
@@ -85,6 +86,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
85
86
  readonly locale: "en" | "ja" | "ko";
86
87
  readonly message: string;
87
88
  }[]] | undefined;
89
+ readonly show?: string | undefined;
88
90
  readonly dot?: boolean | undefined;
89
91
  readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
90
92
  readonly request?: string | undefined;
@@ -43,6 +43,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
43
43
  readonly locale: "en" | "ja" | "ko";
44
44
  readonly message: string;
45
45
  }[]] | undefined;
46
+ readonly show?: string | undefined;
46
47
  readonly dot?: boolean | undefined;
47
48
  readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
48
49
  readonly request?: string | undefined;
@@ -85,6 +86,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
85
86
  readonly locale: "en" | "ja" | "ko";
86
87
  readonly message: string;
87
88
  }[]] | undefined;
89
+ readonly show?: string | undefined;
88
90
  readonly dot?: boolean | undefined;
89
91
  readonly variant?: "default" | "destructive" | "outline" | "secondary" | undefined;
90
92
  readonly request?: string | undefined;
@@ -37,6 +37,7 @@ export declare function badgeSchema(configure: Configure): Schema.Struct<{
37
37
  locale: Schema.Literal<["ja", "en", "ko"]>;
38
38
  message: Schema.SchemaClass<string, string, never>;
39
39
  }>]>>>;
40
+ show: Schema.optional<Schema.Schema<string, string, never>>;
40
41
  interval: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
41
42
  dot: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
42
43
  variant: Schema.optional<Schema.Literal<["default", "secondary", "destructive", "outline"]>>;
@@ -57,6 +58,7 @@ export declare function schema(configure: Configure, blockRef: AnySchema): Schem
57
58
  locale: Schema.Literal<["ja", "en", "ko"]>;
58
59
  message: Schema.SchemaClass<string, string, never>;
59
60
  }>]>>>;
61
+ show: Schema.optional<Schema.Schema<string, string, never>>;
60
62
  interval: Schema.optional<Schema.refine<number, Schema.filter<typeof Schema.Number>>>;
61
63
  dot: Schema.optional<Schema.SchemaClass<boolean, boolean, never>>;
62
64
  variant: Schema.optional<Schema.Literal<["default", "secondary", "destructive", "outline"]>>;
@@ -28,6 +28,13 @@ export function badgeSchema(configure) {
28
28
  registerJson(env);
29
29
  }
30
30
  });
31
+ const CelShow = Expression({
32
+ configure: (env) => {
33
+ configure(env);
34
+ registerJson(env);
35
+ },
36
+ resultType: "bool"
37
+ });
31
38
  return Schema.Struct({
32
39
  request: Schema.optional(CelRequest).annotations({
33
40
  title: "\u8BF7\u6C42",
@@ -37,6 +44,10 @@ export function badgeSchema(configure) {
37
44
  title: "\u5185\u5BB9",
38
45
  description: "\u672C\u5730\u5316\u7684\u5185\u8054 Markdown\uFF0C\u652F\u6301 `{{ \u8868\u8FBE\u5F0F }}` CEL \u63D2\u503C\uFF0C\u53EF\u5F15\u7528 `json`\uFF1B\u7559\u7A7A\u5219\u4E0D\u663E\u793A\u5FBD\u7AE0"
39
46
  }),
47
+ show: Schema.optional(CelShow).annotations({
48
+ title: "\u663E\u793A\u6761\u4EF6",
49
+ description: "\u8FD4\u56DE `bool` \u7684\u8868\u8FBE\u5F0F\uFF0C\u53EF\u5F15\u7528 `json`\uFF1B\u8FD4\u56DE `false` \u65F6\u5373\u4F7F `\u5185\u5BB9` \u975E\u7A7A\u4E5F\u4E0D\u663E\u793A\u5FBD\u7AE0\uFF1B\u7559\u7A7A\u5219\u59CB\u7EC8\u663E\u793A\u3002\u5E38\u7528\u4E8E\u5FFD\u7565\u7279\u5B9A\u503C\uFF08\u5982 total \u4E3A 0 \u65F6\u9690\u85CF\uFF09"
50
+ }),
40
51
  interval: Schema.optional(
41
52
  Schema.Number.pipe(Schema.int(), Schema.positive()).annotations({
42
53
  title: "\u8F6E\u8BE2\u95F4\u9694",
@@ -0,0 +1,34 @@
1
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
2
+ import { type Value } from './schema.js';
3
+ type __VLS_Props = {
4
+ configure?: (env: Environment) => void;
5
+ };
6
+ type __VLS_ModelProps = {
7
+ modelValue: Value;
8
+ };
9
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ "update:modelValue": (value: {
12
+ readonly size?: number | undefined;
13
+ readonly type: "com.shwfed.block.icon";
14
+ readonly id: string;
15
+ readonly icon: string;
16
+ readonly color?: string | undefined;
17
+ readonly circle?: boolean | undefined;
18
+ readonly displayName?: string | undefined;
19
+ readonly compatibilityDate: "2026-06-02";
20
+ }) => any;
21
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: {
23
+ readonly size?: number | undefined;
24
+ readonly type: "com.shwfed.block.icon";
25
+ readonly id: string;
26
+ readonly icon: string;
27
+ readonly color?: string | undefined;
28
+ readonly circle?: boolean | undefined;
29
+ readonly displayName?: string | undefined;
30
+ readonly compatibilityDate: "2026-06-02";
31
+ }) => any) | undefined;
32
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const _default: typeof __VLS_export;
34
+ export default _default;
@@ -0,0 +1,153 @@
1
+ <script setup>
2
+ import { Schema } from "effect";
3
+ import { ColorPicker } from "../../../../ui/color-picker";
4
+ import { Field, FieldLabel } from "../../../../ui/field";
5
+ import { IconPicker } from "../../../../ui/icon-picker";
6
+ import { InputGroup, InputGroupInput, InputGroupNumberField } from "../../../../ui/input-group";
7
+ import { Markdown } from "../../../../ui/markdown";
8
+ import { Switch } from "../../../../ui/switch";
9
+ import {
10
+ getStructFieldDescription,
11
+ getStructFieldTitle,
12
+ schema
13
+ } from "./schema";
14
+ defineOptions({ name: "ShwfedBlockIconConfig" });
15
+ const block = defineModel({ type: null, ...{ required: true } });
16
+ defineProps({
17
+ configure: { type: Function, required: false }
18
+ });
19
+ const blockSchema = schema(() => {
20
+ }, Schema.Any);
21
+ const fieldTitle = (f) => getStructFieldTitle(blockSchema, f) ?? f;
22
+ const fieldDescription = (f) => getStructFieldDescription(blockSchema, f);
23
+ function setDisplayName(v) {
24
+ const s = String(v ?? "");
25
+ block.value = { ...block.value, displayName: s.length > 0 ? s : void 0 };
26
+ }
27
+ function setIcon(v) {
28
+ block.value = { ...block.value, icon: v };
29
+ }
30
+ function setColor(v) {
31
+ block.value = { ...block.value, color: v.trim().length > 0 ? v : void 0 };
32
+ }
33
+ function setSize(v) {
34
+ block.value = { ...block.value, size: typeof v === "number" && v > 0 ? Math.round(v) : void 0 };
35
+ }
36
+ function setCircle(v) {
37
+ block.value = { ...block.value, circle: v ? true : void 0 };
38
+ }
39
+ </script>
40
+
41
+ <template>
42
+ <div class="flex flex-col gap-3">
43
+ <Field orientation="vertical">
44
+ <FieldLabel class="text-xs text-zinc-500">
45
+ <template
46
+ v-if="fieldDescription('displayName')"
47
+ #tooltip
48
+ >
49
+ <Markdown
50
+ :source="fieldDescription('displayName')"
51
+ block
52
+ class="prose prose-sm prose-zinc"
53
+ />
54
+ </template>
55
+ {{ fieldTitle("displayName") }}
56
+ </FieldLabel>
57
+ <InputGroup>
58
+ <InputGroupInput
59
+ :model-value="block.displayName ?? ''"
60
+ placeholder="例:状态图标"
61
+ @update:model-value="setDisplayName"
62
+ />
63
+ </InputGroup>
64
+ </Field>
65
+
66
+ <Field orientation="vertical">
67
+ <FieldLabel class="text-xs text-zinc-500">
68
+ <template
69
+ v-if="fieldDescription('icon')"
70
+ #tooltip
71
+ >
72
+ <Markdown
73
+ :source="fieldDescription('icon')"
74
+ block
75
+ class="prose prose-sm prose-zinc"
76
+ />
77
+ </template>
78
+ {{ fieldTitle("icon") }}
79
+ </FieldLabel>
80
+ <IconPicker
81
+ :model-value="block.icon"
82
+ @update:model-value="setIcon"
83
+ />
84
+ </Field>
85
+
86
+ <div class="grid grid-cols-2 gap-3">
87
+ <Field orientation="vertical">
88
+ <FieldLabel class="text-xs text-zinc-500">
89
+ <template
90
+ v-if="fieldDescription('color')"
91
+ #tooltip
92
+ >
93
+ <Markdown
94
+ :source="fieldDescription('color')"
95
+ block
96
+ class="prose prose-sm prose-zinc"
97
+ />
98
+ </template>
99
+ {{ fieldTitle("color") }}
100
+ </FieldLabel>
101
+ <ColorPicker
102
+ :model-value="block.color ?? ''"
103
+ placeholder="#4f46e5"
104
+ @update:model-value="setColor"
105
+ />
106
+ </Field>
107
+
108
+ <Field orientation="vertical">
109
+ <FieldLabel class="text-xs text-zinc-500">
110
+ <template
111
+ v-if="fieldDescription('size')"
112
+ #tooltip
113
+ >
114
+ <Markdown
115
+ :source="fieldDescription('size')"
116
+ block
117
+ class="prose prose-sm prose-zinc"
118
+ />
119
+ </template>
120
+ {{ fieldTitle("size") }}
121
+ </FieldLabel>
122
+ <InputGroup>
123
+ <InputGroupNumberField
124
+ :model-value="block.size"
125
+ :min="1"
126
+ placeholder="8"
127
+ @update:model-value="(v) => setSize(v)"
128
+ />
129
+ </InputGroup>
130
+ </Field>
131
+ </div>
132
+
133
+ <Field orientation="horizontal">
134
+ <FieldLabel class="text-xs text-zinc-500">
135
+ <template
136
+ v-if="fieldDescription('circle')"
137
+ #tooltip
138
+ >
139
+ <Markdown
140
+ :source="fieldDescription('circle')"
141
+ block
142
+ class="prose prose-sm prose-zinc"
143
+ />
144
+ </template>
145
+ {{ fieldTitle("circle") }}
146
+ </FieldLabel>
147
+ <Switch
148
+ :model-value="block.circle ?? false"
149
+ @update:model-value="setCircle"
150
+ />
151
+ </Field>
152
+ </div>
153
+ </template>
@@ -0,0 +1,34 @@
1
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
2
+ import { type Value } from './schema.js';
3
+ type __VLS_Props = {
4
+ configure?: (env: Environment) => void;
5
+ };
6
+ type __VLS_ModelProps = {
7
+ modelValue: Value;
8
+ };
9
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ "update:modelValue": (value: {
12
+ readonly size?: number | undefined;
13
+ readonly type: "com.shwfed.block.icon";
14
+ readonly id: string;
15
+ readonly icon: string;
16
+ readonly color?: string | undefined;
17
+ readonly circle?: boolean | undefined;
18
+ readonly displayName?: string | undefined;
19
+ readonly compatibilityDate: "2026-06-02";
20
+ }) => any;
21
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: {
23
+ readonly size?: number | undefined;
24
+ readonly type: "com.shwfed.block.icon";
25
+ readonly id: string;
26
+ readonly icon: string;
27
+ readonly color?: string | undefined;
28
+ readonly circle?: boolean | undefined;
29
+ readonly displayName?: string | undefined;
30
+ readonly compatibilityDate: "2026-06-02";
31
+ }) => any) | undefined;
32
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const _default: typeof __VLS_export;
34
+ export default _default;
@@ -0,0 +1,34 @@
1
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
2
+ import type { Value } from './schema.js';
3
+ type __VLS_Props = {
4
+ configure?: (env: Environment) => void;
5
+ };
6
+ type __VLS_ModelProps = {
7
+ 'block': Value;
8
+ };
9
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ "update:block": (value: {
12
+ readonly size?: number | undefined;
13
+ readonly type: "com.shwfed.block.icon";
14
+ readonly id: string;
15
+ readonly icon: string;
16
+ readonly color?: string | undefined;
17
+ readonly circle?: boolean | undefined;
18
+ readonly displayName?: string | undefined;
19
+ readonly compatibilityDate: "2026-06-02";
20
+ }) => any;
21
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ "onUpdate:block"?: ((value: {
23
+ readonly size?: number | undefined;
24
+ readonly type: "com.shwfed.block.icon";
25
+ readonly id: string;
26
+ readonly icon: string;
27
+ readonly color?: string | undefined;
28
+ readonly circle?: boolean | undefined;
29
+ readonly displayName?: string | undefined;
30
+ readonly compatibilityDate: "2026-06-02";
31
+ }) => any) | undefined;
32
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const _default: typeof __VLS_export;
34
+ export default _default;
@@ -0,0 +1,41 @@
1
+ <script setup>
2
+ import { computed } from "vue";
3
+ import { Icon } from "@iconify/vue";
4
+ defineOptions({ name: "ShwfedBlockIconRuntime" });
5
+ const block = defineModel("block", { type: null, ...{ required: true } });
6
+ defineProps({
7
+ configure: { type: Function, required: false }
8
+ });
9
+ const DEFAULT_SIZE = 8;
10
+ const iconSize = computed(() => block.value.size ?? DEFAULT_SIZE);
11
+ const iconStyle = computed(() => {
12
+ const s = { fontSize: `calc(${iconSize.value} * 0.25rem)` };
13
+ if (block.value.color) s.color = block.value.color;
14
+ return s;
15
+ });
16
+ const circleStyle = computed(() => ({
17
+ padding: `calc(${iconSize.value} * 0.125rem)`,
18
+ backgroundColor: `color-mix(in srgb, ${block.value.color || "currentColor"} 20%, white)`
19
+ }));
20
+ </script>
21
+
22
+ <template>
23
+ <div class="flex h-full w-full items-center justify-center">
24
+ <div
25
+ v-if="block.circle"
26
+ class="flex items-center justify-center rounded-full"
27
+ :style="circleStyle"
28
+ >
29
+ <Icon
30
+ v-if="block.icon"
31
+ :icon="block.icon"
32
+ :style="iconStyle"
33
+ />
34
+ </div>
35
+ <Icon
36
+ v-else-if="block.icon"
37
+ :icon="block.icon"
38
+ :style="iconStyle"
39
+ />
40
+ </div>
41
+ </template>
@@ -0,0 +1,34 @@
1
+ import type { Environment } from '../../../../../vendor/cel-js/lib/index.js';
2
+ import type { Value } from './schema.js';
3
+ type __VLS_Props = {
4
+ configure?: (env: Environment) => void;
5
+ };
6
+ type __VLS_ModelProps = {
7
+ 'block': Value;
8
+ };
9
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
+ "update:block": (value: {
12
+ readonly size?: number | undefined;
13
+ readonly type: "com.shwfed.block.icon";
14
+ readonly id: string;
15
+ readonly icon: string;
16
+ readonly color?: string | undefined;
17
+ readonly circle?: boolean | undefined;
18
+ readonly displayName?: string | undefined;
19
+ readonly compatibilityDate: "2026-06-02";
20
+ }) => any;
21
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ "onUpdate:block"?: ((value: {
23
+ readonly size?: number | undefined;
24
+ readonly type: "com.shwfed.block.icon";
25
+ readonly id: string;
26
+ readonly icon: string;
27
+ readonly color?: string | undefined;
28
+ readonly circle?: boolean | undefined;
29
+ readonly displayName?: string | undefined;
30
+ readonly compatibilityDate: "2026-06-02";
31
+ }) => any) | undefined;
32
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
33
+ declare const _default: typeof __VLS_export;
34
+ export default _default;