svelte-legos icon indicating copy to clipboard operation
svelte-legos copied to clipboard

Enhancement: Rename Actions/Stores

Open Antonio-Bennett opened this issue 1 year ago • 2 comments

I'm of the opinion that actions should be renamed to drop the "Action" label from imports. This is because the use: syntax indicates that it is an action. Here is also the thread on Twitter discussing the possibility of renaming stores into readable and writable variants. https://twitter.com/ankurpsinghal/status/1637505767757455365?s=46&t=vXFY1pu_gVqC1tnNxYJ_Ow

Below are the different options versus currently.

//Current
import { hoverAction } from "svelte-legos";

//suggested
import { hover } from "svelte-legos";

This gives us

<div use:hoverAction on:hover={handler} />

//versus 

<div use:hover on:hover={handler} />

In terms of stores, appending Store isn't bad but as per the thread maybe explicitly stating readable/writable would be better.

The options are

import { hoverStore } from "svelte-legos";

//versus

//This one seems to make the most sense to me
import { readableHover } from "svelte-legos";

//or maybe

import { hoverReadable } from "svelte-legos";

Antonio-Bennett avatar Mar 19 '23 17:03 Antonio-Bennett

I very much agree with this - see also #8 on the same topic

symsmith avatar Mar 19 '23 18:03 symsmith

Yeah reading through that thread it would be nice if the imports are from either svelte-legos/actions or svelte-legos/stores that way it's even more explicit

Antonio-Bennett avatar Mar 19 '23 20:03 Antonio-Bennett