Skip to content

refactor(components,fields): one fullscreen long-text editor, hoisted to components (#3398) - #4193

Merged
yinlianghui merged 1 commit into
mainfrom
claude/issue-3398-fullscreen-editor-hoist
Aug 10, 2026
Merged

refactor(components,fields): one fullscreen long-text editor, hoisted to components (#3398)#4193
yinlianghui merged 1 commit into
mainfrom
claude/issue-3398-fullscreen-editor-hoist

Conversation

@yinlianghui

Copy link
Copy Markdown
Collaborator

Fixes #3398

One fullscreen long-text editor, hoisted to the package both render paths may import.

The measured import graph (the ruling's escape hatch, answered)

The maintainer's ruling of 2026-08-10 requires the hoist direction be checked against the real graph before any code moves, so this was measured first, from the package.json files on this tip:

  • packages/fields/package.jsondependencies contains "@object-ui/components": "workspace:*".
  • packages/components/package.json → neither dependencies nor peerDependencies mentions @object-ui/fields.

So the edge is fields → components, one-way, and the ruled direction is legal. The escape hatch is not taken and no second implementation survives.

Ruling text, quoted verbatim and untranslated:

Maintainer ruling (2026-08-10, directed in session session_01BPWqbmEFU8gJepBJTHESXd): one implementation, hoisted to the dependency-legal side.

Hoist the shared fullscreen-editor primitive into the package both sides may depend on (components), and make the fields-side FullscreenFieldEditor a thin wrapper over it. If the measured import graph makes that direction impossible, report the graph on this card before merging the other way — do not resolve the dependency block by keeping two implementations.

What changed

@object-ui/components gains FullscreenEditor (src/custom/fullscreen-editor.tsx), a single primitive owning the expand affordance, the dialog, the draft/commit state machine and the copy. The editor itself stays injected through children, so nothing widget-specific moved down.

  • form.tsx's FullscreenTextarea keeps only what is its own — the inline Textarea and the editor it injects — and renders the primitive for everything else. Its Dialog family and Maximize2 / Check / X imports went with the deleted copy.
  • packages/fields' FullscreenFieldEditor becomes a thin wrapper. Same name, same props, same test-id namespaces, so both hosts and every existing pin are untouched.
  • The now-unread form.fullscreen.* defaults are dropped from useFieldTranslation. common.cancel stays — RecordPickerDialog and PeoplePicker read it independently.

The load-bearing half: readonly/disabled are DEFINED, not inherited

Per the PM's binding context, this is the #3400 lesson applied to the merge. Neither copy defined both states: the components one grew them under #3400, while the fields one declared only disabled and was shielded from readonly by its hosts' early return. A single implementation cannot be shielded by one caller's control flow, so the primitive answers both and both call paths inherit the same answers:

  • readOnly → no affordance at all (it means "shown plainly"; a disabled button advertises an affordance the read-only path does not have).
  • disabled → the toggle stays but is inert (it means "not interactive, muted").

Neither leans on the toggle alone, because disabled also carries the form's isSubmitting and can flip true while the dialog is already open: opening refuses independently of the attribute, the injected editor is told, "Done" is disabled, and onCommit is gated as the single point where a value leaves for host state.

The wrapper keeps readOnly OUT of the fields contract — Omit< FullscreenEditorProps, 'readOnly' > — because both fields hosts early-return a read-only display before rendering it, so the prop would have no producer on that path (the #3232/#3233 shape). That is why the hoist did not simply re-export the primitive.

Behaviour and copy parity

No copy changed and no locale pack needed an edit. The primitive consumes the same form.fullscreen.* / common.cancel keys both copies already read, through createSafeTranslation with English defaults byte-identical to the literals, so provider-less hosts render exactly what they did. check:i18n-drift confirms 0 en values changed; check:i18n-keys resolves every call site.

toggleClassName is not carried into the new primitive: zero producers repo-wide, and FullscreenFieldEditor is not exported from the @object-ui/fields barrel, so nothing outside the package could ever set it. Publishing it as part of a NEW public export in components would have minted a prop with no producer.

#3439 (built-in textarea character count) is out of scope and unchanged.

Verification

All commands run from the repo root per AGENTS.md.

Targeted pins — pnpm exec vitest run --maxWorkers=2 over the four components fullscreen test files:

Test Files  4 passed (4)
     Tests  32 passed (32)

Fields-side fullscreen tests (8 files incl. both no-provider/i18n pins):

Test Files  8 passed (8)
     Tests  70 passed (70)

Full suites — pnpm exec vitest run --maxWorkers=2 packages/components/ packages/fields/:

Test Files  186 passed (186)
     Tests  2203 passed (2203)

packages/plugin-form/ (the built-in branch's consumer):

Test Files  39 passed (39)
     Tests  407 passed (407)

Downstream consumer type-check sweep — pnpm --workspace-concurrency=2 --filter '...@object-ui/components' --filter '...@object-ui/fields' type-check. Direction stated explicitly: the PREFIX form, i.e. the 31 consumer packages, not upstream deps. All 31 Done, after a full packages/** build so no result rode a stale or missing dist.

Lint: components 0 errors / 881 warnings, fields 0 errors / 748 warnings — all warnings pre-existing. check:control-bytes, check:i18n-keys, check:i18n-drift, check-changeset-presence, check-changeset-no-major all green.

Reverse verification (three, all in the predicted direction)

  1. Delete the merged readonly guard (if (readOnly) return null;) → the form.tsx 内置 textarea 的全屏路径完全绕过 readonly / disabled:只读长文本可直接编辑,禁用字段可经对话框改值并提交进表单状态 #3400 pin goes RED, 2 failed / 12 passed, failing on expect(expandButton()).toBeNull() — the expand button reappears on a read-only field, exactly the defect form.tsx 内置 textarea 的全屏路径完全绕过 readonly / disabled:只读长文本可直接编辑,禁用字段可经对话框改值并提交进表单状态 #3400 closed. Restored.
  2. Make the wrapper drop disabled on its way through → 9 failed / 12 passed across TextAreaField.fullscreenDisabled and RichTextField.fullscreenDisabled, including the write-back gate itself (expected "vi.fn()" to not be called at all, but actually been called 1 times). Restored.
  3. Cross-package type change: pasting toggleClassName and readOnly onto the fields call site is REJECTED — error TS2322 … not assignable to type 'IntrinsicAttributes & FullscreenFieldEditorProps' — which is what proves tsc read the rebuilt @object-ui/components .d.ts rather than a cached one. Restored.

Generated by Claude Code

… to components (#3398)

The "expand to a full-height dialog" interaction had two independent
implementations: `FullscreenTextarea` inside the form renderer's built-in
`textarea` branch (@object-ui/components) and `FullscreenFieldEditor` in
@object-ui/fields for the registered TextAreaField / RichTextField widgets.
One form-level promise (ObjectFormSchema.mobile.fullscreenLongText) is
honoured on two render paths, and each path grew its own answer.

They drifted in both directions — #3400 (readonly editable through the
built-in dialog), #3402 (the same write-back hole for disabled on the
registered path), #3393 and #3272 each landing on one side first.

Per the maintainer ruling of 2026-08-10, the shared primitive is hoisted to
the dependency-legal side. Measured import graph: fields depends on
components; components declares no dependency on fields in dependencies or
peerDependencies. So components now exports `FullscreenEditor` and
`FullscreenFieldEditor` becomes a thin wrapper over it.

The primitive DEFINES readOnly/disabled rather than inheriting them by
accident: readOnly renders no affordance at all, disabled leaves an inert
one, and both are gated at open, in the injected editor, on Done, and at
onCommit — because disabled also carries isSubmitting and can flip while the
dialog is open.

Copy is unchanged: the same form.fullscreen.* / common.cancel keys through
createSafeTranslation with byte-identical English defaults, so no locale pack
changes and provider-less hosts render what they did. The now-unread
form.fullscreen.* defaults are dropped from useFieldTranslation.

`toggleClassName` is not carried into the new primitive — zero producers
repo-wide, and FullscreenFieldEditor is not exported from the fields barrel.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Qqyix2QcnpUC9XeYVDzx3
@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
objectui Ignored Ignored Aug 10, 2026 7:35pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

✅ Console Performance Budget

Metric Value Budget
Main entry (gzip) 28.3 KB 350 KB
Entry file index-6PXpY_G4.js
Status PASS

📦 Bundle Size Report

Package Size Gzipped
app-shell (index.js) 8.88KB 3.25KB
app-shell (runtime-config.js) 7.42KB 2.32KB
app-shell (types.js) 0.01KB 0.04KB
app-shell (urlParams.js) 7.57KB 2.97KB
auth (AuthContext.js) 0.31KB 0.24KB
auth (AuthGuard.js) 1.17KB 0.53KB
auth (AuthProvider.js) 22.10KB 4.37KB
auth (AuthShell.js) 3.49KB 1.40KB
auth (ForgotPasswordForm.js) 12.21KB 3.45KB
auth (LoginForm.js) 18.13KB 5.39KB
auth (PreviewBanner.js) 0.90KB 0.50KB
auth (RegisterForm.js) 6.64KB 2.21KB
auth (SocialSignInButtons.js) 9.60KB 3.89KB
auth (UserMenu.js) 3.40KB 1.22KB
auth (auth-gate-events.js) 1.29KB 0.66KB
auth (authStyles.js) 5.04KB 1.72KB
auth (createAuthClient.js) 35.76KB 9.11KB
auth (createAuthenticatedFetch.js) 4.37KB 1.69KB
auth (index.js) 2.35KB 1.07KB
auth (org-roles.js) 6.66KB 2.78KB
auth (phone-identifier.js) 1.11KB 0.66KB
auth (types.js) 0.59KB 0.35KB
auth (useAuth.js) 4.91KB 0.87KB
auth (useIsWorkspaceAdmin.js) 1.61KB 0.85KB
collaboration (CommentThread.js) 26.07KB 7.56KB
collaboration (LiveCursors.js) 3.17KB 1.27KB
collaboration (PresenceAvatars.js) 6.49KB 2.64KB
collaboration (PresenceProvider.js) 2.79KB 1.13KB
collaboration (index.js) 1.65KB 0.73KB
collaboration (useCollaborationTranslation.js) 6.05KB 2.52KB
collaboration (useCommentSearch.js) 1.98KB 0.88KB
collaboration (useConflictResolution.js) 7.75KB 1.86KB
collaboration (useMentionNotifications.js) 1.81KB 0.68KB
collaboration (usePresence.js) 6.33KB 1.84KB
collaboration (useRealtimeSubscription.js) 7.91KB 2.01KB
components (index.js) 485.71KB 107.36KB
core (index.js) 3.04KB 1.15KB
create-plugin (index.js) 10.08KB 3.26KB
data-objectstack (index.js) 140.66KB 36.25KB
fields (index.js) 226.96KB 56.30KB
i18n (LocalizationContext.js) 1.76KB 0.96KB
i18n (currency.js) 1.22KB 0.64KB
i18n (i18n.js) 4.32KB 1.77KB
i18n (index.js) 2.65KB 1.06KB
i18n (pickLocalized.js) 1.70KB 0.83KB
i18n (provider.js) 9.48KB 3.27KB
i18n (useObjectLabel.js) 27.59KB 6.63KB
i18n (useSafeTranslation.js) 4.52KB 1.96KB
layout (index.js) 38.87KB 10.80KB
mobile (MobileProvider.js) 0.92KB 0.49KB
mobile (ResponsiveContainer.js) 0.94KB 0.38KB
mobile (breakpoints.js) 1.51KB 0.70KB
mobile (createOfflineDataSource.js) 5.61KB 1.74KB
mobile (index.js) 1.50KB 0.62KB
mobile (offlineQueue.js) 3.91KB 1.35KB
mobile (pwa.js) 0.97KB 0.49KB
mobile (serviceWorker.js) 1.48KB 0.62KB
mobile (serviceWorkerSource.js) 3.41KB 1.48KB
mobile (useBreakpoint.js) 1.54KB 0.65KB
mobile (useGesture.js) 6.96KB 1.98KB
mobile (useOfflineSync.js) 1.99KB 0.72KB
mobile (usePullToRefresh.js) 2.53KB 0.85KB
mobile (useResponsive.js) 0.71KB 0.42KB
mobile (useResponsiveConfig.js) 1.36KB 0.63KB
mobile (useSpecGesture.js) 4.32KB 1.64KB
mobile (useTouchTarget.js) 1.01KB 0.54KB
permissions (MePermissionsProvider.js) 8.75KB 3.06KB
permissions (PermissionContext.js) 0.31KB 0.25KB
permissions (PermissionGuard.js) 0.89KB 0.45KB
permissions (PermissionProvider.js) 3.67KB 1.12KB
permissions (evaluator.js) 4.41KB 1.44KB
permissions (index.js) 0.91KB 0.41KB
permissions (store.js) 0.91KB 0.42KB
permissions (useFieldPermissions.js) 1.28KB 0.52KB
permissions (usePermissions.js) 1.55KB 0.71KB
plugin-ai (index.js) 15.71KB 3.79KB
plugin-calendar (index.js) 45.23KB 12.45KB
plugin-charts (index.js) 61.52KB 17.49KB
plugin-chatbot (index.js) 180.33KB 42.79KB
plugin-dashboard (index.js) 118.52KB 30.68KB
plugin-designer (index.js) 210.51KB 42.51KB
plugin-detail (index.js) 237.80KB 59.48KB
plugin-editor (index.js) 2.46KB 1.10KB
plugin-form (index.js) 114.58KB 27.68KB
plugin-gantt (index.js) 162.81KB 39.67KB
plugin-grid (index.js) 188.04KB 49.91KB
plugin-kanban (index.js) 48.60KB 13.41KB
plugin-list (index.js) 110.04KB 26.67KB
plugin-map (index.js) 17.00KB 5.32KB
plugin-markdown (index.js) 13.72KB 4.69KB
plugin-report (index.js) 40.58KB 10.58KB
plugin-timeline (index.js) 26.21KB 7.52KB
plugin-tree (index.js) 8.50KB 2.88KB
plugin-view (index.js) 84.03KB 20.55KB
providers (DataSourceProvider.js) 0.75KB 0.39KB
providers (MetadataProvider.js) 1.37KB 0.59KB
providers (ThemeProvider.js) 1.90KB 0.85KB
providers (UploadProvider.js) 11.71KB 3.53KB
providers (index.js) 0.44KB 0.22KB
providers (types.js) 0.01KB 0.04KB
react-runtime (index.js) 5.67KB 2.37KB
react (LazyPluginLoader.js) 3.77KB 1.33KB
react (SchemaRenderer.js) 23.71KB 7.95KB
react (data-invalidation.js) 5.05KB 2.08KB
react (index.js) 1.23KB 0.66KB
react (spec-input.js) 0.20KB 0.18KB
sdui-parser (codegen.js) 4.09KB 1.74KB
sdui-parser (index.js) 4.47KB 2.03KB
sdui-parser (parse.js) 10.04KB 2.82KB
sdui-parser (types.js) 0.29KB 0.24KB
sdui-parser (validate.js) 4.69KB 1.48KB
types (ai.js) 0.20KB 0.17KB
types (api-types.js) 0.20KB 0.18KB
types (app.js) 2.87KB 0.99KB
types (base.js) 0.20KB 0.18KB
types (blocks.js) 0.20KB 0.18KB
types (complex.js) 0.20KB 0.18KB
types (crud.js) 0.20KB 0.18KB
types (data-display.js) 0.20KB 0.18KB
types (data-protocol.js) 0.20KB 0.19KB
types (data.js) 0.20KB 0.18KB
types (designer.js) 1.87KB 0.85KB
types (disclosure.js) 0.20KB 0.18KB
types (error-code.js) 1.54KB 0.88KB
types (feedback.js) 0.20KB 0.18KB
types (field-types.js) 0.20KB 0.18KB
types (form.js) 0.20KB 0.18KB
types (http-retry.js) 4.32KB 2.02KB
types (index.js) 2.71KB 1.34KB
types (layout.js) 0.20KB 0.18KB
types (managed-by.js) 0.19KB 0.18KB
types (mobile.js) 2.59KB 1.31KB
types (navigation.js) 0.20KB 0.18KB
types (objectql.js) 0.20KB 0.18KB
types (overlay.js) 0.20KB 0.18KB
types (permissions.js) 0.20KB 0.18KB
types (plugin-scope.js) 0.20KB 0.18KB
types (record-components.js) 0.20KB 0.19KB
types (record-semantics.js) 1.28KB 0.67KB
types (registry.js) 0.20KB 0.18KB
types (reports.js) 0.20KB 0.18KB
types (spec-report.js) 5.05KB 1.93KB
types (system-fields.js) 3.33KB 1.54KB
types (theme.js) 0.20KB 0.18KB
types (ui-action.js) 3.40KB 1.71KB
types (views.js) 0.20KB 0.18KB
types (widget.js) 0.20KB 0.18KB

Size Limits

  • ✅ Core packages should be < 50KB gzipped
  • ✅ Component packages should be < 100KB gzipped
  • ⚠️ Plugin packages should be < 150KB gzipped

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants