diff --git a/packages/nanoviews/.size-limit.json b/packages/nanoviews/.size-limit.json index 1f5e310c..7d9eb7c6 100644 --- a/packages/nanoviews/.size-limit.json +++ b/packages/nanoviews/.size-limit.json @@ -16,13 +16,13 @@ "name": "Average usage (Gzip)", "gzip": true, "path": "dist/index.js", - "import": "{ fragment, div, form, input, button, label, classList$, if_, for_, value$, $$children, effect }", + "import": "{ fragment, div, form, input, button, label, classList$, if_, for_, value$, children$, effect }", "limit": "3.8 kB" }, { "name": "Average usage (Brotli)", "path": "dist/index.js", - "import": "{ fragment, div, form, input, button, label, classList$, if_, for_, value$, $$children, effect }", + "import": "{ fragment, div, form, input, button, label, classList$, if_, for_, value$, children$, effect }", "limit": "3.55 kB" } ] diff --git a/packages/nanoviews/src/component/children.stories.ts b/packages/nanoviews/src/component/children.stories.ts index e8ee8524..0aa7ecd7 100644 --- a/packages/nanoviews/src/component/children.stories.ts +++ b/packages/nanoviews/src/component/children.stories.ts @@ -5,7 +5,7 @@ import { } from '@nanoviews/storybook' import { createElement } from '../elements/index.js' import { - $$slot, + slot$, getSlots } from './children.js' @@ -17,7 +17,7 @@ export default meta type Story = StoryObj -const TestSlot = (text: string) => $$slot(TestSlot, text) +const TestSlot = (text: string) => slot$(TestSlot, text) export const NoSlot: Story = { render: nanoStory( @@ -39,8 +39,8 @@ export const Slot: Story = { ) } -const PreSlot = (text: string) => $$slot(PreSlot, text) -const PostSlot = (text: string) => $$slot(PostSlot, text) +const PreSlot = (text: string) => slot$(PreSlot, text) +const PostSlot = (text: string) => slot$(PostSlot, text) export const Slots: Story = { render: nanoStory( diff --git a/packages/nanoviews/src/component/children.ts b/packages/nanoviews/src/component/children.ts index dd57f1eb..523e3945 100644 --- a/packages/nanoviews/src/component/children.ts +++ b/packages/nanoviews/src/component/children.ts @@ -17,7 +17,7 @@ import { lazyChild } from '../internals/index.js' * @param render - Function to render block with given children * @returns Function that accepts children */ -export function $$children< +export function children$< T extends Child, C extends unknown[] = Children >(render: Renderer) { @@ -41,7 +41,7 @@ export function isSlot(value: unknown): value is Slot { * @param content - Slot content * @returns Slot */ -export function $$slot< +export function slot$< C, // oxlint-disable-next-line typescript/no-explicit-any F extends (...args: any[]) => Slot @@ -98,7 +98,7 @@ export function getSlots< * @param render - Function to render block with given slots and children * @returns Function that accepts children */ -export function $$slots< +export function slots$< T extends Child, D extends AnySlotDef[] >(