-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: new @maskito/solid
library
#1668
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution ❤️
I know nothing about solid-js
.
My apologies, if I've suggested something stupid or irrelevant 😄
"scripts": { | ||
"start": "jiti ./src/index.ts", | ||
"build": "tsup" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use Nx tools to build all Maskito's libraries.
Let's use Nx for the new library too.
"jiti": "^1.21.0", | ||
"solid-js": "^1.8.22", | ||
"tsup": "^8.0.2", | ||
"typescript": "^5.3.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeScript is already mentioned in the root package.json
:
Line 126 in 52824cd
"typescript": "5.0.4", |
}, | ||
"devDependencies": { | ||
"jiti": "^1.21.0", | ||
"solid-js": "^1.8.22", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also add solid-js
to peerDependencies ?
@@ -0,0 +1,19 @@ | |||
{ | |||
"name": "@maskito/solid", | |||
"version": "0.0.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sync its version with other Maskito's libraries
"name": "@maskito/solid", | ||
"version": "0.0.1", | ||
"description": "", | ||
"license": "MIT", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change license to Apache
(similar to all other Maskito's packages):
Line 21 in 52824cd
"license": "Apache-2.0", |
"version": "0.0.1", | ||
"description": "", | ||
"license": "MIT", | ||
"author": "", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can add your name here
"author": {
"name": "Thomas <your surname>",
"email": "<your email>",
"url": "https://github.com/Tommypop2"
},
@@ -0,0 +1 @@ | |||
dist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably, it should be removed migration to Nx tooling
type Setter, | ||
} from 'solid-js'; | ||
|
||
export const useMaskito = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React has the rule: "Hook names always start with use".
Does Solid
have the same rule too ?
If no, we should rethink this naming (it should be started with maskito
word).
}: { | ||
options?: MaskitoOptions | null; | ||
elementPredicate?: MaskitoElementPredicate; | ||
} = {}): Setter<HTMLElement | null> => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Soild
have directive
concept ?
If yes, let's use it (see @maskito/angular
& @maskito/vue
as examples).
I am not sure but probably Solid
has it:
https://docs.solidjs.com/reference/jsx-attributes/use#use
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import {maskito} from '@maskito/solid';
// [...]
<input type="text" use:maskito={[options, predicate]} />
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If directive is an option we should definitely go for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add documentation page ?
See this page as example:
@maskito/solid
library
I've tried to keep the API as close to the react version as possible.
Creating as a draft PR for now as I haven't figured out testing yet.
I'm happy to make any changes if required! :)