Skip to content

Conversation

@Nowely
Copy link
Owner

@Nowely Nowely commented Dec 6, 2025

  • Replace per-option slots/slotProps with mark and overlay props that carry both component (slot) and props, keeping defaults via global Mark/Overlay or provided base props.
  • Default options now set overlay trigger/data directly on overlay, aligning with the new shape and improving type inference for MarkedInput and createMarkedInput.
  • Refreshed useSlot resolution to read mark/overlay props (including inline slot) and updated StoreProvider typing.
  • Updated Storybook demos, tests, and API docs/guides to the new API, keeping examples consistent.

Breaking Change

  • Option interface no longer supports slots or slotProps; per-option customization must now use mark and overlay objects (each may include slot for the component). Overlay trigger/data and mark props must move to these new fields.

Migration Guide

  • Move components: slots.markmark.slot; slots.overlayoverlay.slot.
  • Move props: slotProps.markmark; slotProps.overlay (including trigger, data, etc.) → overlay.
  • Keep global fallbacks the same: Mark and Overlay still act as defaults when mark.slot/overlay.slot are absent.
  • Example:
// before
<MarkedInput
  options={[{
    markup: '@[__value__]',
    slots: { overlay: Suggestions },
    slotProps: { overlay: { trigger: '@', data: users }, mark: { color: 'blue' } },
  }]}
/>

// after
<MarkedInput
  options={[{
    markup: '@[__value__]',
    overlay: { slot: Suggestions, trigger: '@', data: users },
    mark: { color: 'blue' },
  }]}
/>
  • For dynamic mark props, replace slotProps.mark: (p) => ... with mark: (p) => ....

…iguration

- Updated the MarkedInput component to use a more intuitive overlay configuration, replacing `slotProps` with direct `overlay` properties.
- Simplified the Option interface by removing `slotProps` and directly integrating `mark` and `overlay` properties for better clarity and usability.
- Enhanced documentation to reflect these changes, ensuring accurate API references and examples.
- Adjusted related components and stories to align with the new structure, improving overall consistency across the codebase.
- Updated the Option interface to support generic type parameters for mark and overlay props, improving flexibility and type safety.
- Modified the MarkedInput component to utilize the updated Option interface, ensuring consistent typing across options.
- Adjusted documentation to reflect changes in type definitions and examples, enhancing clarity for users.
- Updated references in related markdown files to point to the correct line numbers following the interface modifications.
@vercel
Copy link

vercel bot commented Dec 6, 2025

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

Project Deployment Preview Comments Updated (UTC)
marked-input Ready Ready Preview Comment Dec 6, 2025 9:53pm
markput-website Ready Ready Preview Comment Dec 6, 2025 9:53pm

- Updated the MarkedInput stories in Base and Overlay to use generic type parameters for improved type safety and clarity.
- Removed unnecessary slotProps in the index.tsx file, streamlining the configuration of mark and overlay properties.
- Ensured consistency across the codebase by aligning story definitions with the latest interface changes.
- Improved formatting of the ConfiguredMarkedInput interface for better readability.
- Simplified the useTrigger function by condensing the overlayMatch assignment into a single line.
- Enhanced the useSlot function signature for clarity by removing unnecessary line breaks.
- These changes aim to improve code maintainability and readability across the markput package.
@Nowely Nowely merged commit 51da353 into next Dec 6, 2025
8 checks passed
@Nowely Nowely deleted the improve-options branch December 6, 2025 21:54
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