8000 chore: upgrade to sveldoc@0.9.x by metonym · Pull Request #7 · metonym/svelte-focus-key · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

chore: upgrade to sveldoc@0.9.x #7

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

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
dist
package
.DS_Store
/.svelte-kit
/build
/package
/node_modules
*.svelte.html
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pnpm i -D svelte-focus-key

Use the [bind:this](https://svelte.dev/docs#bind_element) directive to pass the element to focus to the `FocusKey` component.

<!-- example-start demo/Basic.svelte -->
<!-- example-start examples/Basic.svelte -->

```svelte
<script>
Expand All @@ -45,18 +45,18 @@ Use the [bind:this](https://svelte.dev/docs#bind_element) directive to pass the

The default focus key is the forward slash (`/`). Customize the key using the `key` prop.

<!-- example-start demo/CustomFocusKey.svelte -->
<!-- example-start examples/CustomFocusKey.svelte -->

```svelte
<script>
import FocusKey from "svelte-focus-key";

let textarea;
let element;
</script>

<textarea bind:this={textarea} placeholder={'Press "s" to focus'} />
<textarea bind:this={element} placeholder={'Press "s" to focus'} />

<FocusKey element={textarea} key="s" />
<FocusKey {element} key="s" />
```

<!-- example-end -->
Expand All @@ -65,18 +65,18 @@ The default focus key is the forward slash (`/`). Customize the key using the `k

The `key` prop can also accept an array of keys.

<!-- example-start demo/MultipleFocusKeys.svelte -->
<!-- example-start examples/MultipleFocusKeys.svelte -->

```svelte
<script>
import FocusKey from "svelte-focus-key";

let node;
let element;
</script>

<input bind:this={node} placeholder={'Press "a" or "b"'} />
<input bind:this={element} placeholder={'Press "a" or "b"'} />

<FocusKey element={node} key={["a", "b"]} />
<FocusKey {element} key={["a", "b"]} />
```

<!-- example-end -->
Expand All @@ -85,22 +85,22 @@ The `key` prop can also accept an array of keys.

Set `selectText` to `true` to select the text in the element when focusing.

<!-- example-start demo/SelectTextOnFocus.svelte -->
<!-- example-start examples/SelectTextOnFocus.svelte -->

```svelte
<script>
import FocusKey from "svelte-focus-key";

let input;
let element;
</script>

<input
bind:this={input}
bind:this={element}
value={'Press "e" to focus'}
placeholder={'Press "e" to focus'}
/>

<FocusKey element={input} key="e" selectText />
<FocusKey {element} key="e" selectText />
```

<!-- example-end -->
Expand All @@ -109,7 +109,7 @@ Set `selectText` to `true` to select the text in the element when focusing.

This utility also provides a [Svelte action](https://svelte.dev/docs#use_action).

<!-- example-start demo/FocusKeyAction.svelte -->
<!-- example-start examples/FocusKeyAction.svelte -->

```svelte
<script>
Expand All @@ -133,5 +133,13 @@ This utility also provides a [Svelte action](https://svelte.dev/docs#use_action)

The `focusKey` action has the same props as `FocusKey` except for `element`.

## Changelog

[Changelog](./CHANGELOG.md)

## License

[MIT](./LICENSE)

[npm]: https://img.shields.io/npm/v/svelte-focus-key.svg?style=for-the-badge&color=%23ff3e00
[npm-url]: https://npmjs.com/package/svelte-focus-key
9 changes: 0 additions & 9 deletions demo/CustomFocusKey.svelte

This file was deleted.

9 changes: 0 additions & 9 deletions demo/MultipleFocusKeys.svelte

This file was deleted.

67F4
116 changes: 0 additions & 116 deletions demo/__layout.svelte

This file was deleted.

15 changes: 0 additions & 15 deletions demo/_app.html

This file was deleted.

5 changes: 0 additions & 5 deletions demo/global.d.ts

This file was deleted.

5 changes: 0 additions & 5 deletions demo/index.svelte

This file was deleted.

File renamed without changes.
9 changes: 9 additions & 0 deletions examples/CustomFocusKey.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script>
import FocusKey from "svelte-focus-key";

let element;
</script>

<textarea bind:this={element} placeholder={'Press "s" to focus'} />

<FocusKey {element} key="s" />
File renamed without changes.
9 changes: 9 additions & 0 deletions examples/MultipleFocusKeys.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script>
import FocusKey from "svelte-focus-key";

let element;
</script>

<input bind:this={element} placeholder={'Press "a" or "b"'} />

<FocusKey {element} key={["a", "b"]} />
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<script>
import FocusKey from "svelte-focus-key";

let input;
let element;
</script>

<input
bind:this={input}
bind:this={element}
value={'Press "e" to focus'}
placeholder={'Press "e" to focus'}
/>

<FocusKey element={input} key="e" selectText />
<FocusKey {element} key="e" selectText />
5 changes: 5 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script type="module">
import App from "./README.md";

new App({ target: document.body });
</script>
17 changes: 10 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@
"author": "Eric Liu (https://github.com/metonym)",
"type": "module",
"scripts": {
"dev": "vite dev",
"dev": "vite",
"build": "vite build",
"deploy": "yarn build && touch build/.nojekyll && gh-pages -d build -t true",
"package": "svelte-kit package",
"preview": "vite preview",
"prepack": "svelte-package",
"test": "vitest"
},
"devDependencies": {
"@sveltejs/adapter-static": "^1.0.0-next.39",
"gh-pages": "^4.0.0",
"github-markdown-css": "^5.1.0",
"sveldoc": "^0.7.0"
"@sveltejs/package": "^1.0.0-next.3",
"@testing-library/svelte": "^3.2.1",
"@testing-library/user-event": "^14.4.3",
"jsdom": "^20.0.0",
"sveldoc": "^0.10.1",
"vite": "^3.0.9",
"vitest": "^0.22.1"
},
"repository": {
"type": "git",
Expand Down
19 changes: 4 additions & 15 deletions svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import adapter from "@sveltejs/adapter-static";
import { createConfig } from "sveldoc";

export default createConfig({
kit: {
adapter: adapter(),
paths: {
base: process.env.NODE_ENV === "production" ? "/svelte-focus-key" : "",
},
files: {
lib: "src",
routes: "demo",
template: "demo/_app.html",
},
export default {
package: {
source: "src",
},
});
};
Loading
0