hyperbook 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/index.js +21 -9
  2. package/dist/templates/default/.hyperbook/package.json +22 -23
  3. package/dist/templates/default/.hyperbook/src/index.css +14 -0
  4. package/dist/templates/default/.hyperbook/src/pages/[[...page]].js +1 -1
  5. package/dist/templates/default/.hyperbook/src/pages/_app.js +1 -1
  6. package/dist/templates/default/.hyperbook/src/pages/glossary/[...term].js +1 -1
  7. package/dist/templates/default/.hyperbook/src/pages/glossary/index.js +1 -2
  8. package/package.json +4 -3
  9. package/dist/templates/default/.hyperbook/src/colors.css +0 -187
  10. package/dist/templates/default/.hyperbook/src/components/Drawer.js +0 -1
  11. package/dist/templates/default/.hyperbook/src/components/Layout.js +0 -1
  12. package/dist/templates/default/.hyperbook/src/components/Links.js +0 -1
  13. package/dist/templates/default/.hyperbook/src/components/Navigation.js +0 -1
  14. package/dist/templates/default/.hyperbook/src/components/Toc.js +0 -1
  15. package/dist/templates/default/.hyperbook/src/reset.css +0 -267
  16. package/dist/templates/default/.hyperbook/src/styles.css +0 -439
  17. package/dist/templates/default/.hyperbook/src/szh-menu.css +0 -269
  18. package/dist/templates/default/.hyperbook/src/utils/files.js +0 -1
  19. package/dist/templates/default/.hyperbook/src/utils/hyperbook.js +0 -1
  20. package/dist/templates/default/.hyperbook/src/utils/navigation.js +0 -4
  21. package/dist/templates/default/.hyperbook/src/utils/toc.js +0 -2
  22. package/dist/templates/default/.hyperbook/src/utils/useMountTransition.js +0 -1
  23. package/dist/templates/default/.hyperbook/src/utils/useOnScreen.js +0 -1
  24. package/dist/templates/default/.hyperbook/src/utils/useOverflow.js +0 -1
  25. package/dist/templates/default/.hyperbook/src/utils/usePreferesColorScheme.js +0 -1
@@ -1,439 +0,0 @@
1
- html,
2
- body {
3
- font-family: hyperbook-body, sans-serif;
4
- overflow-x: hidden;
5
- }
6
-
7
- body {
8
- -ms-overflow-style: none; /* IE and Edge */
9
- scrollbar-width: none; /* Firefox */
10
- }
11
-
12
- body::-webkit-scrollbar {
13
- display: none;
14
- }
15
-
16
- .main-grid {
17
- display: grid;
18
- height: 100vh;
19
- width: 100vw;
20
- grid-template-columns: 300px 1fr;
21
- grid-template-rows: 80px 1fr;
22
- grid-template-areas:
23
- "header header header"
24
- "nav article article";
25
- }
26
-
27
- .sidebar,
28
- #mobile-sidebar {
29
- display: flex;
30
- flex-direction: column;
31
- grid-area: nav;
32
- border-right-width: 1px;
33
- height: calc(100vh - 80px);
34
- border-right-style: solid;
35
- overflow-y: auto;
36
- }
37
-
38
- #toc-sidebar {
39
- display: flex;
40
- flex-direction: column;
41
- width: 100%;
42
- height: calc(100vh - 80px);
43
- border-left-width: 1px;
44
- border-left-style: solid;
45
- overflow-y: auto;
46
- }
47
-
48
- #mobile-sidebar {
49
- width: 100%;
50
- }
51
-
52
- .sidebar > nav,
53
- #mobile-sidebar > nav,
54
- #toc-sidebar > nav {
55
- padding: 20px;
56
- flex: 1;
57
- }
58
-
59
- .sidebar > .author,
60
- #mobile-sidebar > .author {
61
- text-align: center;
62
- text-decoration: none;
63
- padding: 20px;
64
- }
65
-
66
- .sidebar > .author > b,
67
- #mobile-sidebar > .author > b {
68
- font-weight: bold;
69
- }
70
-
71
- .mobile-nav {
72
- display: none;
73
- margin-left: 16px;
74
- }
75
-
76
- .mobile-nav .toggle {
77
- font-size: 42px;
78
- border: none;
79
- background: none;
80
- width: 40px;
81
- height: 40px;
82
- }
83
- .toggle > .bar1,
84
- .toggle > .bar2,
85
- .toggle > .bar3 {
86
- width: 35px;
87
- height: 5px;
88
- margin: 6px 0;
89
- transition: 0.4s;
90
- }
91
-
92
- .toc-toggle {
93
- position: fixed;
94
- top: 90px;
95
- right: 20px;
96
- border-radius: 50%;
97
- height: 40px;
98
- width: 40px;
99
- border-style: solid;
100
- border-width: 1px;
101
- opacity: 0.7;
102
- z-index: 1000;
103
- }
104
-
105
- .toc-toggle:hover {
106
- opacity: 1;
107
- }
108
-
109
- .toc-toggle > .bar1,
110
- .toc-toggle > .bar3 {
111
- width: 20px;
112
- height: 2px;
113
- margin: 2px 3px;
114
- transition: 0.4s;
115
- }
116
-
117
- .toc-toggle > .bar2,
118
- .toc-toggle > .bar4 {
119
- width: 25px;
120
- height: 2px;
121
- margin: 2px 3px;
122
- transition: 0.4s;
123
- }
124
-
125
- /* Rotate first bar */
126
- .change .bar1 {
127
- transform: rotate(-45deg) translate(-8px, 8px);
128
- }
129
-
130
- /* Fade out the second bar */
131
- .change .bar2 {
132
- opacity: 0;
133
- }
134
-
135
- /* Rotate last bar */
136
- .change .bar3 {
137
- transform: rotate(45deg) translate(-8px, -8px);
138
- }
139
-
140
- @media screen and (max-width: 800px) {
141
- .main-grid {
142
- grid-template-columns: 1fr;
143
- grid-template-rows: 80px 1fr;
144
- grid-template-areas:
145
- "header"
146
- "article";
147
- }
148
-
149
- .sidebar {
150
- display: none;
151
- }
152
-
153
- .mobile-nav {
154
- display: flex;
155
- align-items: center;
156
- justify-content: center;
157
- }
158
- }
159
-
160
- main {
161
- padding: 20px 40px;
162
- overflow-y: auto;
163
- }
164
-
165
- article {
166
- max-width: 980px;
167
- margin: 0 auto;
168
- grid-area: article;
169
- line-height: 1.5;
170
- }
171
-
172
- header {
173
- display: flex;
174
- grid-area: header;
175
- align-items: center;
176
- z-index: 1001;
177
- box-shadow: rgba(0, 0, 0, 0.24) 0px 1px 4px;
178
- }
179
-
180
- .branding {
181
- text-decoration: none;
182
- display: flex;
183
- padding: 20px;
184
- align-items: center;
185
- }
186
-
187
- .custom-links {
188
- padding: 20px;
189
- flex: 1;
190
- display: flex;
191
- justify-content: flex-end;
192
- }
193
-
194
- .custom-links .container {
195
- display: inline-flex;
196
- }
197
-
198
- .branding .logo {
199
- display: flex;
200
- align-items: center;
201
- justify-content: center;
202
- margin-right: 10px;
203
- height: 40px;
204
- width: auto;
205
- min-width: 40px;
206
- }
207
-
208
- .branding .logo img {
209
- width: auto;
210
- height: 100%;
211
- }
212
-
213
- .branding .name {
214
- font-size: 20px;
215
- font-weight: bold;
216
- }
217
-
218
- .jump-container {
219
- display: flex;
220
- max-width: 980px;
221
- margin: 0 auto;
222
- margin-top: 40px;
223
- }
224
-
225
- .flex {
226
- flex: 1;
227
- }
228
-
229
- .meta {
230
- display: flex;
231
- flex-wrap: wrap;
232
- border-top-style: solid;
233
- border-top-width: 1px;
234
- margin: 0 auto;
235
- align-items: center;
236
- justify-content: center;
237
- gap: 16px;
238
- margin-top: 30px;
239
- padding-top: 30px;
240
- max-width: 980px;
241
- }
242
-
243
- .meta .edit-github {
244
- text-decoration: none;
245
- display: block;
246
- flex: 1;
247
- }
248
-
249
- .meta .vercel {
250
- text-align: center;
251
- flex: 1;
252
- }
253
-
254
- .meta .copyright {
255
- text-align: right;
256
- flex: 1;
257
- }
258
-
259
- .section ul,
260
- .virtual-section ul,
261
- nav > ul {
262
- list-style-type: none;
263
- margin: 0;
264
- padding: 0;
265
- }
266
-
267
- nav li + li {
268
- margin-top: 0px;
269
- }
270
-
271
- .section,
272
- .virtual-section {
273
- display: flex;
274
- flex-direction: column;
275
- }
276
-
277
- .section {
278
- margin-top: 8px;
279
- margin-bottom: 8px;
280
- }
281
-
282
- .section > .name {
283
- display: flex;
284
- text-decoration: none;
285
- padding: 10px;
286
- border-width: 1px;
287
- border-style: solid;
288
- width: 100%;
289
- user-select: none;
290
- }
291
-
292
- .section > .name > .label {
293
- flex: 1;
294
- }
295
-
296
- .section > .name > .toggle {
297
- text-align: right;
298
- background: none;
299
- border: none;
300
- font-size: 13px;
301
- }
302
-
303
- .section .section {
304
- margin-left: 16px;
305
- margin-bottom: 0px;
306
- }
307
-
308
- .page {
309
- display: block;
310
- padding: 10px;
311
- text-decoration: none;
312
- }
313
-
314
- .section > .links {
315
- border-left-width: 1px;
316
- border-left-style: solid;
317
- padding-top: 6px;
318
- }
319
-
320
- .drawer-container {
321
- --transition-speed: 0.3s;
322
- }
323
-
324
- .drawer {
325
- width: 300px;
326
- height: 100%;
327
- overflow: auto;
328
- position: fixed;
329
- display: flex;
330
- box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
331
- transition: transform var(--transition-speed) ease;
332
- z-index: 1000;
333
- }
334
-
335
- .drawer.left {
336
- top: 80px;
337
- left: 0;
338
- transform: translateX(-105%);
339
- }
340
-
341
- .drawer.right {
342
- top: 80px;
343
- right: 0;
344
- transform: translateX(100%);
345
- }
346
-
347
- .drawer-container.in.open .left,
348
- .drawer-container.in.open .right {
349
- transform: translateX(0);
350
- }
351
-
352
- .backdrop {
353
- visibility: hidden;
354
- opacity: 0;
355
- background: rgba(0, 0, 0, 0.5);
356
- transition: opacity var(--transition-speed) ease,
357
- visibility var(--transition-speed) ease;
358
- width: 100%;
359
- height: 100%;
360
- top: 80px;
361
- left: 0;
362
- position: fixed;
363
- pointer-events: none;
364
- z-index: 0;
365
- }
366
-
367
- .drawer-container.in.open .backdrop {
368
- visibility: visible;
369
- opacity: 1;
370
- pointer-events: auto;
371
- z-index: 999;
372
- }
373
-
374
- .glossary .letter {
375
- font-size: 24px;
376
- }
377
-
378
- .glossary .term {
379
- list-style-type: none;
380
- text-decoration: none;
381
- }
382
-
383
- .glossary .terms {
384
- padding-left: 1em;
385
- border-left-width: 1px;
386
- border-left-style: solid;
387
- }
388
-
389
- .pages {
390
- margin-top: 30px;
391
- }
392
-
393
- .border {
394
- border-radius: 4px;
395
- border-style: solid;
396
- border-width: 1px;
397
- }
398
-
399
- .loading {
400
- display: flex;
401
- align-items: center;
402
- justify-content: center;
403
- overflow: none;
404
- font-size: 32px;
405
- position: absolute;
406
- top: 0;
407
- left: 0;
408
- right: 0;
409
- bottom: 0;
410
- }
411
-
412
- nav.toc li {
413
- margin-bottom: 8px;
414
- }
415
-
416
- nav.toc li > a {
417
- color: var(--color-text);
418
- text-decoration: none;
419
- }
420
-
421
- nav.toc li > a:hover {
422
- color: var(--color-brand);
423
- }
424
-
425
- nav.toc li.level-1 {
426
- padding-left: 0px;
427
- }
428
-
429
- nav.toc li.level-2 {
430
- padding-left: 8px;
431
- }
432
-
433
- nav.toc li.level-3 {
434
- padding-left: 16px;
435
- }
436
-
437
- nav.toc li.level-3 {
438
- padding-left: 24px;
439
- }
@@ -1,269 +0,0 @@
1
- @charset "UTF-8";
2
- .szh-menu {
3
- margin: 0;
4
- padding: 0;
5
- list-style: none;
6
- box-sizing: border-box;
7
- width: max-content;
8
- z-index: 100;
9
- border: 1px solid rgba(0, 0, 0, 0.1);
10
- background-color: var(--color-background);
11
- }
12
- .szh-menu:focus {
13
- outline: none;
14
- }
15
- .szh-menu__arrow {
16
- box-sizing: border-box;
17
- width: 0.75rem;
18
- height: 0.75rem;
19
- background-color: var(--color-background);
20
- border: 1px solid transparent;
21
- border-left-color: rgba(0, 0, 0, 0.1);
22
- border-top-color: rgba(0, 0, 0, 0.1);
23
- z-index: -1;
24
- }
25
- .szh-menu__arrow--dir-left {
26
- right: -0.375rem;
27
- transform: translateY(-50%) rotate(135deg);
28
- }
29
- .szh-menu__arrow--dir-right {
30
- left: -0.375rem;
31
- transform: translateY(-50%) rotate(-45deg);
32
- }
33
- .szh-menu__arrow--dir-top {
34
- bottom: -0.375rem;
35
- transform: translateX(-50%) rotate(-135deg);
36
- }
37
- .szh-menu__arrow--dir-bottom {
38
- top: -0.375rem;
39
- transform: translateX(-50%) rotate(45deg);
40
- }
41
- .szh-menu__item {
42
- cursor: pointer;
43
- }
44
- .szh-menu__item:focus {
45
- outline: none;
46
- }
47
- .szh-menu__item--hover {
48
- background-color: var(--color-nav);
49
- }
50
- .szh-menu__item--focusable {
51
- cursor: default;
52
- background-color: inherit;
53
- }
54
- .szh-menu__item--disabled {
55
- cursor: default;
56
- color: #aaa;
57
- }
58
- .szh-menu__item--anchor {
59
- text-decoration: none;
60
- color: var(--color-text);
61
- }
62
-
63
- .szh-menu__group {
64
- box-sizing: border-box;
65
- }
66
- .szh-menu__radio-group {
67
- margin: 0;
68
- padding: 0;
69
- list-style: none;
70
- }
71
- .szh-menu__divider {
72
- height: 1px;
73
- margin: 0.5rem 0;
74
- background-color: rgba(0, 0, 0, 0.12);
75
- }
76
-
77
- .szh-menu-button::after {
78
- content: "❯";
79
- transform: rotate(90deg);
80
- font-size: 0.8rem;
81
- position: absolute;
82
- right: 1rem;
83
- }
84
-
85
- .szh-menu-button svg {
86
- width: auto;
87
- height: 28px;
88
- stroke: var(--color-brand-text);
89
- fill: var(--color-brand-text);
90
- }
91
-
92
- .szh-menu-button.icon::after {
93
- content: "";
94
- }
95
-
96
- .szh-menu-button,
97
- .szh-menu-link {
98
- display: flex;
99
- align-items: center;
100
- position: relative;
101
- box-sizing: border-box;
102
- background: none;
103
- border-style: solid;
104
- border-color: transparent;
105
- text-decoration: none;
106
- padding: 8px;
107
- border-width: 1px;
108
- color: var(--color-brand-text);
109
- border-radius: 0.25rem;
110
- font-size: 1em;
111
- font-weight: bold;
112
- }
113
-
114
- .szh-menu-button {
115
- padding-right: 2.5rem;
116
- }
117
-
118
- .szh-menu-button.icon {
119
- padding: 8px;
120
- }
121
-
122
- .szh-menu-button:hover,
123
- .szh-menu-link:hover {
124
- border-color: var(--color-brand-text);
125
- }
126
-
127
- .szh-menu {
128
- user-select: none;
129
- color: var(--color-text);
130
- border: 1px solid var(--color-spacer);
131
- border-radius: 0.25rem;
132
- box-shadow: 0 3px 7px rgba(0, 0, 0, 0.133), 0 0.6px 2px rgba(0, 0, 0, 0.1);
133
- min-width: 10rem;
134
- }
135
- .szh-menu__item {
136
- display: flex;
137
- align-items: center;
138
- position: relative;
139
- gap: 8px;
140
- padding: 0.75rem 1rem;
141
- }
142
-
143
- .szh-menu__item > .label {
144
- flex: 1;
145
- }
146
-
147
- .szh-menu-container--itemTransition .szh-menu__item {
148
- transition-property: background-color, color;
149
- transition-duration: 0.15s;
150
- transition-timing-function: ease-in-out;
151
- }
152
- .szh-menu__item--type-radio {
153
- padding-left: 2.2rem;
154
- }
155
- .szh-menu__item--type-radio::before {
156
- content: "○";
157
- position: absolute;
158
- left: 0.8rem;
159
- top: 0.55rem;
160
- font-size: 0.8rem;
161
- }
162
- .szh-menu__item--type-radio.szh-menu__item--checked::before {
163
- content: "●";
164
- }
165
- .szh-menu__item--type-checkbox {
166
- padding-left: 2.2rem;
167
- }
168
- .szh-menu__item--type-checkbox::before {
169
- position: absolute;
170
- left: 0.8rem;
171
- }
172
- .szh-menu__item--type-checkbox.szh-menu__item--checked::before {
173
- content: "✔";
174
- }
175
- .szh-menu__submenu > .szh-menu__item {
176
- padding-right: 2.5rem;
177
- }
178
- .szh-menu__submenu > .szh-menu__item::after {
179
- content: "❯";
180
- font-size: 0.8rem;
181
- position: absolute;
182
- right: 1rem;
183
- }
184
- .szh-menu__header {
185
- color: #888;
186
- font-size: 0.8rem;
187
- padding: 0.2rem 1.5rem;
188
- text-transform: uppercase;
189
- }
190
-
191
- @keyframes szh-menu-show-slide-left {
192
- from {
193
- opacity: 0;
194
- transform: translateX(0.5rem);
195
- }
196
- }
197
- @keyframes szh-menu-hide-slide-left {
198
- to {
199
- opacity: 0;
200
- transform: translateX(0.5rem);
201
- }
202
- }
203
- @keyframes szh-menu-show-slide-right {
204
- from {
205
- opacity: 0;
206
- transform: translateX(-0.5rem);
207
- }
208
- }
209
- @keyframes szh-menu-hide-slide-right {
210
- to {
211
- opacity: 0;
212
- transform: translateX(-0.5rem);
213
- }
214
- }
215
- @keyframes szh-menu-show-slide-top {
216
- from {
217
- opacity: 0;
218
- transform: translateY(0.5rem);
219
- }
220
- }
221
- @keyframes szh-menu-hide-slide-top {
222
- to {
223
- opacity: 0;
224
- transform: translateY(0.5rem);
225
- }
226
- }
227
- @keyframes szh-menu-show-slide-bottom {
228
- from {
229
- opacity: 0;
230
- transform: translateY(-0.5rem);
231
- }
232
- }
233
- @keyframes szh-menu-hide-slide-bottom {
234
- to {
235
- opacity: 0;
236
- transform: translateY(-0.5rem);
237
- }
238
- }
239
- .szh-menu--state-opening.szh-menu--dir-left {
240
- animation: szh-menu-show-slide-left 0.15s ease-out;
241
- }
242
-
243
- .szh-menu--state-closing.szh-menu--dir-left {
244
- animation: szh-menu-hide-slide-left 0.15s ease-in forwards;
245
- }
246
-
247
- .szh-menu--state-opening.szh-menu--dir-right {
248
- animation: szh-menu-show-slide-right 0.15s ease-out;
249
- }
250
-
251
- .szh-menu--state-closing.szh-menu--dir-right {
252
- animation: szh-menu-hide-slide-right 0.15s ease-in forwards;
253
- }
254
-
255
- .szh-menu--state-opening.szh-menu--dir-top {
256
- animation: szh-menu-show-slide-top 0.15s ease-out;
257
- }
258
-
259
- .szh-menu--state-closing.szh-menu--dir-top {
260
- animation: szh-menu-hide-slide-top 0.15s ease-in forwards;
261
- }
262
-
263
- .szh-menu--state-opening.szh-menu--dir-bottom {
264
- animation: szh-menu-show-slide-bottom 0.15s ease-out;
265
- }
266
-
267
- .szh-menu--state-closing.szh-menu--dir-bottom {
268
- animation: szh-menu-hide-slide-bottom 0.15s ease-in forwards;
269
- }
@@ -1 +0,0 @@
1
- import c from"fs";import s from"path";const r=function(t,o=[]){try{return c.readdirSync(t).forEach(function(n){c.statSync(s.join(t,n)).isDirectory()?o=r(s.join(t,n),o):(n.endsWith(".md")||n.endsWith(".mdx"))&&o.push(s.join(t,n))}),o}catch{return[]}};export{r as getAllFiles};
@@ -1 +0,0 @@
1
- import o from"../../hyperbook.json";const t=()=>o;export{t as getHyperbook};
@@ -1,4 +0,0 @@
1
- import p from"fs";import b from"gray-matter";import i from"path";import{getHyperbook as h}from"./hyperbook";const f=h(),u=s=>{let r;try{r=p.readFileSync(s)}catch{try{r=p.readFileSync(i.join(s,"index")+".md")}catch{r=new Buffer(`---
2
- name: ${i.basename(s)}
3
- ---
4
- `),p.writeFileSync(i.join(s,"index")+".md",r)}}const{content:d,data:n}=b(r);return{content:d,data:n}},x=async function(s,r=[]){const d=p.readdirSync(s);let n=[],a=[];for(const t of d){let e=i.join(s,t),c;if(f.repo&&(c=f.repo+"/"+i.relative(i.join(process.env.root??process.cwd()),e)),p.statSync(e).isDirectory()){const{pages:o,sections:g}=await x(e,r),{content:y,data:v}=u(e),l={...v,href:"/"+i.relative(i.join(process.env.root??process.cwd(),"book"),e),isEmpty:y.trim()==="",pages:o,sections:g};c&&(l.repo=c+"/index.md"),a.push(l)}else{const{data:o}=u(e);if(e.endsWith(".md")&&(e=e.substring(0,e.length-3),i.relative(i.join(process.env.root??process.cwd(),"book"),e)==="index"&&(e=e.substring(0,e.length-5)),!e.endsWith("index"))){const g={...o,href:"/"+i.relative(i.join(process.env.root??process.cwd(),"book"),e)};c&&(g.repo=c),n.push(g)}}}return n=n.sort((t,e)=>t.name>e.name?1:-1),n=n.sort((t,e)=>{const c=t.index!==void 0?t.index:9999,o=e.index!==void 0?e.index:9999;return c-o}),a=a.sort((t,e)=>t.name>e.name?1:-1),a=a.sort((t,e)=>{const c=t.index!==void 0?t.index:9999,o=e.index!==void 0?e.index:9999;return c-o}),{pages:n,sections:a}},m=(s,r)=>{let d=[...r];for(const n of s)d=[...d,n,...m(n.sections,n.pages)];return d},k=async(s="/")=>{const{sections:r,pages:d}=await x(i.join(process.env.root??process.cwd(),"book"));let n=m(r,d),a=n.findIndex(o=>o.href===s);const t=n[a]||null;n=n.filter(o=>!o.isEmpty&&!o.hide),a=n.findIndex(o=>o.href===s);const e=n[a+1]||null,c=n[a-1]||null;return{next:e,current:t,previous:c,sections:r,pages:d}};export{k as getNavigation,u as readFile};
@@ -1,2 +0,0 @@
1
- const c=t=>{let e=t.toLowerCase();return e=e.replace(/[^a-zA-Z0-9 ]/g,""),e=e.replace(/ /g,"-"),e},l=t=>({headings:t.split(`
2
- `).filter(n=>n.match(/^\s*#{1,3}\s/)).map(n=>{const[,s,r]=n.match(/(#{1,3})\s(.*)/),a=c(r);return{level:s.length,label:r,anchor:a}})});export{l as getToc};
@@ -1 +0,0 @@
1
- import{useEffect as s,useState as n}from"react";const a=(t,i)=>{const[e,o]=n(!1);return s(()=>{let r;return t&&!e?o(!0):!t&&e&&(r=setTimeout(()=>o(!1),i)),()=>{clearTimeout(r)}},[i,t,e]),e};export{a as useMountTransition};
@@ -1 +0,0 @@
1
- import{useLayoutEffect as u,useState as d}from"react";const O=(t,r,s=0)=>{const[c,i]=d(!0),o=n=>()=>{if(r.current){const e=r.current.getBoundingClientRect();e.width>=n.width+s&&e.right<=window.innerWidth?i(!0):i(!1)}};return u(()=>{if(t.current){const n=t.current.getBoundingClientRect(),e=o(n);return window.addEventListener("resize",e),e(),()=>{window.removeEventListener("resize",e)}}},[t]),c};export{O as useOnScreen};
@@ -1 +0,0 @@
1
- import{useLayoutEffect as i,useState as c}from"react";const O=t=>{const[o,r]=c(void 0);return i(()=>{const{current:e}=t,s=()=>{const n=e.scrollWidth>e.clientWidth;console.log(e),r(n)};e&&("ResizeObserver"in window&&new ResizeObserver(s).observe(e),s())},[t]),o};export{O as useIsOverflow};