Skip to content

[6.x] Collaboration support#13974

Merged
jasonvarga merged 10 commits into6.xfrom
collaboration-addon-support
Apr 16, 2026
Merged

[6.x] Collaboration support#13974
jasonvarga merged 10 commits into6.xfrom
collaboration-addon-support

Conversation

@joshuablum
Copy link
Copy Markdown
Member

@joshuablum joshuablum commented Feb 17, 2026

Adds the pieces needed to make the collaboration addon compatible with v6.

Field focus/blur and locking

The previously-stubbed focused() and blurred() in Field.vue are now wired up. They call new focusField(handle) / blurField(handle) methods on the container (only for top-level fields — nested paths are ignored). The field's wrapper gets @focusin / @focusout listeners, and blurred is a no-op when focus moves to a descendant of the same field.

Container.vue owns the state: a reactive fieldFocus map keyed by user ID, and a fieldLocks computed derived from it (first user to focus a given handle wins the lock). focusField / blurField mutate the map and both throw when given a dotted path.

A field is locked when fieldLocks[handle] is set to a user other than Statamic.user. Locked fields render a ui-avatar of the locking user in the label and apply pointer-events-none select-none to the fieldtype wrapper.

Publish container events

Container.vue now emits publish-container-created on mount and publish-container-destroyed on unmount via Statamic.$events. The created payload exposes the container's name, reference, site, values and meta refs, and methods: setValues, setFieldValue, setMeta, setFieldMeta, pushComponent, fieldFocus, focusField, blurField.

New setMeta method

Replaces the entire meta object on the container, analogous to the existing setValues. Previously only setFieldMeta(path, value) existed. Exposed via the container context, the publish-container-created payload, and defineExpose.

The container also now emits update:meta (deep-watched) so parents can v-model:meta it, mirroring the existing pattern for modelValue, visibleValues, and modifiedFields.

debounce re-exported from @statamic/cms

Added alongside the other utilities (clone, deepClone, etc.) in packages/cms/src/index.js and resources/js/bootstrap/cms/core.js so addons can import it without bundling their own.

Drive-by fixes

  • Components.vue now forwards v-on="component.events" to the dynamic component; event listeners registered via pushComponent were being dropped.
  • FieldConditionsValidator.test.js mock gained a $events stub now that mounting a Container emits on mount.

joshuablum and others added 9 commits February 17, 2026 17:15
…pport

Made-with: Cursor

# Conflicts:
#	resources/js/components/ui/Publish/Field.vue
Move focus/blur events and field locking logic from Field.vue into
Container.vue. Focus is tracked via a reactive fieldFocus map, and
locks are derived as a computed from it (first user to focus wins).
Emit publish-container-created/destroyed events for addon integration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jasonvarga jasonvarga mentioned this pull request Apr 16, 2026
6 tasks
@jasonvarga jasonvarga changed the title [6.x] Field focus/blur events and field locking [6.x] Collaboration support Apr 16, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jasonvarga jasonvarga merged commit cb7b89e into 6.x Apr 16, 2026
18 checks passed
@jasonvarga jasonvarga deleted the collaboration-addon-support branch April 16, 2026 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants