Skip to content

Commit 6eee5a3

Browse files
committed
upgrade deps && docs [skip ci]
1 parent d3638a1 commit 6eee5a3

23 files changed

+967
-226
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ export default MyComponent() {
128128

129129
This library is licensed under the MPL-2.0 open-source license.
130130

131-
132-
133131
> <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 20px"/> Please enroll in [our courses](https://mayank-chaudhari.vercel.app/courses) or [sponsor](https://github.com/sponsors/mayank1513) our work.
134132

135133
<hr />

TODO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
- [ ] 🌟 Enable [private vulnerability reporting](https://github.com/react18-tools/git-json-resolver/security)
1818
- [ ] Set up `CodeCov`
1919
- Visit Codecov and set up your repo
20-
- Create [repository secret]((https://github.com/react18-tools/git-json-resolver/settings/secrets/actions)) for `CODECOV_TOKEN`
20+
- Create [repository secret](<(https://github.com/react18-tools/git-json-resolver/settings/secrets/actions)>) for `CODECOV_TOKEN`
2121
- [ ] Set up `CodeClimate`
2222
- Visit CodeClimate and set up your repo
2323
- Create [repository secret] for `CC_TEST_REPORTER_ID`

docs/_config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
remote_theme: just-the-docs/just-the-docs
2+
title: React18 Loaders
3+
search_enabled: true
4+
nav_sort: case_insensitive
5+
footer_content: <p align="center" style="text-align:center">with 💖 by <a href="https://mayank-chaudhari.vercel.app" target="_blank">Mayank Kumar Chaudhari</a></p>

docs/index.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
---
2+
layout: default
3+
title: Home
4+
nav_order: 1
5+
---
6+
7+
# Git Json Resolver <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 40px"/>
8+
9+
[![test](https://github.com/react18-tools/git-json-resolver/actions/workflows/test.yml/badge.svg)](https://github.com/react18-tools/git-json-resolver/actions/workflows/test.yml)
10+
[![Maintainability](https://qlty.sh/gh/react18-tools/projects/git-json-resolver/maintainability.svg)](https://qlty.sh/gh/react18-tools/projects/git-json-resolver)
11+
[![codecov](https://codecov.io/gh/react18-tools/git-json-resolver/graph/badge.svg)](https://codecov.io/gh/react18-tools/git-json-resolver)
12+
[![Version](https://img.shields.io/npm/v/git-json-resolver.svg?colorB=green)](https://www.npmjs.com/package/git-json-resolver)
13+
[![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/git-json-resolver.svg)](https://www.npmjs.com/package/git-json-resolver)
14+
![npm bundle size](https://img.shields.io/bundlephobia/minzip/git-json-resolver)
15+
16+
Git Json Resolver is a comprehensive library designed to unlock the full potential of React 18 server components. It provides customizable loading animation components and a fullscreen loader container, seamlessly integrating with React and Next.js.
17+
18+
✅ Fully Treeshakable (import from `git-json-resolver/client/loader-container`)
19+
20+
✅ Fully TypeScript Supported
21+
22+
✅ Leverages the power of React 18 Server components
23+
24+
✅ Compatible with all React 18 build systems/tools/frameworks
25+
26+
✅ Documented with [Typedoc](https://react18-tools.github.io/git-json-resolver) ([Docs](https://react18-tools.github.io/git-json-resolver))
27+
28+
✅ Examples for Next.js, and Vite
29+
30+
> <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 20px"/> Star [this repository](https://github.com/react18-tools/git-json-resolver) and share it with your friends.
31+
32+
## Getting Started
33+
34+
### Installation
35+
36+
```bash
37+
pnpm add git-json-resolver
38+
```
39+
40+
**_or_**
41+
42+
```bash
43+
npm install git-json-resolver
44+
```
45+
46+
**_or_**
47+
48+
```bash
49+
yarn add git-json-resolver
50+
```
51+
52+
## Want Lite Version? [![npm bundle size](https://img.shields.io/bundlephobia/minzip/git-json-resolver-lite)](https://www.npmjs.com/package/git-json-resolver-lite) [![Version](https://img.shields.io/npm/v/git-json-resolver-lite.svg?colorB=green)](https://www.npmjs.com/package/git-json-resolver-lite) [![Downloads](https://img.jsdelivr.com/img.shields.io/npm/d18m/git-json-resolver-lite.svg)](https://www.npmjs.com/package/git-json-resolver-lite)
53+
54+
```bash
55+
pnpm add git-json-resolver-lite
56+
```
57+
58+
**or**
59+
60+
```bash
61+
npm install git-json-resolver-lite
62+
```
63+
64+
**or**
65+
66+
```bash
67+
yarn add git-json-resolver-lite
68+
```
69+
70+
> You need `r18gs` as a peer-dependency
71+
72+
### Import Styles
73+
74+
You can import styles globally or within specific components.
75+
76+
```css
77+
/* globals.css */
78+
@import "git-json-resolver/dist";
79+
```
80+
81+
```tsx
82+
// layout.tsx
83+
import "git-json-resolver/dist/index.css";
84+
```
85+
86+
For selective imports:
87+
88+
```css
89+
/* globals.css */
90+
@import "git-json-resolver/dist/client"; /** required if you are using LoaderContainer */
91+
@import "git-json-resolver/dist/server/bars/bars1";
92+
```
93+
94+
### Usage
95+
96+
Using loaders is straightforward.
97+
98+
```tsx
99+
import { Bars1 } from "git-json-resolver/dist/server/bars/bars1";
100+
101+
export default function MyComponent() {
102+
return someCondition ? <Bars1 /> : <>Something else...</>;
103+
}
104+
```
105+
106+
For detailed API and options, refer to [the API documentation](https://react18-tools.github.io/git-json-resolver).
107+
108+
**Using LoaderContainer**
109+
110+
`LoaderContainer` is a fullscreen component. You can add this component directly in your layout and then use `useLoader` hook to toggle its visibility.
111+
112+
```tsx
113+
// layout.tsx
114+
<LoaderContainer />
115+
...
116+
```
117+
118+
```tsx
119+
// some other page or component
120+
import { useLoader } from "git-json-resolver/dist/hooks";
121+
122+
export default MyComponent() {
123+
const { setLoading } = useLoader();
124+
useCallback(()=>{
125+
setLoading(true);
126+
...do some work
127+
setLoading(false);
128+
}, [])
129+
...
130+
}
131+
```
132+
133+
## License
134+
135+
This library is licensed under the MPL-2.0 open-source license.
136+
137+
> <img src="https://raw.githubusercontent.com/mayank1513/mayank1513/main/popper.png" style="height: 20px"/> Please enroll in [our courses](https://mayank-chaudhari.vercel.app/courses) or [sponsor](https://github.com/sponsors/mayank1513) our work.
138+
139+
<hr />
140+
141+
<p align="center" style="text-align:center">with 💖 by <a href="https://mayank-chaudhari.vercel.app" target="_blank">Mayank Kumar Chaudhari</a></p>
142+
143+
## Modules
144+
145+
- [matcher](matcher.md)
146+
- [matcher.test](matcher.test.md)
147+
- [normalizer](normalizer.md)
148+
- [normalizer.test](normalizer.test.md)
149+
- [types](types/README.md)
150+
- [utils](utils.md)
151+
- [utils.test](utils.test.md)

docs/matcher.md

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
---
2+
layout: default
3+
title: Matcher
4+
nav_order: 2
5+
---
6+
7+
# matcher
8+
9+
## Interfaces
10+
11+
### Matcher
12+
13+
Defined in: [matcher.ts:13](https://github.com/react18-tools/git-json-resolver/blob/d3638a1ea447825e2379ce2fb9693f8c9d039b2a/lib/src/matcher.ts#L13)
14+
15+
Matcher abstraction + adapters for micromatch/picomatch (optional).
16+
17+
Default matcher understands:
18+
19+
- `*` → matches any single field segment
20+
- `**` → matches any number of nested field segments
21+
- Prefix/suffix like `prefix-*`, `*-suffix`
22+
- Backslash escaping (micromatch-style): `a/b` → literal slash, `\*` → literal asterisk
23+
24+
Micromatch/Picomatch can be loaded at runtime as optional peers.
25+
26+
#### Properties
27+
28+
##### isMatch()
29+
30+
> **isMatch**: (`str`: `string`, `patterns`: `string`[]) => `boolean`
31+
32+
Defined in: [matcher.ts:17](https://github.com/react18-tools/git-json-resolver/blob/d3638a1ea447825e2379ce2fb9693f8c9d039b2a/lib/src/matcher.ts#L17)
33+
34+
Returns true if `str` matches at least one of the provided glob `patterns`.
35+
36+
###### Parameters
37+
38+
###### str
39+
40+
`string`
41+
42+
###### patterns
43+
44+
`string`[]
45+
46+
###### Returns
47+
48+
`boolean`
49+
50+
## Variables
51+
52+
### basicMatcher
53+
54+
> `const` **basicMatcher**: [`Matcher`](#matcher)
55+
56+
Defined in: [matcher.ts:28](https://github.com/react18-tools/git-json-resolver/blob/d3638a1ea447825e2379ce2fb9693f8c9d039b2a/lib/src/matcher.ts#L28)
57+
58+
Minimal homegrown matcher (default).
59+
Supports:
60+
61+
- `*` → matches any single field segment
62+
- `**` → matches any number of nested field segments
63+
- Literal prefix/suffix like `prefix-*`, `*-suffix`
64+
- Backslash escaping for `*` and `.`
65+
66+
## Functions
67+
68+
### loadMatcher()
69+
70+
> **loadMatcher**(`name`: `"micromatch"` \| `"picomatch"`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Matcher`](#matcher)\>
71+
72+
Defined in: [matcher.ts:41](https://github.com/react18-tools/git-json-resolver/blob/d3638a1ea447825e2379ce2fb9693f8c9d039b2a/lib/src/matcher.ts#L41)
73+
74+
Attempts to load a named matcher adapter.
75+
76+
#### Parameters
77+
78+
##### name
79+
80+
`"micromatch" | "picomatch"`
81+
82+
`"micromatch"` | `"picomatch"`
83+
84+
#### Returns
85+
86+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Matcher`](#matcher)\>
87+
88+
A Matcher implementation.

docs/matcher.test.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
layout: default
3+
title: Matcher.Test
4+
nav_order: 3
5+
---
6+
7+
# matcher.test

0 commit comments

Comments
 (0)