soma-kit 0.1.14 → 0.1.15
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/package.json +3 -3
- package/packs/finance/reconcile-desk/compile.ts +1 -1
- package/packs/finance/reconcile-desk/shell.ts +1 -1
- package/spec/generated/kit-app.schema.json +4 -2
- package/spec/generated/kit-page.schema.json +72 -2
- package/spec/kit-grammar.json +163 -57
- package/spec/kit-grammar.schema.json +0 -24
- package/src/app/app-config.ts +1 -1
- package/src/app/component-gate.ts +2 -2
- package/src/app/compose-apps.ts +5 -2
- package/src/app/define-kit-actions.ts +82 -10
- package/src/app/define-kit-app.ts +6 -5
- package/src/app/define-kit-view.ts +1 -1
- package/src/app/index.ts +7 -7
- package/src/app/kit-view-context.ts +11 -2
- package/src/app/theme-endpoint.ts +1 -1
- package/src/app/theme-runtime.ts +7 -2
- package/src/base/alert.ts +23 -20
- package/src/base/anchored-layer.ts +1 -1
- package/src/base/button.ts +30 -15
- package/src/base/cascader.ts +8 -4
- package/src/base/check-core.ts +9 -6
- package/src/base/color-picker.ts +10 -6
- package/src/base/command-palette.ts +10 -4
- package/src/base/context-menu.ts +5 -2
- package/src/base/date-range.ts +9 -6
- package/src/base/date.ts +10 -6
- package/src/base/delta.ts +4 -2
- package/src/base/divider.ts +15 -66
- package/src/base/fab.ts +11 -6
- package/src/base/gap-value.ts +1 -1
- package/src/base/hint-tips.ts +1 -1
- package/src/base/index.ts +15 -4
- package/src/base/inline-error.ts +84 -0
- package/src/base/input.ts +54 -18
- package/src/base/kbd.ts +4 -3
- package/src/base/link.ts +1 -1
- package/src/base/listbox-core.ts +70 -22
- package/src/base/mentions.ts +6 -3
- package/src/base/menu-button.ts +63 -27
- package/src/base/menu-core.ts +9 -2
- package/src/base/motion/hover-3d.ts +4 -1
- package/src/base/motion/hover-gallery.ts +4 -1
- package/src/base/otp.ts +7 -3
- package/src/base/overlay-runtime.ts +3 -2
- package/src/base/overlay-shell.ts +141 -0
- package/src/base/popover.ts +2 -2
- package/src/base/popup.ts +47 -41
- package/src/base/qty-stepper.ts +14 -9
- package/src/base/reason-tip.ts +2 -2
- package/src/{frames → base}/resize-handle.ts +1 -1
- package/src/base/segmented.ts +35 -36
- package/src/base/select.ts +1 -0
- package/src/base/shared.ts +43 -7
- package/src/base/status-tone.ts +1 -1
- package/src/base/tag-input.ts +13 -8
- package/src/base/tag.ts +53 -59
- package/src/base/text.ts +37 -13
- package/src/base/textarea.ts +1 -1
- package/src/base/time-picker.ts +9 -5
- package/src/base/tree-select.ts +12 -9
- package/src/base/upload.ts +21 -13
- package/src/biz/approval-desk/compile.ts +28 -1
- package/src/biz/approval-desk/shell.ts +2 -2
- package/src/biz/auth-panel/compile.ts +1 -1
- package/src/biz/auth-panel/shell.ts +2 -2
- package/src/biz/category-crud/compile.ts +17 -4
- package/src/biz/category-crud/shell.ts +7 -5
- package/src/biz/checkout-page/compile.ts +1 -1
- package/src/biz/checkout-page/shell.ts +7 -6
- package/src/biz/compose.ts +3 -3
- package/src/biz/define.ts +1 -1
- package/src/biz/import-wizard/compile.ts +1 -1
- package/src/biz/import-wizard/shell.ts +6 -4
- package/src/biz/index.ts +4 -3
- package/src/biz/landing-page/compile.ts +1 -1
- package/src/biz/landing-page/shell.ts +5 -4
- package/src/biz/link/shared.ts +8 -1
- package/src/biz/master-sub/compile.ts +162 -19
- package/src/biz/master-sub/detail-head.ts +7 -6
- package/src/biz/master-sub/index.ts +3 -3
- package/src/biz/master-sub/shell.ts +90 -53
- package/src/biz/multi-board/compile.ts +3 -3
- package/src/biz/multi-board/index.ts +24 -9
- package/src/biz/multi-board/prose-fold.ts +2 -2
- package/src/biz/multi-board/shell.ts +17 -13
- package/src/biz/names.ts +1 -0
- package/src/biz/notification-center/compile.ts +9 -2
- package/src/biz/notification-center/shell.ts +9 -2
- package/src/biz/page-templates/domain-templates.ts +6 -2
- package/src/biz/page-templates/result-page/compile.ts +1 -1
- package/src/biz/page-templates/result-page/shell.ts +4 -3
- package/src/biz/page-templates/shared.ts +1 -1
- package/src/biz/page-templates/sign-in-page/compile.ts +1 -1
- package/src/biz/page-templates/sign-in-page/shell.ts +4 -4
- package/src/biz/record-detail/compile.ts +5 -2
- package/src/biz/record-detail/shell.ts +4 -4
- package/src/biz/settings-center/compile.ts +1 -1
- package/src/biz/settings-center/shell.ts +8 -5
- package/src/biz/shared/action-host.ts +12 -5
- package/src/biz/shared/compile-helpers.ts +4 -4
- package/src/biz/shared/coordinator.ts +104 -21
- package/src/biz/shared/overlay-compile.ts +48 -18
- package/src/biz/shared/overlay-shell.ts +63 -112
- package/src/biz/single-form/compile.ts +2 -2
- package/src/biz/single-form/shell.ts +8 -4
- package/src/biz/standard-crud/compile.ts +11 -4
- package/src/biz/standard-crud/shell.ts +26 -9
- package/src/biz/standard-crud/summary.ts +3 -1
- package/src/biz/step-form/compile.ts +1 -1
- package/src/biz/step-form/hub.ts +4 -0
- package/src/biz/step-form/shell.ts +6 -4
- package/src/biz/types.ts +11 -4
- package/src/cli/app-layer-check.ts +375 -0
- package/src/cli/kit-cli.ts +35 -8
- package/src/cli/kit-init.ts +149 -0
- package/src/compile/access-gate-attach.ts +1 -1
- package/src/compile/action-host-attach.ts +1 -1
- package/src/compile/compile-page.ts +29 -234
- package/src/compile/component-candidates.ts +2 -1
- package/src/compile/hints.ts +5 -58
- package/src/compile/index.ts +2 -2
- package/src/compile/layout-lint/index.ts +4 -1
- package/src/compile/layout-lint/rules-composition.ts +43 -13
- package/src/compile/page-composition.ts +33 -31
- package/src/compile/redirect.ts +1 -1
- package/src/compile/stages.ts +169 -0
- package/src/compile/styles.ts +70 -32
- package/src/compile/types.ts +2 -2
- package/src/data/amount-breakdown.ts +4 -2
- package/src/data/anchor-nav.ts +4 -1
- package/src/data/approval-flow.ts +9 -4
- package/src/data/assignment-picker.ts +28 -18
- package/src/data/async-result-panel.ts +6 -2
- package/src/data/breadcrumbs.ts +13 -9
- package/src/data/calendar.ts +4 -3
- package/src/data/carousel.ts +11 -5
- package/src/data/chart.ts +153 -23
- package/src/data/checklist.ts +5 -4
- package/src/data/code-view.ts +220 -26
- package/src/data/comment-thread.ts +7 -2
- package/src/data/confirm-dialog.ts +56 -13
- package/src/data/diff.ts +4 -1
- package/src/data/dock.ts +5 -1
- package/src/data/embed.ts +1 -1
- package/src/data/engine-ports.ts +126 -0
- package/src/data/field-mapper.ts +12 -6
- package/src/data/flow-editor.ts +105 -29
- package/src/data/footer.ts +6 -2
- package/src/data/gantt.ts +11 -8
- package/src/data/hero.ts +6 -2
- package/src/data/image-viewer.ts +7 -3
- package/src/data/index.ts +12 -5
- package/src/data/item-list.ts +6 -5
- package/src/data/json-view.ts +844 -0
- package/src/data/kanban.ts +11 -8
- package/src/data/markdown-view.ts +487 -0
- package/src/data/matrix.ts +23 -14
- package/src/data/media-grid.ts +5 -2
- package/src/data/mega-menu.ts +4 -3
- package/src/data/menu-dom.ts +9 -8
- package/src/data/menu.ts +15 -9
- package/src/data/mockup.ts +9 -5
- package/src/data/modal-dialog.ts +39 -88
- package/src/data/navbar.ts +11 -7
- package/src/data/notice-list.ts +1 -1
- package/src/data/notify-renderer.ts +21 -10
- package/src/data/object-form.ts +129 -48
- package/src/data/pager.ts +12 -8
- package/src/data/panel-head.ts +1 -1
- package/src/data/permission-matrix.ts +15 -8
- package/src/data/permission-tree.ts +24 -11
- package/src/data/pricing-table.ts +8 -3
- package/src/data/reaction-bar.ts +6 -3
- package/src/data/record-card.ts +13 -9
- package/src/data/record-picker.ts +8 -4
- package/src/data/redirect.ts +1 -1
- package/src/data/request-console.ts +20 -7
- package/src/data/resident.ts +0 -12
- package/src/data/result-panel.ts +2 -2
- package/src/data/rich-text.ts +58 -96
- package/src/data/row-editor.ts +10 -5
- package/src/data/rule-builder.ts +14 -8
- package/src/data/shape-util.ts +14 -3
- package/src/data/stat-group.ts +63 -22
- package/src/data/static-lazy.ts +3 -0
- package/src/data/static-registry.ts +8 -2
- package/src/data/steps.ts +6 -2
- package/src/data/survey.ts +9 -3
- package/src/data/system-switcher.ts +15 -6
- package/src/data/text-diff.ts +663 -0
- package/src/data/timeline.ts +1 -1
- package/src/data/tour-guide.ts +6 -3
- package/src/data/transfer.ts +19 -10
- package/src/data/tree-table.ts +77 -12
- package/src/data/tree.ts +5 -2
- package/src/data/virtual-rows.ts +17 -7
- package/src/data/wrap.ts +2 -2
- package/src/frames/index.ts +3 -2
- package/src/frames/inherited-shell.ts +178 -0
- package/src/frames/list-summary.ts +59 -36
- package/src/frames/page-bar.ts +4 -2
- package/src/frames/resident-components.ts +20 -0
- package/src/frames/shared.ts +18 -14
- package/src/frames/split-frame/shell.ts +17 -11
- package/src/frames/split-frame/wiring.ts +2 -2
- package/src/frames/tabs-frame/shell.ts +12 -6
- package/src/frames/types.ts +3 -2
- package/src/frames/workspace-frame/extras.ts +19 -5
- package/src/frames/workspace-frame/shell.ts +2 -1
- package/src/frames/workspace-frame/state.ts +8 -2
- package/src/frames/workspace-frame/view.ts +125 -76
- package/src/generated/kit-grammar-runtime.ts +61 -39
- package/src/i18n/kit-text.ts +114 -2
- package/src/i18n/resolve-text-refs.ts +1 -1
- package/src/object-renderer/action-group.ts +31 -1
- package/src/object-renderer/action-more.ts +28 -12
- package/src/object-renderer/arrange.ts +37 -7
- package/src/object-renderer/collection-parts.ts +38 -7
- package/src/object-renderer/collection-table.ts +68 -23
- package/src/object-renderer/collection.ts +63 -30
- package/src/object-renderer/compile-data.ts +1 -1
- package/src/object-renderer/defaults.ts +8 -0
- package/src/object-renderer/emit-events.ts +1 -1
- package/src/object-renderer/emit-object.ts +3 -0
- package/src/object-renderer/emit-static.ts +140 -37
- package/src/object-renderer/field-value.ts +12 -239
- package/src/object-renderer/filter-toolbar.ts +103 -0
- package/src/{compile → object-renderer}/fragment.ts +2 -2
- package/src/object-renderer/index.ts +1 -1
- package/src/object-renderer/layout-facts.ts +37 -5
- package/src/object-renderer/overlay-decide.ts +82 -0
- package/src/object-renderer/render-object.ts +1 -1
- package/src/object-renderer/table-actions.ts +70 -23
- package/src/object-renderer/table-tools.ts +12 -5
- package/src/object-renderer/types.ts +9 -15
- package/src/recipes/app-blocks.ts +66 -0
- package/src/recipes/code-view.ts +56 -0
- package/src/recipes/compact-group.ts +31 -0
- package/src/recipes/container.ts +25 -15
- package/src/recipes/control.ts +21 -3
- package/src/recipes/desc-list.ts +14 -0
- package/src/recipes/divider.ts +53 -0
- package/src/recipes/emphasis.ts +12 -8
- package/src/recipes/frame-bleed.ts +3 -3
- package/src/recipes/index.ts +11 -1
- package/src/recipes/inherited-shell.ts +37 -0
- package/src/recipes/json-view.ts +49 -0
- package/src/recipes/markdown.ts +86 -0
- package/src/recipes/overlay.ts +112 -26
- package/src/recipes/page-width.ts +20 -0
- package/src/recipes/placeholder.ts +1 -1
- package/src/recipes/stat-state.ts +1 -1
- package/src/recipes/state.ts +10 -8
- package/src/recipes/status.ts +13 -12
- package/src/recipes/strip.ts +72 -0
- package/src/recipes/surface.ts +10 -6
- package/src/recipes/table-gap.ts +1 -1
- package/src/recipes/table-native-edit.ts +4 -4
- package/src/recipes/table-row.ts +11 -8
- package/src/recipes/tabs.ts +108 -31
- package/src/recipes/text-diff.ts +90 -0
- package/src/recipes/title-row.ts +4 -2
- package/src/recipes/typography.ts +2 -2
- package/src/shared/diagnostics.ts +16 -0
- package/src/shared/envelope.ts +1 -1
- package/src/shared/field-value-format.ts +246 -0
- package/src/shared/focus-ring.ts +8 -0
- package/src/shared/hints.ts +56 -0
- package/src/{base → shared}/icons.ts +12 -0
- package/src/shared/kit-error.ts +1 -1
- package/src/{object-renderer → shared}/merge-class.ts +3 -2
- package/src/shared/path-guard.ts +1 -1
- package/src/shared/primitives-types.ts +8 -0
- package/src/shared/theme-runtime-shared.ts +19 -0
- package/src/theme/kit-theme-text.ts +1 -1
- package/src/theme/kit-theme.css +38 -14
- package/src/theme/kit-theme.tpl +38 -14
- package/src/theme/nine-dim-structure.ts +66 -41
- package/src/theme/surface-layers.ts +11 -3
- package/src/theme/theme-tokens.ts +5 -1
- package/src/app/envelope.ts +0 -1
- package/src/app/notify-renderer.ts +0 -1
- package/src/app/paged-list-adapter.ts +0 -1
- package/src/app/theme-runtime-shared.ts +0 -1
- package/src/compile/kit-error.ts +0 -1
- /package/src/{base → shared}/class-candidates.ts +0 -0
package/src/data/steps.ts
CHANGED
|
@@ -7,10 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
import type { SomaComponentDefinition } from 'soma-core';
|
|
9
9
|
import { bool, createKitController, joinClass, str } from '../base/shared';
|
|
10
|
-
import { kitIcon, type KitIconName } from '../
|
|
10
|
+
import { kitIcon, type KitIconName } from '../shared/icons';
|
|
11
11
|
import { kitText, type KitTextKey } from '../i18n/kit-text';
|
|
12
12
|
import { applyKitReadState, KIT_READ_STATE_EMIT_DEFS, KIT_READ_STATE_PROP_DEFS } from '../base/state-panel';
|
|
13
13
|
import { classTokens, emptyNode, keyMap, mk, rowsOf, textOf, TONE_SOLID, type Rec } from './shape-util';
|
|
14
|
+
import { kitControlEdgeRecipe } from '../recipes/control';
|
|
15
|
+
|
|
16
|
+
const TODO_EDGE = kitControlEdgeRecipe({ wrapper: true, hover: false });
|
|
14
17
|
|
|
15
18
|
export const KIT_STEPS_DEFAULT_MAP = Object.freeze({ id: 'id', label: 'label', text: 'text', status: 'status', count: 'count', optional: 'optional' });
|
|
16
19
|
|
|
@@ -36,7 +39,8 @@ const DOT_BASE = 'flex size-6 shrink-0 items-center justify-center rounded-full
|
|
|
36
39
|
const DOT_STATUS: Readonly<Record<KitStepStatus, string>> = Object.freeze({
|
|
37
40
|
done: TONE_SOLID.success,
|
|
38
41
|
current: `${TONE_SOLID.primary} ring-2 ring-primary-soft`,
|
|
39
|
-
|
|
42
|
+
// 待办节点外圈 = 控件轮廓出口(KT-B1)
|
|
43
|
+
todo: `${TODO_EDGE} bg-surface text-fg-muted`,
|
|
40
44
|
blocked: TONE_SOLID.danger,
|
|
41
45
|
skipped: 'bg-surface-sunken text-fg-subtle',
|
|
42
46
|
// 出错:实心危险色 + 外圈浅危险色,与 blocked 靠符号(✕ 对 !)和文字标记区分
|
package/src/data/survey.ts
CHANGED
|
@@ -17,6 +17,9 @@ import { bool, createKitController, joinClass, num, str } from '../base/shared';
|
|
|
17
17
|
import { createCheck, markInput } from '../base/check-core';
|
|
18
18
|
import { kitText } from '../i18n/kit-text';
|
|
19
19
|
import { setKitFace } from '../recipes';
|
|
20
|
+
import { kitButtonEdgeRecipe, kitControlRecipe } from '../recipes/control';
|
|
21
|
+
import { kitShellRecipe } from '../recipes/container';
|
|
22
|
+
import { mergeClass } from '../shared/merge-class';
|
|
20
23
|
import { createKitBusy, KIT_BUSY_PROP_DEFS } from '../base/action-busy';
|
|
21
24
|
import { actionButton, BUTTON_CLASS_TOKENS, classTokens, emptyNode, mk, mkProgressBar, PROGRESS_BAR_CLASS_TOKENS, recOf, setProgressBar, rowsOf, textOf } from './shape-util';
|
|
22
25
|
import { rowKey } from './d9-util';
|
|
@@ -26,7 +29,10 @@ import { QUESTION_KINDS, QUESTION_MAX, QUESTION_MAX_OPTIONS, QUESTION_RATING_MAX
|
|
|
26
29
|
|
|
27
30
|
// ───────── 类串常量与 Tailwind 候选清单 ─────────
|
|
28
31
|
|
|
29
|
-
|
|
32
|
+
// 问卷外缘 = 壳配方(容器边,KT-B2);作答框 = 多行控件配方;评分钮 = 带文字中性按钮描边(KT-B1)
|
|
33
|
+
const ROOT_EDGE = kitShellRecipe({ tone: 'base', shadow: false });
|
|
34
|
+
const RATING_EDGE = kitButtonEdgeRecipe();
|
|
35
|
+
const ROOT_CLASS = `flex flex-col gap-5 ${ROOT_EDGE} p-5 text-sm text-fg`;
|
|
30
36
|
const TITLE_CLASS = kitTypographyRecipe('sectionTitle');
|
|
31
37
|
const DESC_CLASS = 'text-fg-muted';
|
|
32
38
|
const PROGRESS_ROW = 'flex items-center gap-3 text-xs text-fg-muted';
|
|
@@ -35,11 +41,11 @@ const QUESTION_CLASS = 'flex min-w-0 flex-col gap-2 border-0 p-0';
|
|
|
35
41
|
const LEGEND_CLASS = 'mb-1 font-medium text-fg';
|
|
36
42
|
const REQUIRED_CLASS = 'ms-1 text-danger-on-soft';
|
|
37
43
|
const OPTION_CLASS = 'w-full px-2 py-1.5 hover:bg-state-layer-hover active:bg-state-layer-press';
|
|
38
|
-
const AREA_CLASS =
|
|
44
|
+
const AREA_CLASS = mergeClass(kitControlRecipe({ multiline: true }), 'resize-none');
|
|
39
45
|
const RATING_ROW = 'flex flex-wrap gap-1';
|
|
40
46
|
const RATING_BOX = 'relative';
|
|
41
47
|
const RATING_INPUT = 'peer sr-only';
|
|
42
|
-
const RATING_LABEL = 'inline-flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-md
|
|
48
|
+
const RATING_LABEL = 'inline-flex h-8 min-w-8 cursor-pointer items-center justify-center rounded-md ' + RATING_EDGE + ' bg-surface px-2 text-sm text-fg transition-colors state-layer peer-checked:border-primary peer-checked:bg-primary-soft peer-checked:text-primary-on-soft peer-focus-visible:ring-2 peer-focus-visible:ring-ring';
|
|
43
49
|
const ERROR_CLASS = 'text-xs text-danger-on-soft';
|
|
44
50
|
const FOOT_CLASS = 'flex items-center justify-end gap-2';
|
|
45
51
|
const RESULT_ROW = 'flex flex-col gap-1 rounded-md px-2 py-1.5';
|
|
@@ -16,25 +16,34 @@ import { KIT_WORKSPACE_FRAME_LIMITS } from 'soma-foundation/kit-limits';
|
|
|
16
16
|
import { bool, createKitController, joinClass } from '../base/shared';
|
|
17
17
|
import { createButton, KIT_BUTTON_CLASS_CANDIDATES } from '../base/button';
|
|
18
18
|
import { createInput, KIT_INPUT_CLASS_CANDIDATES } from '../base/input';
|
|
19
|
-
import { kitIcon } from '../
|
|
19
|
+
import { kitIcon } from '../shared/icons';
|
|
20
20
|
import { kitText } from '../i18n/kit-text';
|
|
21
21
|
import { mountKitComponent, type KitMount } from './embed';
|
|
22
22
|
import { singleOf, clampInt } from './display-util';
|
|
23
23
|
import { createItemList, KIT_ITEM_LIST_CLASS_CANDIDATES } from './item-list';
|
|
24
24
|
import { classTokens, mk, rowsOf, textOf, type Rec } from './shape-util';
|
|
25
25
|
import { kitTypographyRecipe } from '../recipes/typography';
|
|
26
|
+
import { kitShellRecipe } from '../recipes/container';
|
|
26
27
|
|
|
27
28
|
const KEYS = ['items', 'favorites', 'keyword', 'server_search', 'favorites_max', 'title', 'hint'] as const;
|
|
28
29
|
const FAV_LIMIT = KIT_WORKSPACE_FRAME_LIMITS.limits.systemFavorites;
|
|
30
|
+
/** 常用上限:0 / 负数 / 缺省一律回退真源上限 FAV_LIMIT,正整数钳在 1..FAV_LIMIT */
|
|
31
|
+
export function favMaxOf(raw: unknown): number {
|
|
32
|
+
const n = typeof raw === 'number' ? raw : typeof raw === 'string' && raw.trim() !== '' ? Number(raw) : NaN;
|
|
33
|
+
if (!Number.isFinite(n) || Math.trunc(n) <= 0) return FAV_LIMIT;
|
|
34
|
+
return clampInt(n, 1, FAV_LIMIT, FAV_LIMIT);
|
|
35
|
+
}
|
|
29
36
|
|
|
30
|
-
|
|
37
|
+
// 外缘 = 壳配方(容器边 + 容器阴影令牌,KT-B2);已选芯片浅底无描边
|
|
38
|
+
const ROOT_EDGE = kitShellRecipe();
|
|
39
|
+
const ROOT_CLASS = `@container flex flex-col gap-3 ${ROOT_EDGE} p-4`;
|
|
31
40
|
const HEAD_CLASS = 'flex flex-col';
|
|
32
41
|
const TITLE_CLASS = kitTypographyRecipe('dialogTitle');
|
|
33
42
|
const HINT_CLASS = 'text-xs text-fg-subtle';
|
|
34
43
|
const FAV_BOX_CLASS = 'flex flex-col gap-2 rounded-md bg-surface-sunken p-3';
|
|
35
44
|
const FAV_HEAD_CLASS = 'flex items-center justify-between gap-2 text-xs text-fg-muted';
|
|
36
45
|
const CHIPS_CLASS = 'flex flex-wrap gap-2';
|
|
37
|
-
const CHIP_CLASS = 'inline-flex items-center gap-1 rounded-full
|
|
46
|
+
const CHIP_CLASS = 'inline-flex items-center gap-1 rounded-full bg-surface-sunken ps-3 pe-1 text-sm text-fg';
|
|
38
47
|
const CHIP_OPEN_CLASS = 'cursor-pointer rounded-sm text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
39
48
|
const CHIP_REMOVE_CLASS = 'inline-flex size-6 p-0 cursor-pointer items-center justify-center rounded-full text-fg-muted transition-colors hover:bg-state-layer-hover active:bg-state-layer-press hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring';
|
|
40
49
|
const SEARCH_ROW_CLASS = 'flex items-center gap-2';
|
|
@@ -101,7 +110,7 @@ export function createSystemSwitcher(): SomaComponentDefinition {
|
|
|
101
110
|
search: { payload: { keyword: { type: 'string' } }, desc: 'server_search 为真时,回车或点搜索钮' },
|
|
102
111
|
},
|
|
103
112
|
},
|
|
104
|
-
templateHtml: `<section data-soma-id="root" class="${ROOT_CLASS}"></section>`,
|
|
113
|
+
templateHtml: `<section data-kit-container="card" data-soma-id="root" class="${ROOT_CLASS}"></section>`,
|
|
105
114
|
controllerFactory: createKitController(() => ({
|
|
106
115
|
attach(root, api) {
|
|
107
116
|
const srcOf = (): Rec => singleOf(api.props().data, api.props(), KEYS);
|
|
@@ -184,7 +193,7 @@ export function createSystemSwitcher(): SomaComponentDefinition {
|
|
|
184
193
|
self.input.setProps({ value: keyword });
|
|
185
194
|
}
|
|
186
195
|
const items = systemItemsOf(src.items);
|
|
187
|
-
const max =
|
|
196
|
+
const max = favMaxOf(src.favorites_max);
|
|
188
197
|
// 常用独立给出(favorites)时以它为准(搜索结果里可能不含全部常用);否则取 items 里 favorite 为真的
|
|
189
198
|
const favs = Array.isArray(src.favorites) ? systemItemsOf(src.favorites) : items.filter((i) => i.favorite);
|
|
190
199
|
self.title.textContent = textOf(src.title) || kitText('soma.kit.sw_title', undefined, root);
|
|
@@ -221,7 +230,7 @@ export function createSystemSwitcher(): SomaComponentDefinition {
|
|
|
221
230
|
if (!self) return;
|
|
222
231
|
const src = singleOf(p.data, p, KEYS);
|
|
223
232
|
const items = systemItemsOf(src.items);
|
|
224
|
-
const max =
|
|
233
|
+
const max = favMaxOf(src.favorites_max);
|
|
225
234
|
const favCount = Array.isArray(src.favorites) ? src.favorites.length : items.filter((i) => i.favorite).length;
|
|
226
235
|
const full = favCount >= max;
|
|
227
236
|
const shown = bool(src.server_search) ? items : filterSystems(items, self.typed);
|