diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json index cfb049ef8e1..f58c3ac3faa 100644 --- a/oxlint-suppressions.json +++ b/oxlint-suppressions.json @@ -205,9 +205,6 @@ } }, "web/app/components/app/app-access-control/access-control-dialog.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 1 - }, "shadcn/no-restyle": { "count": 1 } @@ -412,11 +409,6 @@ "count": 4 } }, - "web/app/components/app/configuration/config/automatic/get-automatic-res.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 4 - } - }, "web/app/components/app/configuration/config/automatic/idea-output.tsx": { "better-tailwindcss/enforce-logical-properties": { "count": 2 @@ -450,11 +442,6 @@ "count": 1 } }, - "web/app/components/app/configuration/config/code-generator/get-code-generator-res.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 1 - } - }, "web/app/components/app/configuration/config/config-audio.tsx": { "better-tailwindcss/enforce-logical-properties": { "count": 4 @@ -487,9 +474,6 @@ } }, "web/app/components/app/configuration/dataset-config/params-config/index.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 1 - }, "eslint-react/set-state-in-effect": { "count": 1 }, @@ -2786,11 +2770,6 @@ "count": 1 } }, - "web/app/components/explore/try-app/index.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 3 - } - }, "web/app/components/explore/try-app/preview/agent-app-preview.tsx": { "better-tailwindcss/enforce-logical-properties": { "count": 1 @@ -2976,11 +2955,6 @@ "count": 1 } }, - "web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 2 - } - }, "web/app/components/plugins/marketplace/__tests__/hooks.spec.tsx": { "typescript/no-deprecated": { "count": 2 @@ -3011,11 +2985,6 @@ "count": 20 } }, - "web/app/components/plugins/marketplace/detail-dialog/frame.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 1 - } - }, "web/app/components/plugins/marketplace/empty/index.tsx": { "better-tailwindcss/enforce-logical-properties": { "count": 4 @@ -4675,11 +4644,6 @@ "count": 1 } }, - "web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 1 - } - }, "web/app/components/workflow/nodes/human-input/components/delivery-method/method-item.tsx": { "better-tailwindcss/enforce-logical-properties": { "count": 3 @@ -4730,11 +4694,6 @@ "count": 1 } }, - "web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 1 - } - }, "web/app/components/workflow/nodes/human-input/components/variable-in-markdown.tsx": { "better-tailwindcss/enforce-logical-properties": { "count": 1 @@ -5088,11 +5047,6 @@ "count": 1 } }, - "web/app/components/workflow/nodes/llm/components/structure-output.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 1 - } - }, "web/app/components/workflow/nodes/llm/use-config.ts": { "eslint-react/set-state-in-effect": { "count": 1 @@ -5567,11 +5521,6 @@ "count": 5 } }, - "web/app/components/workflow/panel/debug-and-preview/conversation-variable-modal.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 9 - } - }, "web/app/components/workflow/panel/debug-and-preview/hooks.ts": { "no-restricted-imports": { "count": 2 @@ -6002,9 +5951,6 @@ } }, "web/app/components/workflow/workflow-generator/index.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 1 - }, "dify/require-disable-directive-description": { "count": 1 } @@ -6122,11 +6068,6 @@ "count": 3 } }, - "web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/detail-dialog.tsx": { - "better-tailwindcss/enforce-logical-properties": { - "count": 6 - } - }, "web/features/agent-v2/agent-detail/configure/components/orchestrate/skills/index.tsx": { "better-tailwindcss/enforce-logical-properties": { "count": 11 @@ -6200,9 +6141,6 @@ "web/features/agent-v2/agent-detail/configure/components/preview/working-directory-panel.tsx": { "@tanstack/query/prefer-query-options": { "count": 2 - }, - "better-tailwindcss/enforce-logical-properties": { - "count": 1 } }, "web/features/agent-v2/agent-detail/logs/components/log-detail-panel.tsx": { diff --git a/packages/tooling/lint.config.ts b/packages/tooling/lint.config.ts index b24623dd055..fd7affb5ea2 100644 --- a/packages/tooling/lint.config.ts +++ b/packages/tooling/lint.config.ts @@ -336,17 +336,27 @@ export const stylingContractRules = { pattern: '^(Dialog|AlertDialog)Content$', allow: [ 'w-*', - 'min-w-*', - 'max-w-*', 'h-*', - 'min-h-*', - 'max-h-*', + 'max-w-[calc(100vw-*rem)]', + 'max-h-[calc(100dvh-*rem)]', + 'max-h-[*dvh]', + 'max-h-[min(*,calc(100dvh-*rem))]', + 'min-h-[min(*,calc(100dvh-*rem))]', 'overflow-hidden', 'transition-none', ], - deny: ['max-w-none', 'max-h-none', 'w-screen', 'h-screen'], + deny: [ + 'w-[*]', + 'h-[min(*)]', + 'h-[calc(*)]', + 'h-[*%]', + 'h-[*px]', + 'h-[*rem]', + 'w-screen', + 'h-screen', + ], message: - '"{{className}}" is outside the {{component}} styling contract. The surface owns position, chrome and scrolling, and its parts own spacing; callers may size it within the viewport or disable transitions. Compose DialogPortal, DialogBackdrop and DialogPopup for a custom surface.', + '"{{className}}" is outside the {{component}} styling contract. The surface owns position, chrome and scrolling, and keeps itself within the viewport. Size it with w-* and h-* (h-dvh fills the viewport). Change the viewport margin with max-w-[calc(100vw-Nrem)] or max-h-[calc(100dvh-Nrem)], and bound a height cap or floor by the viewport, e.g. max-h-[80dvh] or min-h-[min(20rem,calc(100dvh-2rem))]. Compose DialogPortal, DialogBackdrop and DialogPopup for a custom surface.', }, { pattern: '^DialogPopup$', diff --git a/packages/tooling/plugins/eslint/hint-content.test.ts b/packages/tooling/plugins/eslint/hint-content.test.ts index 40de749d9d3..de778205d13 100644 --- a/packages/tooling/plugins/eslint/hint-content.test.ts +++ b/packages/tooling/plugins/eslint/hint-content.test.ts @@ -198,7 +198,7 @@ it('keeps centered dialogs on DialogContent while DialogPopup places custom surf const diagnostics = lintFixture(` import { DialogContent, DialogPopup } from '@langgenius/dify-ui/dialog' const examples = <> - + @@ -208,6 +208,38 @@ it('keeps centered dialogs on DialogContent while DialogPopup places custom surf expect(diagnostics.some(({ message }) => message.includes(`"${className}"`))).toBe(true) }) +it('keeps dialog sizes within the viewport bound owned by the surface', () => { + const diagnostics = lintFixture(` + import { DialogContent } from '@langgenius/dify-ui/dialog' + import { AlertDialogContent } from '@langgenius/dify-ui/alert-dialog' + const examples = <> + + + + + + + + + + `) + const rejected = [ + 'max-w-120', + 'max-h-200', + 'min-w-140', + 'min-h-90', + 'max-h-[80%]', + 'w-[min(960px,calc(100vw-2rem))]', + 'h-[min(680px,calc(100dvh-2rem))]', + 'h-[calc(100dvh-16px)]', + 'max-w-[calc(100vw-32px)]', + 'max-h-[min(44rem,32rem)]', + ] + expect(diagnostics).toHaveLength(rejected.length) + for (const className of rejected) + expect(diagnostics.some(({ message }) => message.includes(`"${className}"`))).toBe(true) +}) + it('keeps centered dialog layout owned by the surface', () => { const diagnostics = lintFixture(` import { DialogContent } from '@langgenius/dify-ui/dialog' diff --git a/web/app/components/app/app-access-control/access-control-dialog.tsx b/web/app/components/app/app-access-control/access-control-dialog.tsx index 08efc189092..ce9a2cefe40 100644 --- a/web/app/components/app/app-access-control/access-control-dialog.tsx +++ b/web/app/components/app/app-access-control/access-control-dialog.tsx @@ -20,13 +20,15 @@ const AccessControlDialog = ({ className, children, show, onClose }: DialogProps return ( !open && close()}> - + $['operation.close'], { ns: 'common' })} size="lg" - className="absolute top-5 right-5" + className="absolute inset-e-5 top-5" > diff --git a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx index e245bb00e23..84f37f902ee 100644 --- a/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx +++ b/web/app/components/app/configuration/config/automatic/get-automatic-res.tsx @@ -51,11 +51,11 @@ const TryLabel: FC<{ return ( ) } @@ -268,9 +268,9 @@ const GetAutomaticRes: FC = ({ if (!open) onClose() }} > - +
-
+
= ({ {isBasicMode && (
-
+
{t(($) => $['generate.tryIt'], { ns: 'appGeneration' })}
= ({ if (!open) onClose() }} > - +
-
+
{t(($) => $['codegen.title'], { ns: 'appGeneration' })} diff --git a/web/app/components/app/configuration/dataset-config/params-config/index.tsx b/web/app/components/app/configuration/dataset-config/params-config/index.tsx index 98981859b6d..0d4ee80ce20 100644 --- a/web/app/components/app/configuration/dataset-config/params-config/index.tsx +++ b/web/app/components/app/configuration/dataset-config/params-config/index.tsx @@ -125,7 +125,7 @@ const ParamsConfig = ({ disabled, selectedDatasets }: ParamsConfigProps) => { } }} > - + {
{!readOnly && ( - + {provider && ( - +
- + {t(($) => $[`${i18nPrefix}chunkDetail`], { ns: 'datasetHitTesting' })} diff --git a/web/app/components/explore/try-app/index.tsx b/web/app/components/explore/try-app/index.tsx index 7341a82f442..9071023d1c7 100644 --- a/web/app/components/explore/try-app/index.tsx +++ b/web/app/components/explore/try-app/index.tsx @@ -102,14 +102,14 @@ function TryAppContent({ $['operation.close'], { ns: 'common' })} onClick={onClose} > -
+
diff --git a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx index 3b6114a3d71..f056031079b 100644 --- a/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx +++ b/web/app/components/header/account-setting/access-rules-page/permission-set-modal/index.tsx @@ -80,7 +80,7 @@ const PermissionSetModalBody = ({ } return ( - +
{ diff --git a/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx b/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx index f4174af974f..23ff4c77e18 100644 --- a/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx +++ b/web/app/components/header/account-setting/permissions-page/role-modal/index.tsx @@ -75,7 +75,7 @@ const RoleModal = ({ mode, open, role, onClose, onSubmit }: RoleModalProps) => { if (!nextOpen) onClose() }} > - + {t(($) => $[`role.modal.${mode}.title`], { ns: 'permission' })} diff --git a/web/app/components/header/account-setting/update-setting-dialog.tsx b/web/app/components/header/account-setting/update-setting-dialog.tsx index a13b441168d..bbe4347d725 100644 --- a/web/app/components/header/account-setting/update-setting-dialog.tsx +++ b/web/app/components/header/account-setting/update-setting-dialog.tsx @@ -85,7 +85,7 @@ export function UpdateSettingDialog({ category }: Props) { } /> - + {t(($) => $['autoUpdate.autoUpdateSettings'], { ns: 'plugin' })} diff --git a/web/app/components/plugins/install-plugin/install-bundle/index.tsx b/web/app/components/plugins/install-plugin/install-bundle/index.tsx index 2f1a78c6f02..6a838b5ea7c 100644 --- a/web/app/components/plugins/install-plugin/install-bundle/index.tsx +++ b/web/app/components/plugins/install-plugin/install-bundle/index.tsx @@ -74,7 +74,7 @@ const InstallBundle: FC = ({ > {getTitle()} diff --git a/web/app/components/plugins/install-plugin/install-from-github/index.tsx b/web/app/components/plugins/install-plugin/install-from-github/index.tsx index 16c7cd46fef..05d91edcb39 100644 --- a/web/app/components/plugins/install-plugin/install-from-github/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-github/index.tsx @@ -200,7 +200,7 @@ const InstallFromGitHub: React.FC = ({ {getTitle()} diff --git a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx index 63e7476d903..60e7b8890e8 100644 --- a/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-local-package/index.tsx @@ -94,7 +94,7 @@ const InstallFromLocalPackage: React.FC = ({ > {getTitle()} diff --git a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx index 757e59b841b..d7bb0d7b126 100644 --- a/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx +++ b/web/app/components/plugins/install-plugin/install-from-marketplace/index.tsx @@ -87,9 +87,9 @@ const InstallFromMarketplace: React.FC = ({ > -
+
{getTitle()}
{isBundle ? ( diff --git a/web/app/components/plugins/marketplace/detail-dialog/frame.tsx b/web/app/components/plugins/marketplace/detail-dialog/frame.tsx index 03ed7e3244c..36018a85ac2 100644 --- a/web/app/components/plugins/marketplace/detail-dialog/frame.tsx +++ b/web/app/components/plugins/marketplace/detail-dialog/frame.tsx @@ -84,7 +84,7 @@ export default function MarketplaceDetailDialogFrame({ an invisible cross-origin frame. */} {title}
$['operation.close'], { ns: 'common' })} size="lg" - className="absolute top-5 right-5 z-10" + className="absolute inset-e-5 top-5 z-10" > diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx index b123fe30a54..70077812d09 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/create/common-modal.tsx @@ -34,7 +34,7 @@ export const CommonCreateModal = ({ open = true, onClose, createType, builder }: diff --git a/web/app/components/plugins/readme-panel/dialog.tsx b/web/app/components/plugins/readme-panel/dialog.tsx index b852e948460..d55b8e159ca 100644 --- a/web/app/components/plugins/readme-panel/dialog.tsx +++ b/web/app/components/plugins/readme-panel/dialog.tsx @@ -17,7 +17,7 @@ export function ReadmeDialog({ detail, open, onOpenChange, triggerId }: ReadmeDi return ( - + { if (!open) onClose() }} > - + = ({ return ( diff --git a/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx b/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx index b0730ccb30f..9bcf2e05693 100644 --- a/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx +++ b/web/app/components/workflow/nodes/agent-v2/components/agent-roster-field.tsx @@ -301,7 +301,7 @@ function AgentRosterInlineConfigureDialog({ return ( - + {agent.name} {t(($) => $[`${i18nPrefix}.roster.inlineSetup.description`], { ns: 'workflowAgent' })} diff --git a/web/app/components/workflow/nodes/human-input-v2/migration/migration-dialog.tsx b/web/app/components/workflow/nodes/human-input-v2/migration/migration-dialog.tsx index 89cd1a3816d..ea6601a3819 100644 --- a/web/app/components/workflow/nodes/human-input-v2/migration/migration-dialog.tsx +++ b/web/app/components/workflow/nodes/human-input-v2/migration/migration-dialog.tsx @@ -40,7 +40,7 @@ const HumanInputMigrationDialog = ({ return ( - + {t(($) => $['nodes.humanInputMigration.dialog.title'], { diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx index 1658fb4ab3c..a125bfb3d9d 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/email-configure-modal.tsx @@ -106,7 +106,7 @@ const EmailConfigureModal = ({ return ( - + {t(($) => $[`${i18nPrefix}.deliveryMethod.emailConfigure.title`], { @@ -166,7 +166,7 @@ const EmailConfigureModal = ({
-
+
diff --git a/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx b/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx index 2650f0aeace..8ef821b6b3d 100644 --- a/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx +++ b/web/app/components/workflow/nodes/human-input/components/delivery-method/upgrade-modal.tsx @@ -38,7 +38,7 @@ export function UpgradeModal({ open, onOpenChange }: UpgradeModalProps) { ns: 'workflowHumanInput', })} classNames={{ - content: 'max-w-[580px]', + content: 'w-145', }} footer={ <> @@ -56,7 +56,7 @@ export function UpgradeModal({ open, onOpenChange }: UpgradeModalProps) { >