@instincthub/react-ui 0.1.52 → 0.1.54
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.
- package/dist/src/assets/css/forms/input-fields.css +2 -0
- package/dist/src/assets/css/forms/time-picker.css +0 -5
- package/dist/src/assets/css/ui/content-viewer.css +171 -1
- package/dist/src/assets/css/ui/dropdown-styles.css +2 -0
- package/dist/src/components/ui/viewer/ContentViewOrEdit.js +1 -1
- package/dist/src/components/ui/viewer/ContentViewer.js +1 -1
- package/dist/src/components/ui/viewer/codeCopyEnhancer.js +2 -0
- package/dist/src/components/ui/viewer/codeCopyEnhancer.js.map +1 -0
- package/dist/src/types/__examples__/.next/types/app/api/auth/[...nextauth]/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/auth/login/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/components/docs/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/components/recommend/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/components/search/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/fallback/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/generate/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/help/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/api/mcp/route.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/auth/layout.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/auth/login/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/auth/password-match/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/code-display/layout.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/code-display/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/auth/client-detector/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/auth/login-form/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/auth/signup-form/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/auth/username-email-checker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/charts/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/action-dropdown/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/animated-box/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/checkboxes/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/chips-input/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/date-input/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/date-input-picker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/date-range-picker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/drop-file/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/email-list/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/file-uploader/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/filter-array/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/filter-objects/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/form-error/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/input-amount/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/input-number/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/input-text/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/input-textarea/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/message-display/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/multiple-email/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/password-field/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/radio-button/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/search-field/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/search-objects-from-db/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/searchable-dropdown/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/time-picker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/toggle-button/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/forms/uploads/ihub-file-uploader/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/navbars/breadcrumb/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/navbars/responsive-navbar/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/navbars/sidenav/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/navbars/tabs/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/actions/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/badges/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/card-grid/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/card-list/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/cards/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/color-picker/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/content-view-or-edit/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/content-viewer/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/create-button/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/dangerous-renderer/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/dialogs/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/dropdowns/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/ihub-text-editor/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/modals/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/or-divider/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/pagination/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/random-gradient-image/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/table-examples/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/table-server-examples/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/components/ui/text-editor/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/cursors/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/examples/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/libs/examples/loadscript/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/libs/examples/modals/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/libs/examples/paystacks/page.d.ts +13 -0
- package/dist/src/types/__examples__/.next/types/app/libs/page.d.ts +13 -0
- package/dist/src/types/components/ui/viewer/ContentViewOrEdit.d.ts +23 -0
- package/dist/src/types/components/ui/viewer/ContentViewer.d.ts +8 -1
- package/dist/src/types/components/ui/viewer/codeCopyEnhancer.d.ts +58 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -585,6 +585,7 @@
|
|
|
585
585
|
padding: 10px;
|
|
586
586
|
cursor: pointer;
|
|
587
587
|
transition: background-color 0.2s ease;
|
|
588
|
+
font-size: .8rem;
|
|
588
589
|
}
|
|
589
590
|
|
|
590
591
|
.ihub-select__item:hover {
|
|
@@ -621,6 +622,7 @@
|
|
|
621
622
|
|
|
622
623
|
.ihub-select__btn p {
|
|
623
624
|
margin: 0;
|
|
625
|
+
font-size: .8rem;
|
|
624
626
|
}
|
|
625
627
|
|
|
626
628
|
.ihub-select__content {
|
|
@@ -345,6 +345,161 @@
|
|
|
345
345
|
font-size: inherit;
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
+
/* ==========================================================================
|
|
349
|
+
Code blocks with click-to-copy
|
|
350
|
+
========================================================================== */
|
|
351
|
+
|
|
352
|
+
.ihub-code-block-wrapper {
|
|
353
|
+
position: relative;
|
|
354
|
+
margin: 1.5rem 0;
|
|
355
|
+
border-radius: 0.5rem;
|
|
356
|
+
overflow: hidden;
|
|
357
|
+
background-color: #1e1e2e;
|
|
358
|
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.ihub-code-block-wrapper pre,
|
|
362
|
+
.ihub-content-viewer .ihub-code-block-wrapper pre {
|
|
363
|
+
margin: 0;
|
|
364
|
+
border-radius: 0;
|
|
365
|
+
border: none;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.ihub-code-block-wrapper pre:focus-visible {
|
|
369
|
+
outline: 2px solid var(--DarkCyan, #00838f);
|
|
370
|
+
outline-offset: -2px;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
.ihub-code-block-toolbar {
|
|
374
|
+
display: flex;
|
|
375
|
+
align-items: center;
|
|
376
|
+
justify-content: space-between;
|
|
377
|
+
gap: 0.75rem;
|
|
378
|
+
padding: 0.4rem 0.6rem 0.4rem 1rem;
|
|
379
|
+
background-color: #181825;
|
|
380
|
+
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.ihub-code-block-lang {
|
|
384
|
+
font-family: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Monaco,
|
|
385
|
+
Consolas, monospace;
|
|
386
|
+
font-size: 0.7rem;
|
|
387
|
+
font-weight: 500;
|
|
388
|
+
letter-spacing: 0.06em;
|
|
389
|
+
text-transform: uppercase;
|
|
390
|
+
color: #a6adc8;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.ihub-code-copy-btn {
|
|
394
|
+
display: inline-flex;
|
|
395
|
+
align-items: center;
|
|
396
|
+
gap: 0.35rem;
|
|
397
|
+
padding: 0.3rem 0.6rem;
|
|
398
|
+
font-family: var(--Nunito, sans-serif);
|
|
399
|
+
font-size: 0.75rem;
|
|
400
|
+
line-height: 1;
|
|
401
|
+
color: #cdd6f4;
|
|
402
|
+
background-color: rgba(255, 255, 255, 0.06);
|
|
403
|
+
border: 1px solid rgba(255, 255, 255, 0.14);
|
|
404
|
+
border-radius: 0.3rem;
|
|
405
|
+
cursor: pointer;
|
|
406
|
+
transition: background-color 0.2s ease, color 0.2s ease,
|
|
407
|
+
border-color 0.2s ease;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.ihub-code-copy-btn:hover {
|
|
411
|
+
background-color: rgba(255, 255, 255, 0.14);
|
|
412
|
+
color: #ffffff;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.ihub-code-copy-btn:focus-visible {
|
|
416
|
+
outline: 2px solid var(--DarkCyan, #00838f);
|
|
417
|
+
outline-offset: 2px;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.ihub-code-copy-btn.ihub-copied,
|
|
421
|
+
.ihub-code-copy-btn.ihub-copied:hover {
|
|
422
|
+
color: #a6e3a1;
|
|
423
|
+
background-color: rgba(166, 227, 161, 0.14);
|
|
424
|
+
border-color: rgba(166, 227, 161, 0.45);
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.ihub-code-copy-btn svg {
|
|
428
|
+
flex-shrink: 0;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/* Line numbers.
|
|
432
|
+
The digits live in a ::before pseudo-element, so they are never part of the
|
|
433
|
+
DOM text (copy button, PDF export) and `user-select: none` keeps them out of
|
|
434
|
+
manual highlight-and-copy selections. */
|
|
435
|
+
.ihub-content-viewer pre.ihub-line-numbers {
|
|
436
|
+
counter-reset: ihub-code-line;
|
|
437
|
+
padding-left: 0;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.ihub-content-viewer pre.ihub-line-numbers .ihub-code-line::before {
|
|
441
|
+
content: counter(ihub-code-line);
|
|
442
|
+
counter-increment: ihub-code-line;
|
|
443
|
+
display: inline-block;
|
|
444
|
+
box-sizing: border-box;
|
|
445
|
+
min-width: 3.25em;
|
|
446
|
+
margin-right: 1rem;
|
|
447
|
+
padding: 0 0.75rem 0 0.5rem;
|
|
448
|
+
text-align: right;
|
|
449
|
+
color: #6c7086;
|
|
450
|
+
background-color: #1e1e2e;
|
|
451
|
+
border-right: 1px solid rgba(255, 255, 255, 0.08);
|
|
452
|
+
/* Keep the gutter pinned while long lines scroll horizontally */
|
|
453
|
+
position: sticky;
|
|
454
|
+
left: 0;
|
|
455
|
+
-webkit-user-select: none;
|
|
456
|
+
-moz-user-select: none;
|
|
457
|
+
-ms-user-select: none;
|
|
458
|
+
user-select: none;
|
|
459
|
+
pointer-events: none;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/* Inline snippets: click (or Enter/Space) to copy */
|
|
463
|
+
.ihub-content-viewer code[data-ihub-copy="inline"] {
|
|
464
|
+
cursor: copy;
|
|
465
|
+
transition: background-color 0.2s ease, color 0.2s ease;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.ihub-content-viewer code[data-ihub-copy="inline"]:hover {
|
|
469
|
+
background-color: rgba(0, 131, 143, 0.12);
|
|
470
|
+
color: var(--DarkCyan, #00838f);
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.ihub-content-viewer code[data-ihub-copy="inline"]:focus-visible {
|
|
474
|
+
outline: 2px solid var(--DarkCyan, #00838f);
|
|
475
|
+
outline-offset: 2px;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
.ihub-content-viewer code[data-ihub-copy="inline"].ihub-inline-copied {
|
|
479
|
+
background-color: rgba(64, 160, 43, 0.2);
|
|
480
|
+
color: #2f7d1f;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/* Screen-reader-only live region */
|
|
484
|
+
.ihub-sr-only {
|
|
485
|
+
position: absolute;
|
|
486
|
+
width: 1px;
|
|
487
|
+
height: 1px;
|
|
488
|
+
padding: 0;
|
|
489
|
+
margin: -1px;
|
|
490
|
+
overflow: hidden;
|
|
491
|
+
clip: rect(0, 0, 0, 0);
|
|
492
|
+
white-space: nowrap;
|
|
493
|
+
border: 0;
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
@media (prefers-reduced-motion: reduce) {
|
|
497
|
+
.ihub-code-copy-btn,
|
|
498
|
+
.ihub-content-viewer code[data-ihub-copy="inline"] {
|
|
499
|
+
transition: none;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
348
503
|
/* Blockquote */
|
|
349
504
|
.ihub-content-viewer blockquote {
|
|
350
505
|
border-left: 3px solid var(--DarkCyan, #0891b2);
|
|
@@ -538,6 +693,16 @@
|
|
|
538
693
|
border-color: rgba(255, 255, 255, 0.1);
|
|
539
694
|
}
|
|
540
695
|
|
|
696
|
+
.DarkMode .ihub-content-viewer code[data-ihub-copy="inline"]:hover {
|
|
697
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
698
|
+
color: #7fd7e3;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
.DarkMode .ihub-content-viewer code[data-ihub-copy="inline"].ihub-inline-copied {
|
|
702
|
+
background-color: rgba(166, 227, 161, 0.22);
|
|
703
|
+
color: #a6e3a1;
|
|
704
|
+
}
|
|
705
|
+
|
|
541
706
|
.DarkMode .ihub-content-viewer figcaption,
|
|
542
707
|
.DarkMode .ihub-content-viewer figure.ihub-te-image-block figcaption {
|
|
543
708
|
color: #94a3b8;
|
|
@@ -580,10 +745,15 @@
|
|
|
580
745
|
|
|
581
746
|
/* Print styles */
|
|
582
747
|
@media print {
|
|
583
|
-
.ihub-content-toolbar
|
|
748
|
+
.ihub-content-toolbar,
|
|
749
|
+
.ihub-code-block-toolbar {
|
|
584
750
|
display: none;
|
|
585
751
|
}
|
|
586
752
|
|
|
753
|
+
.ihub-code-block-wrapper {
|
|
754
|
+
border: 1px solid rgba(0, 0, 0, 0.2);
|
|
755
|
+
}
|
|
756
|
+
|
|
587
757
|
.ihub-content-viewer {
|
|
588
758
|
padding: 0;
|
|
589
759
|
border: none;
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
overflow: hidden;
|
|
45
45
|
white-space: nowrap;
|
|
46
46
|
text-overflow: ellipsis;
|
|
47
|
+
font-size: .8rem;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
.ihub-dropdown-placeholder {
|
|
@@ -117,6 +118,7 @@
|
|
|
117
118
|
padding: 10px 15px;
|
|
118
119
|
cursor: pointer;
|
|
119
120
|
transition: background-color 0.2s ease;
|
|
121
|
+
font-size: .8rem;
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
.ihub-dropdown-option:hover:not(.ihub-dropdown-disabled-option) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react/jsx-runtime"),i=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react/jsx-runtime"),i=require("react"),o=require("../editor/CustomTextEditor.js"),n=require("./ContentViewer.js");exports.default=function(r){var s,l,d,a=i.useState(!1),u=e.slicedToArray(a,2),c=u[0],h=u[1];return t.jsx("div",{className:"ihub-content-page ihub-style-list",children:c?t.jsx(o.default,{isEditing:c,setIsEditing:h,content:r.content,onChange:r.setContent,placeholder:r.placeholder,charLimit:r.charLimit,lastUpdated:r.lastUpdated,showPreviewBtn:r.showPreviewBtn}):t.jsx(n.default,{isEditing:c,setIsEditing:h,content:r.content,title:r.title,showToolbar:r.showToolbar,showEditBtn:r.showEditBtn,enableCodeCopy:null===(s=r.enableCodeCopy)||void 0===s||s,enableInlineCodeCopy:null===(l=r.enableInlineCodeCopy)||void 0===l||l,showCodeLineNumbers:null===(d=r.showCodeLineNumbers)||void 0===d||d})})};
|
|
2
2
|
//# sourceMappingURL=ContentViewOrEdit.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("react/jsx-runtime"),r=require("react"),n=require("../../../../node_modules/.pnpm/dompurify@3.3.0/node_modules/dompurify/dist/purify.es.mjs.js"),o=require("jspdf"),i=require("../../../../node_modules/.pnpm/html2canvas@1.4.1/node_modules/html2canvas/dist/html2canvas.esm.js"),a=require("../../../../node_modules/.pnpm/marked@15.0.12/node_modules/marked/lib/marked.esm.js"),c=require("@mui/icons-material/Print"),s=require("@mui/icons-material/FileDownload"),u=require("@mui/icons-material/ContentCopy"),l=require("@mui/icons-material/Edit"),d=require("@mui/icons-material/Fullscreen"),f=require("@mui/icons-material/FullscreenExit"),m=require("./codeCopyEnhancer.js");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=b(c),p=b(s),v=b(u),g=b(l),y=b(d),k=b(f);exports.default=function(c){var s=c.content,u=c.title,l=void 0===u?"Document":u,d=c.className,f=void 0===d?"":d,b=c.editable,C=void 0!==b&&b,x=c.onContentChange,E=c.isEditing,w=void 0!==E&&E,T=c.setIsEditing,j=void 0===T?function(){}:T,S=c.showToolbar,A=void 0===S||S,L=c.showEditBtn,q=void 0!==L&&L,N=c.isMarkdown,_=void 0!==N&&N,D=c.enableCodeCopy,F=void 0===D||D,P=c.enableInlineCodeCopy,z=void 0===P||P,H=c.showCodeLineNumbers,I=void 0===H||H,M=r.useRef(null),R=r.useState(""),G=e.slicedToArray(R,2),$=G[0],B=G[1],U=r.useState(!1),O=e.slicedToArray(U,2),W=O[0],J=O[1],K=r.useState(null),Q=e.slicedToArray(K,2),V=Q[0],X=Q[1];r.useEffect(function(){n.default.addHook("afterSanitizeAttributes",function(e){if("A"===e.tagName&&e.getAttribute("href")){e.setAttribute("rel","noopener noreferrer");var t=e.getAttribute("href");t&&t.startsWith("http")&&e.setAttribute("target","_blank")}})},[]),r.useEffect(function(){a.marked.use({gfm:!0,breaks:!0})},[]);var Y=function(e){if(_)return!0;return[/^#\s+.+$/m,/^\*\s+.+$/m,/^\d+\.\s+.+$/m,/\[.+\]\(.+\)/,/!\[.+\]\(.+\)/,/^>\s+.+$/m,/`{1,3}[\s\S]*?`{1,3}/,/^\s*\*\*\*+\s*$/m,/\*\*.+\*\*/,/\*.+\*/,/^(\|[^|]+\|)+$/m].some(function(t){return t.test(e)})},Z=function(e){return Promise.resolve(a.marked(e))},ee=function(e){return e.replace(/<code>([\s\S]*?)<\/code>/g,function(e,t){var r=t.replace(/</g,"<").replace(/>/g,">");return"<code>".concat(r,"</code>")})},te=function(){var t=e.asyncToGenerator(e.regenerator().m(function t(r){var o,i,a,c,s;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:if(!(o=Y(r))){e.n=2;break}return e.n=1,Z(r);case 1:s=e.v,e.n=3;break;case 2:s=r;case 3:return(i=s).includes("<code>")&&(i=ee(i)),a=n.default.sanitize(i,{USE_PROFILES:{html:!0},ADD_ATTR:["target","rel","data-type","data-checked","class"],ADD_TAGS:["iframe","video","audio","source","figure","figcaption"]}),(c=document.createElement("div")).innerHTML=a,o&&(c.querySelectorAll("blockquote").forEach(function(e){e.classList.add("ihub-blockquote")}),c.querySelectorAll("pre code").forEach(function(e){var t=e.parentElement;t&&t.classList.add("ihub-code-block"),e.classList.add("ihub-code")}),c.querySelectorAll("code:not(pre code)").forEach(function(e){e.classList.add("ihub-inline-code")}),c.querySelectorAll("table").forEach(function(e){e.classList.add("ihub-table"),e.setAttribute("cellspacing","0"),e.setAttribute("cellpadding","0")})),m.enhanceCodeBlocks(c,{enableBlockCopy:F,enableInlineCopy:z,showLineNumbers:I}),B(c.innerHTML),e.a(2,c.innerHTML)}},t)}));return function(e){return t.apply(this,arguments)}}();r.useEffect(function(){s&&te(s)},[s,_,F,z,I]);var re=r.useCallback(function(e){if(C&&x){var t=e.target;if("INPUT"===t.tagName&&"checkbox"===t.getAttribute("type")){var r=t,n=r.closest("li");if(n){var o=r.checked;n.setAttribute("data-checked",o?"true":"false"),M.current&&x&&x(M.current.innerHTML)}}}},[C,x]),ne=r.useRef([]),oe=r.useCallback(function(){var t=e.asyncToGenerator(e.regenerator().m(function t(r){var n;return e.regenerator().w(function(t){for(;;)switch(t.n){case 0:if(n=m.resolveCodeCopyTarget(r.target)){t.n=1;break}return t.a(2);case 1:return r.preventDefault(),t.n=2,m.copyTextToClipboard(n.text);case 2:if(t.v){t.n=3;break}return se("Failed to copy code","error"),t.a(2);case 3:ne.current=[].concat(e.toConsumableArray(ne.current.slice(-9)),[m.showCopiedFeedback(n)]),"inline"===n.kind&&se("Code copied to clipboard!","success");case 4:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),[]),ie=r.useCallback(function(e){if("Enter"===e.key||" "===e.key){var t=m.resolveCodeCopyTarget(e.target);t&&"BUTTON"!==t.element.tagName&&oe(e)}},[oe]);r.useEffect(function(){var e=M.current;if(e)return e.addEventListener("click",re),e.addEventListener("click",oe),e.addEventListener("keydown",ie),function(){e.removeEventListener("click",re),e.removeEventListener("click",oe),e.removeEventListener("keydown",ie)}},[re,oe,ie]),r.useEffect(function(){return function(){ne.current.forEach(function(e){return clearTimeout(e)})}},[]);var ae=function(){var t=e.asyncToGenerator(e.regenerator().m(function t(){var r,n,a,c,s,u,d,f,m,b,h,p,v,g,y,k,C;return e.regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(M.current){e.n=1;break}return e.a(2);case 1:return e.p=1,r=M.current,(n=r.cloneNode(!0)).style.width="794px",n.style.padding="40px",n.style.position="absolute",n.style.left="-9999px",document.body.appendChild(n),e.n=2,i.default(n,{scale:2,useCORS:!0,logging:!1});case 2:for(a=e.v,document.body.removeChild(n),a.toDataURL("image/png"),c=new o.jsPDF({orientation:"portrait",unit:"mm",format:"a4"}),s=c.internal.pageSize.getWidth(),u=c.internal.pageSize.getHeight(),d=a.height/a.width,f=s*d,m=Math.ceil(f/u),c.setFontSize(16),c.text(l,14,20),b=0;b<m;b++)b>0&&c.addPage(),h=a.height/m,p=b*h,(v=document.createElement("canvas")).width=a.width,v.height=h,(g=v.getContext("2d"))&&(g.drawImage(a,0,p,a.width,h,0,0,a.width,h),y=v.toDataURL("image/png"),k=0===b?30:10,c.addImage(y,"PNG",10,k,s-20,(s-20)*(h/a.width)));c.save("".concat(l.replace(/\s+/g,"-").toLowerCase(),".pdf")),se("PDF exported successfully!","success"),e.n=4;break;case 3:e.p=3,C=e.v,console.error("Error exporting PDF:",C),se("Failed to export PDF","error");case 4:return e.a(2)}},t,null,[[1,3]])}));return function(){return t.apply(this,arguments)}}(),ce=function(){var t=e.asyncToGenerator(e.regenerator().m(function t(){var r,n,o;return e.regenerator().w(function(e){for(;;)switch(e.n){case 0:if(M.current){e.n=1;break}return e.a(2);case 1:return(r=Array.from(M.current.querySelectorAll(".ihub-code-block-toolbar"))).forEach(function(e){return e.hidden=!0}),n=M.current.innerText,r.forEach(function(e){return e.hidden=!1}),e.n=2,m.copyTextToClipboard(n);case 2:o=e.v,se(o?"Content copied to clipboard!":"Failed to copy content",o?"success":"error");case 3:return e.a(2)}},t)}));return function(){return t.apply(this,arguments)}}(),se=function(e,t){X({message:e,type:t}),setTimeout(function(){X(null)},3e3)};return t.jsxs("div",{className:"ihub-content-container ".concat(W?"ihub-fullscreen":""," ").concat(f),children:[A&&t.jsxs("div",{className:"ihub-content-toolbar",children:[!w&&q?t.jsx("button",{onClick:function(){return j(!w)},className:"ihub-toolbar-btn",title:"Edit content",children:t.jsx(g.default,{fontSize:"small"})}):"",t.jsx("button",{onClick:function(){window.print()},className:"ihub-toolbar-btn",title:"Print content",children:t.jsx(h.default,{fontSize:"small"})}),t.jsx("button",{onClick:ae,className:"ihub-toolbar-btn",title:"Export as PDF",children:t.jsx(p.default,{fontSize:"small"})}),t.jsx("button",{onClick:ce,className:"ihub-toolbar-btn",title:"Copy to clipboard",children:t.jsx(v.default,{fontSize:"small"})}),t.jsx("button",{onClick:function(){J(!W)},className:"ihub-toolbar-btn",title:"Toggle fullscreen",children:W?t.jsx(k.default,{fontSize:"small"}):t.jsx(y.default,{fontSize:"small"})})]}),t.jsx("div",{className:"ihub-sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:(null==V?void 0:V.message)||""}),V&&t.jsx("div",{className:"ihub-notification ihub-notification-".concat(V.type),"aria-hidden":"true",children:V.message}),t.jsx("div",{ref:M,className:"ihub-content-viewer ".concat(_?"ihub-markdown-content":""),dangerouslySetInnerHTML:{__html:$}})]})};
|
|
2
2
|
//# sourceMappingURL=ContentViewer.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../_virtual/_rollupPluginBabelHelpers.js"),t="data-ihub-copy",n="ihub-code-block-wrapper",o="ihub-inline-copied",r="ihub-copied",a="ihub-code-line",c="ihub-line-numbers",i='<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><rect x="9" y="9" width="12" height="12" rx="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>',l=/(?:language|lang)-([\w+#.-]+)/i,s=2e3,u=function(e){var t=e.querySelector("code"),n="".concat((null==t?void 0:t.className)||""," ").concat(e.className||"").match(l);return n?n[1].toLowerCase():"code"},d=function(e,n){var o=e.createElement("div");o.className="ihub-code-block-toolbar";var r=e.createElement("span");return r.className="ihub-code-block-lang",r.textContent=n,o.appendChild(r),o.appendChild(function(e,n){var o=e.createElement("button");return o.type="button",o.className="ihub-code-copy-btn",o.setAttribute(t,"block"),o.setAttribute("aria-label","Copy ".concat("code"===n?"":"".concat(n," "),"code to clipboard").replace(/\s+/g," ")),o.innerHTML="".concat(i,'<span class="ihub-code-copy-label">Copy</span>'),o}(e,n)),o},p=function(e){(e.textContent||"").trim()&&!Boolean(e.closest("a"))&&(e.setAttribute(t,"inline"),e.setAttribute("role","button"),e.setAttribute("tabindex","0"),e.setAttribute("title","Click to copy"))},b=function(){var t=e.asyncToGenerator(e.regenerator().m(function t(n){var o,r,a,c;return e.regenerator().w(function(e){for(;;)switch(e.p=e.n){case 0:if(n){e.n=1;break}return e.a(2,!1);case 1:if(e.p=1,!navigator.clipboard||!window.isSecureContext){e.n=3;break}return e.n=2,navigator.clipboard.writeText(n);case 2:return e.a(2,!0);case 3:e.n=5;break;case 4:e.p=4,a=e.v,console.error("Clipboard API copy failed, falling back:",a);case 5:return e.p=5,(o=document.createElement("textarea")).value=n,o.setAttribute("readonly","true"),o.style.position="fixed",o.style.opacity="0",o.style.pointerEvents="none",document.body.appendChild(o),o.select(),r=document.execCommand("copy"),document.body.removeChild(o),e.a(2,r);case 6:return e.p=6,c=e.v,console.error("Failed to copy code to clipboard:",c),e.a(2,!1)}},t,null,[[5,6],[1,4]])}));return function(e){return t.apply(this,arguments)}}();exports.CODE_BLOCK_WRAPPER_CLASS=n,exports.CODE_COPY_ATTR=t,exports.CODE_LINE_CLASS=a,exports.COPIED_CLASS=r,exports.COPIED_FEEDBACK_MS=s,exports.INLINE_COPIED_CLASS=o,exports.LINE_NUMBERS_CLASS=c,exports.copyTextToClipboard=b,exports.detectCodeLanguage=u,exports.enhanceCodeBlocks=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=t.enableBlockCopy,r=void 0===o||o,i=t.enableInlineCopy,l=void 0===i||i,s=t.showLineNumbers,b=void 0===s||s;(r||b)&&e.querySelectorAll("pre").forEach(function(e){b&&function(e){var t=e.querySelector("code")||e;if(!(t.children.length>0)){var n=(t.textContent||"").replace(/\n$/,"").split("\n");if(!(n.length<2)){var o=e.ownerDocument,r=o.createDocumentFragment();n.forEach(function(e,t){var c=o.createElement("span");c.className=a,c.textContent=t===n.length-1?e:"".concat(e,"\n"),r.appendChild(c)}),t.textContent="",t.appendChild(r),e.classList.add(c)}}}(e),r&&function(e){var t=e.parentElement;if(t&&!t.classList.contains(n)){var o=e.ownerDocument,r=u(e),a=o.createElement("div");a.className=n,a.setAttribute("data-language",r),t.insertBefore(a,e),a.appendChild(d(o,r)),a.appendChild(e),e.setAttribute("tabindex","0"),e.setAttribute("role","region"),e.setAttribute("aria-label","code"===r?"Code block":"".concat(r," code block"))}}(e)}),l&&e.querySelectorAll("code:not(pre code)").forEach(function(e){return p(e)})},exports.resolveCodeCopyTarget=function(e){if(!(e instanceof Element))return null;var o=e.closest("[".concat(t,"]"));if(!o)return null;if("block"===o.getAttribute(t)){var r,a=null===(r=o.closest(".".concat(n)))||void 0===r?void 0:r.querySelector("pre");return a?{element:o,text:a.textContent||"",kind:"block"}:null}return{element:o,text:o.textContent||"",kind:"inline"}},exports.showCopiedFeedback=function(e){var t=e.element;return"inline"===e.kind?(t.classList.add(o),setTimeout(function(){t.classList.remove(o)},s)):(t.classList.add(r),t.innerHTML="".concat('<svg viewBox="0 0 24 24" width="14" height="14" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" focusable="false"><path d="M20 6 9 17l-5-5"></path></svg>','<span class="ihub-code-copy-label">Copied!</span>'),setTimeout(function(){t.classList.remove(r),t.innerHTML="".concat(i,'<span class="ihub-code-copy-label">Copy</span>')},s))};
|
|
2
|
+
//# sourceMappingURL=codeCopyEnhancer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeCopyEnhancer.js","sources":["../../../../../src/components/ui/viewer/codeCopyEnhancer.ts"],"sourcesContent":["/**\n * Helpers that upgrade the plain `<pre>` / `<code>` markup rendered by\n * ContentViewer into accessible, click-to-copy code blocks.\n *\n * The markup is injected with `dangerouslySetInnerHTML`, so the copy controls\n * are built as real DOM nodes here and driven through event delegation on the\n * viewer container instead of React event handlers.\n */\n\nexport const CODE_COPY_ATTR = \"data-ihub-copy\";\nexport const CODE_BLOCK_WRAPPER_CLASS = \"ihub-code-block-wrapper\";\nexport const INLINE_COPIED_CLASS = \"ihub-inline-copied\";\nexport const COPIED_CLASS = \"ihub-copied\";\nexport const CODE_LINE_CLASS = \"ihub-code-line\";\nexport const LINE_NUMBERS_CLASS = \"ihub-line-numbers\";\n\n/** Single-line snippets read better without a gutter */\nconst MIN_LINES_FOR_NUMBERING = 2;\n\nconst COPY_ICON = `<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><rect x=\"9\" y=\"9\" width=\"12\" height=\"12\" rx=\"2\"></rect><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"></path></svg>`;\n\nconst CHECK_ICON = `<svg viewBox=\"0 0 24 24\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\" focusable=\"false\"><path d=\"M20 6 9 17l-5-5\"></path></svg>`;\n\nconst LANGUAGE_CLASS_PATTERN = /(?:language|lang)-([\\w+#.-]+)/i;\n\n/** Milliseconds the \"Copied!\" confirmation stays visible */\nexport const COPIED_FEEDBACK_MS = 2000;\n\nexport type CodeCopyKind = \"block\" | \"inline\";\n\nexport interface CodeCopyTarget {\n /** Element that should receive the transient \"copied\" styling */\n element: HTMLElement;\n /** Text that should land on the clipboard */\n text: string;\n kind: CodeCopyKind;\n}\n\ninterface EnhanceOptions {\n /** Add a toolbar with a copy button above every fenced code block */\n enableBlockCopy?: boolean;\n /** Allow single-line `<code>` snippets to be copied on click */\n enableInlineCopy?: boolean;\n /** Draw a line-number gutter on code blocks with more than one line */\n showLineNumbers?: boolean;\n}\n\n/**\n * Read the language of a code block from the `language-*` / `lang-*` class that\n * marked (and most editors) attach to `<pre>` or its inner `<code>`.\n */\nexport const detectCodeLanguage = (pre: Element): string => {\n const code = pre.querySelector(\"code\");\n const source = `${code?.className || \"\"} ${pre.className || \"\"}`;\n const match = source.match(LANGUAGE_CLASS_PATTERN);\n return match ? match[1].toLowerCase() : \"code\";\n};\n\nconst buildCopyButton = (doc: Document, language: string): HTMLButtonElement => {\n const button = doc.createElement(\"button\");\n button.type = \"button\";\n button.className = \"ihub-code-copy-btn\";\n button.setAttribute(CODE_COPY_ATTR, \"block\");\n button.setAttribute(\n \"aria-label\",\n `Copy ${language === \"code\" ? \"\" : `${language} `}code to clipboard`.replace(\n /\\s+/g,\n \" \"\n )\n );\n button.innerHTML = `${COPY_ICON}<span class=\"ihub-code-copy-label\">Copy</span>`;\n return button;\n};\n\nconst buildToolbar = (doc: Document, language: string): HTMLDivElement => {\n const toolbar = doc.createElement(\"div\");\n toolbar.className = \"ihub-code-block-toolbar\";\n\n const label = doc.createElement(\"span\");\n label.className = \"ihub-code-block-lang\";\n label.textContent = language;\n\n toolbar.appendChild(label);\n toolbar.appendChild(buildCopyButton(doc, language));\n return toolbar;\n};\n\nconst wrapCodeBlock = (pre: HTMLElement): void => {\n const parent = pre.parentElement;\n if (!parent || parent.classList.contains(CODE_BLOCK_WRAPPER_CLASS)) return;\n\n const doc = pre.ownerDocument;\n const language = detectCodeLanguage(pre);\n\n const wrapper = doc.createElement(\"div\");\n wrapper.className = CODE_BLOCK_WRAPPER_CLASS;\n wrapper.setAttribute(\"data-language\", language);\n\n parent.insertBefore(wrapper, pre);\n wrapper.appendChild(buildToolbar(doc, language));\n wrapper.appendChild(pre);\n\n // Scrollable regions must be reachable with the keyboard.\n pre.setAttribute(\"tabindex\", \"0\");\n pre.setAttribute(\"role\", \"region\");\n pre.setAttribute(\n \"aria-label\",\n language === \"code\" ? \"Code block\" : `${language} code block`\n );\n};\n\n/**\n * Split a plain-text code block into one span per line so CSS counters can draw\n * a gutter. The numbers live in a `::before` pseudo-element, so they never enter\n * `textContent` (button copy, PDF export) and `user-select: none` keeps them out\n * of manual selections too.\n *\n * Blocks that already contain markup (syntax highlighting, previously enhanced\n * blocks) are left untouched so nothing is destroyed.\n */\nconst applyLineNumbers = (pre: HTMLElement): void => {\n const code = pre.querySelector(\"code\") || pre;\n if (code.children.length > 0) return;\n\n // A trailing newline is an artifact of the fence, not an extra line\n const text = (code.textContent || \"\").replace(/\\n$/, \"\");\n const lines = text.split(\"\\n\");\n if (lines.length < MIN_LINES_FOR_NUMBERING) return;\n\n const doc = pre.ownerDocument;\n const fragment = doc.createDocumentFragment();\n\n lines.forEach((line, index) => {\n const span = doc.createElement(\"span\");\n span.className = CODE_LINE_CLASS;\n // Newlines stay inside the text so textContent still reads as real code\n span.textContent = index === lines.length - 1 ? line : `${line}\\n`;\n fragment.appendChild(span);\n });\n\n code.textContent = \"\";\n code.appendChild(fragment);\n pre.classList.add(LINE_NUMBERS_CLASS);\n};\n\nconst isInsideLink = (element: Element): boolean =>\n Boolean(element.closest(\"a\"));\n\nconst enhanceInlineCode = (code: HTMLElement): void => {\n const text = code.textContent || \"\";\n if (!text.trim() || isInsideLink(code)) return;\n\n code.setAttribute(CODE_COPY_ATTR, \"inline\");\n code.setAttribute(\"role\", \"button\");\n code.setAttribute(\"tabindex\", \"0\");\n code.setAttribute(\"title\", \"Click to copy\");\n};\n\n/**\n * Add copy affordances to every code block and inline snippet inside `root`.\n * Safe to call repeatedly — already-enhanced nodes are skipped.\n */\nexport const enhanceCodeBlocks = (\n root: HTMLElement,\n {\n enableBlockCopy = true,\n enableInlineCopy = true,\n showLineNumbers = true,\n }: EnhanceOptions = {}\n): void => {\n if (enableBlockCopy || showLineNumbers) {\n root.querySelectorAll<HTMLElement>(\"pre\").forEach((pre) => {\n if (showLineNumbers) applyLineNumbers(pre);\n if (enableBlockCopy) wrapCodeBlock(pre);\n });\n }\n\n if (enableInlineCopy) {\n root\n .querySelectorAll<HTMLElement>(\"code:not(pre code)\")\n .forEach((code) => enhanceInlineCode(code));\n }\n};\n\n/**\n * Map a click/keyboard event target onto the code that should be copied.\n * Returns null when the event did not originate from a copy affordance.\n */\nexport const resolveCodeCopyTarget = (\n eventTarget: EventTarget | null\n): CodeCopyTarget | null => {\n if (!(eventTarget instanceof Element)) return null;\n\n const trigger = eventTarget.closest<HTMLElement>(`[${CODE_COPY_ATTR}]`);\n if (!trigger) return null;\n\n if (trigger.getAttribute(CODE_COPY_ATTR) === \"block\") {\n const pre = trigger\n .closest(`.${CODE_BLOCK_WRAPPER_CLASS}`)\n ?.querySelector(\"pre\");\n if (!pre) return null;\n return { element: trigger, text: pre.textContent || \"\", kind: \"block\" };\n }\n\n return { element: trigger, text: trigger.textContent || \"\", kind: \"inline\" };\n};\n\n/**\n * Write text to the clipboard, falling back to a hidden textarea when the\n * async Clipboard API is unavailable (insecure origins, older browsers).\n */\nexport const copyTextToClipboard = async (text: string): Promise<boolean> => {\n if (!text) return false;\n\n try {\n if (navigator.clipboard && window.isSecureContext) {\n await navigator.clipboard.writeText(text);\n return true;\n }\n } catch (error) {\n console.error(\"Clipboard API copy failed, falling back:\", error);\n }\n\n try {\n const textarea = document.createElement(\"textarea\");\n textarea.value = text;\n textarea.setAttribute(\"readonly\", \"true\");\n textarea.style.position = \"fixed\";\n textarea.style.opacity = \"0\";\n textarea.style.pointerEvents = \"none\";\n document.body.appendChild(textarea);\n textarea.select();\n const copied = document.execCommand(\"copy\");\n document.body.removeChild(textarea);\n return copied;\n } catch (error) {\n console.error(\"Failed to copy code to clipboard:\", error);\n return false;\n }\n};\n\n/**\n * Flip a copy button (or inline snippet) into its confirmation state and\n * restore it afterwards. Returns a cleanup timer id.\n */\nexport const showCopiedFeedback = (\n target: CodeCopyTarget\n): ReturnType<typeof setTimeout> => {\n const { element, kind } = target;\n\n if (kind === \"inline\") {\n element.classList.add(INLINE_COPIED_CLASS);\n return setTimeout(() => {\n element.classList.remove(INLINE_COPIED_CLASS);\n }, COPIED_FEEDBACK_MS);\n }\n\n element.classList.add(COPIED_CLASS);\n element.innerHTML = `${CHECK_ICON}<span class=\"ihub-code-copy-label\">Copied!</span>`;\n\n return setTimeout(() => {\n element.classList.remove(COPIED_CLASS);\n element.innerHTML = `${COPY_ICON}<span class=\"ihub-code-copy-label\">Copy</span>`;\n }, COPIED_FEEDBACK_MS);\n};\n"],"names":["CODE_COPY_ATTR","CODE_BLOCK_WRAPPER_CLASS","INLINE_COPIED_CLASS","COPIED_CLASS","CODE_LINE_CLASS","LINE_NUMBERS_CLASS","COPY_ICON","LANGUAGE_CLASS_PATTERN","COPIED_FEEDBACK_MS","detectCodeLanguage","pre","code","querySelector","match","concat","className","toLowerCase","buildToolbar","doc","language","toolbar","createElement","label","textContent","appendChild","button","type","setAttribute","replace","innerHTML","buildCopyButton","enhanceInlineCode","trim","Boolean","closest","copyTextToClipboard","_ref2","_asyncToGenerator","_regenerator","regenerator","m","_callee","text","textarea","copied","_t","_t2","w","_context","p","n","a","navigator","clipboard","window","isSecureContext","writeText","v","console","error","document","value","style","position","opacity","pointerEvents","body","select","execCommand","removeChild","_x","apply","this","arguments","root","_ref","length","undefined","_ref$enableBlockCopy","enableBlockCopy","_ref$enableInlineCopy","enableInlineCopy","_ref$showLineNumbers","showLineNumbers","querySelectorAll","forEach","children","lines","split","ownerDocument","fragment","createDocumentFragment","line","index","span","classList","add","applyLineNumbers","parent","parentElement","contains","wrapper","insertBefore","wrapCodeBlock","eventTarget","Element","trigger","getAttribute","_trigger$closest","element","kind","target","setTimeout","remove"],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
package/dist/src/types/__examples__/.next/types/app/components/auth/username-email-checker/page.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
type SegmentParams<T extends Object = any> = T extends Record<string, any> ? {
|
|
3
|
+
[K in keyof T]: T[K] extends string ? string | string[] | undefined : never;
|
|
4
|
+
} : T;
|
|
5
|
+
export interface PageProps {
|
|
6
|
+
params?: Promise<SegmentParams>;
|
|
7
|
+
searchParams?: Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export interface LayoutProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
params?: Promise<SegmentParams>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|