Skip to content

Conversation

@ryu-man
Copy link
Contributor

@ryu-man ryu-man commented Oct 22, 2025

No description provided.

@ryu-man ryu-man requested a review from Copilot October 22, 2025 22:51
@netlify
Copy link

netlify bot commented Oct 22, 2025

Deploy Preview for statuesque-boba-0fb888 ready!

Name Link
🔨 Latest commit 12ab00e
🔍 Latest deploy log https://app.netlify.com/projects/statuesque-boba-0fb888/deploys/68f9660e570537000825b4c0
😎 Deploy Preview https://deploy-preview-8--statuesque-boba-0fb888.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors preset handling and customization across the component library to streamline how presets are applied. The main improvements include:

  • Centralized preset handling in HtmlAtom component with automatic class merging
  • Simplified component code by removing manual preset retrieval and class application
  • Introduced a $preset placeholder system for flexible preset styling
  • Renamed ModuleName to PresetModuleName for clarity and consistency

Reviewed Changes

Copilot reviewed 130 out of 130 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/lib/context/preset.svelte.ts Renamed ModuleName to PresetModuleName and updated input.root to input
src/lib/context/index.ts Exported PresetModuleName as ModuleName for backward compatibility
src/lib/components/atom/html-atom.svelte Added preset handling logic with $preset placeholder and automatic class merging
src/lib/components/atom/types.ts Added bond and preset props to HtmlAtomProps
src/lib/components/element/types.ts Updated type annotations for better type safety
src/stories/Theme.svelte Updated accordion preset configuration and removed unused popover.trigger preset
Multiple component files Removed manual preset retrieval, simplified class application using $preset, and added bond prop

Comment on lines 22 to 25
class: function () {
const bond = this;
return [bond.state.isActive ? 'text-foreground/100' : 'text-foreground/50'];
}
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Using function() syntax and reassigning this to bond is unnecessarily verbose. The original arrow function with bond parameter is clearer and follows modern JavaScript best practices.

Suggested change
class: function () {
const bond = this;
return [bond.state.isActive ? 'text-foreground/100' : 'text-foreground/50'];
}
class: (bond) => [
bond.state.isActive ? 'text-foreground/100' : 'text-foreground/50'
]

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using an arrow function, you cannot retrieve the value assigned to this arg.

class={[
'h-full w-full flex-1 bg-transparent px-2 leading-1 outline-none',
toClassValue.bind(bond, preset?.class),
toClassValue.bind(bond, klass)
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using .bind() instead of .apply() changes the behavior - .bind() returns a new function rather than calling it immediately. This will result in functions being added to the class array instead of resolved class values.

Suggested change
toClassValue.bind(bond, klass)
toClassValue(bond, klass)

Copilot uses AI. Check for mistakes.
Comment on lines 139 to 140
enter={scale}
enterConfig={{ duration: DURATION.fast, easing: circOut, start: 0.6 }}
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The transition was changed from transition:scale to enter={scale} with a separate enterConfig. Verify that the enter prop with enterConfig provides the same functionality as the original transition:scale directive, as these are different APIs.

Copilot uses AI. Check for mistakes.
let {
class: klass = '',
as = preset?.as ?? 'div',
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preset variable is used before it's defined. The line const preset = getPreset('combobox.item'); was removed but preset is still referenced, which will cause a runtime error.

Copilot uses AI. Check for mistakes.
if (item) {
return item;
return item as DropdownItemBond;
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added type assertion as DropdownItemBond suggests a potential type mismatch. Review the type definitions to ensure this cast is necessary and safe.

Copilot uses AI. Check for mistakes.
});
}
return [preset?.class ?? '', '$preset', klass].map((arg) => toClassValue.apply(bond, [arg]));
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When no $preset placeholder is found, this code adds the preset class, a literal '$preset' string, and the custom class. The literal '$preset' string in the class array will be treated as a CSS class name, which is incorrect.

Suggested change
return [preset?.class ?? '', '$preset', klass].map((arg) => toClassValue.apply(bond, [arg]));
const presetClass = preset?.class ?? '';
const customClasses = Array.isArray(klass) ? klass : [klass];
return [presetClass, ...customClasses].map((arg) => toClassValue.apply(bond, [arg]));

Copilot uses AI. Check for mistakes.
Comment on lines +101 to +102
'$preset',
klass
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing {bond} prop even though the preset system now requires it. This inconsistency exists across multiple drawer components and could lead to preset not being properly resolved.

Copilot uses AI. Check for mistakes.
toClassValue.apply(bond, [preset?.class]),
toClassValue.apply(bond, [klass])
]}
class={['pointer-events-none absolute inset-0', '$preset', klass]}
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing preset and {bond} props. Without the preset prop, the $preset placeholder won't be replaced with actual preset classes.

Suggested change
class={['pointer-events-none absolute inset-0', '$preset', klass]}
class={['pointer-events-none absolute inset-0', preset, klass]}

Copilot uses AI. Check for mistakes.
{base}
class={[toClassValue.apply(bond, [preset?.class]), toClassValue.apply(bond, [klass])]}
{bond}
class={['$preset', klass]}
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing preset prop specification. The $preset placeholder is used but no preset key is provided to resolve it.

Copilot uses AI. Check for mistakes.
<div class="bg-foreground h-80 flex-1 rounded-lg"></div>
{/each}
</div>
<ContainerCmp class="flex flex-col items-center gap-4 w-full">
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'contaiener' to 'container' in the directory name would be consistent, but this change only updates the story file content.

Copilot uses AI. Check for mistakes.
@ryu-man ryu-man changed the title fix: improve preset handling n customization fix: improve preset handling & fix container module spelling Oct 22, 2025
@ryu-man ryu-man changed the title fix: improve preset handling & fix container module spelling fix: improve preset handling & fix container module name Oct 22, 2025
@ryu-man ryu-man merged commit cbe21ed into main Oct 22, 2025
4 checks passed
@ryu-man ryu-man deleted the fix/improve-preset-handling-n-customization branch October 22, 2025 23:23
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