[READ-ONLY] Mirror of https://github.com/probablykasper/k5kit. Utilities for TypeScript and Svelte
0

Configure Feed

Select the types of activity you want to include in your feed.

TypeScript 83.8%
JavaScript 8.1%
Svelte 6.6%
HTML 1.0%
CSS 0.6%
22 1 1

Clone this repository

https://tangled.org/kasper.space/k5kit https://tangled.org/did:plc:acb5hkxblbs3kbzppfw37bsm
git@tangled.org:kasper.space/k5kit git@tangled.org:did:plc:acb5hkxblbs3kbzppfw37bsm

For self-hosted knots, clone URLs may differ based on your setup.



README.md

k5kit#

Utilities for TypeScript and Svelte

Virtual grid#

High-performance virtual grid. Renders rows as HTML elements directly for better scroll performance instead of relying on a JS framework (which means custom markup needs to be created with JS).

Virtual grid + KSelection usage example

Features:

  • Renders rows as HTML elements directly instead of using a JS framework (for better scroll performance)
  • Rows can be dynamically loaded
  • Columns can have fixed and percentage widths

KSelection#

Row-based selection manager, with both a JS and Svelte implementation..

Virtual grid + KSelection usage example

Features:

  • Multi-selection
  • Full OS-like mouse and keyboard support. Shift selection (with proper anchoring), Cmd/Ctrl selection, arrow keys, Alt/Option+ArrowKeys, Cmd/Ctrl+A, Esc to deselect, etc.
  • Stays intact when rows are added or removed
  • Easy to integrate with the virtual grid

Auto snapshot#

Automatically snapshot Svelte form values for input, textarea and select elements.

The name attribute is used as the key. If you need to use a different key than the name attribute, you can alternatively specify it with the data-snapsho attribute.

Usage:

<script>
	import { auto_snapshot } from 'k5kit'
	const snapshotter = auto_snapshot()
	export const snapshot = snapshotter
</script>
<div use:snapshotter.container>
	<input type="text" name="first_name" />
</div>

Shortcut checking#

import { check_shortcut, check_modifiers } from 'k5kit'
check_shortcut(e, 'A') // 'A' with no modifiers pressed
check_shortcut(e, 'A', 'shift', 'alt', 'cmdOrCtrl')
check_modifiers(e) // Check that no modifiers are pressed (useful for mouse events)
check_modifiers(e, 'shift', 'alt', 'cmdOrCtrl')