diff --git a/.gitignore b/.gitignore index 0e6631a..715b548 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,22 @@ -.DS_Store node_modules -/dist/ + +# Output +.output +.vercel +/.svelte-kit +/build +/dist + +# OS +.DS_Store +Thumbs.db + +# Env +.env +.env.* +!.env.example +!.env.test + +# Vite +vite.config.js.timestamp-* +vite.config.ts.timestamp-* diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..b6f27f1 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true diff --git a/.prettierignore b/.prettierignore index 0e6631a..ab78a95 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,4 @@ -.DS_Store -node_modules -/dist/ +# Package Managers +package-lock.json +pnpm-lock.yaml +yarn.lock diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..0580f3e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,8 @@ +{ + "useTabs": false, + "singleQuote": true, + "trailingComma": "none", + "printWidth": 100, + "plugins": ["prettier-plugin-svelte"], + "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] +} diff --git a/README.md b/README.md index dabf0fb..9fc2e68 100644 --- a/README.md +++ b/README.md @@ -15,19 +15,20 @@ This library is heavily inspired by [react-hcaptcha](https://github.com/hCaptcha You can install this library via npm: -`npm install svelte-hcaptcha --save-dev` +`pnpm install svelte-hcaptcha --save-dev` ## Usage The two requirements for usage are the `sitekey` prop and a parent component such as a `
`. The component `HCaptcha` component will automatically include and load the hCaptcha API library and append it to the parent component, ready for use. The `HCaptcha` component dispatches various events which you can listen to in the parent; - * `mount` - the component has been mounted - * `load` - the hCaptcha API script has successfully loaded - * `success` - a user has successfully completed an hCaptcha challenge. The payload of this event contains a `token` which can be used to verify the captcha - * `error` - something went wrong when the user attempted the captcha - * `close` - the captcha was closed - * `expired` - the captcha has expired and needs to be re-verified + +- `mount` - the component has been mounted +- `load` - the hCaptcha API script has successfully loaded +- `success` - a user has successfully completed an hCaptcha challenge. The payload of this event contains a `token` which can be used to verify the captcha +- `error` - something went wrong when the user attempted the captcha +- `close` - the captcha was closed +- `expired` - the captcha has expired and needs to be re-verified You can read more about these events [below](#events). In particular, errors are described [here](https://docs.hcaptcha.com/configuration/#error-codes). @@ -39,8 +40,8 @@ Note also that it's not possible to develop against `localhost` or `127.0.0.1` w ```svelte