Skip to content

Commit

Permalink
Merge pull request #3 from humanspeak/feature-next-version
Browse files Browse the repository at this point in the history
Feature: 4.x
  • Loading branch information
jaysin586 authored Jan 22, 2025
2 parents 3746a36 + 64c0ca8 commit 98f892e
Show file tree
Hide file tree
Showing 18 changed files with 1,757 additions and 1,091 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
/** @type { import("eslint").Linter.FlatConfig } */
module.exports = {
root: true,
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:svelte/recommended', 'prettier'],
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:svelte/recommended',
'prettier'
],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
parserOptions: {
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ node_modules
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
/coverage
junit-vitest.xml
1 change: 0 additions & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
engine-strict=true
@humanspeak:registry=https://npm.pkg.github.com
11 changes: 2 additions & 9 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
{
"useTabs": false,
"trailingComma": "none",
"printWidth": 200,
"printWidth": 100,
"tabWidth": 4,
"semi": false,
"singleQuote": true,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
}
9 changes: 9 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp
2 changes: 2 additions & 0 deletions .trunk/configs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Prettier friendly markdownlint config (all formatting rules disabled)
extends: markdownlint/style/prettier
7 changes: 7 additions & 0 deletions .trunk/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ['{|}']
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
36 changes: 36 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.22.9
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.6.6
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- [email protected]
- [email protected]
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- git-diff-check
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
- [email protected]
actions:
enabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
- trunk-upgrade-available
2 changes: 1 addition & 1 deletion LICENSE.md → LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2024 Humanspeak, Inc.
Copyright (c) 2024-2025 Humanspeak, Inc.

Copyright (c) 2022-2024 Bryan Lee

Expand Down
22 changes: 12 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# svelte-render

[![npm version](http://img.shields.io/npm/v/svelte-render.svg)](https://www.npmjs.com/package/svelte-render)
[![npm downloads](https://img.shields.io/npm/dm/svelte-render.svg)](https://www.npmjs.com/package/svelte-render)
[![npm version](http://img.shields.io/npm/v/@humanspeak/svelte-render.svg)](https://www.npmjs.com/package/svelte-render)
[![npm downloads](https://img.shields.io/npm/dm/@humanspeak/svelte-render.svg)](https://www.npmjs.com/package/svelte-render)
![license](https://img.shields.io/npm/l/svelte-render)
![build](https://img.shields.io/github/actions/workflow/status/bryanmylee/svelte-render/publish.yml)
[![coverage](https://coveralls.io/repos/github/bryanmylee/svelte-render/badge.svg?branch=main)](https://coveralls.io/github/bryanmylee/svelte-render?branch=main)
[![size](https://img.shields.io/bundlephobia/min/svelte-render)](https://bundlephobia.com/result?p=svelte-render)
![build](https://img.shields.io/github/actions/workflow/status/humanspeak/svelte-render/publish.yml)
[![coverage](https://coveralls.io/repos/github/humanspeak/svelte-render/badge.svg?branch=main)](https://coveralls.io/github/humanspeak/svelte-render?branch=main)
[![size](https://img.shields.io/bundlephobia/min/@humanspeak/svelte-render)](https://bundlephobia.com/result?p=@humanspeak/svelte-render)

Manage complex Svelte behaviors outside of templates with full type safety.

Expand All @@ -14,7 +14,9 @@ Manage complex Svelte behaviors outside of templates with full type safety.
import { Render, createRender } from 'svelte-render'
import Avatar from './Avatar.svelte'
// ...
const avatar = createRender(Avatar, { name: 'Ada Lovelace' }).on('click', handleClick).on('launch', handleLaunch)
const avatar = createRender(Avatar, { name: 'Ada Lovelace' })
.on('click', handleClick)
.on('launch', handleLaunch)
</script>
<Render of={avatar} />
Expand All @@ -28,17 +30,17 @@ $ npm i -D svelte-render

## API

Svelte Render was primarily built to support complex rendering definitions for [Svelte Headless Table](https://github.com/bryanmylee/svelte-headless-table). You can find full documentation on `createRender` on the [documentation site](https://svelte-headless-table.bryanmylee.com/docs/api/create-render).
Svelte Render was primarily built to support complex rendering definitions for [Svelte Headless Table](https://github.com/humanspeak/svelte-headless-table).

### `<Render />`

`<Render />` handles props and automatically registers the event handlers defined with `.on` as well as slot data defined with `.slot`.

`of` accepts:

- primitive data such as `number` and `string`
- `Writable<number>` and `Writable<string>` for dynamic primitive data
- `ComponentRenderConfig` returned by `createRender`
- primitive data such as `number` and `string`
- `Writable<number>` and `Writable<string>` for dynamic primitive data
- `ComponentRenderConfig` returned by `createRender`

```svelte
<script>
Expand Down
Loading

0 comments on commit 98f892e

Please sign in to comment.