doccupine 0.0.147 → 0.0.148

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.
@@ -1,695 +0,0 @@
1
- import { CHAT_WIDTH } from "../app/theme.js";
2
- export const chatStylesTemplate = `import styled, { css, keyframes } from "styled-components";
3
- import { Button } from "cherry-styled-components";
4
- import Link from "next/link";
5
- import { mq, Theme } from "@/app/theme";
6
- import {
7
- styledAnchor,
8
- styledTable,
9
- stylesLists,
10
- StyledSmallButton,
11
- interactiveStyles,
12
- thinScrollbar,
13
- } from "@/components/layout/SharedStyled";
14
-
15
- const styledText = css<{ theme: Theme }>\`
16
- font-size: \${({ theme }) => theme.fontSizes.text.xs};
17
- line-height: \${({ theme }) => theme.lineHeights.text.xs};
18
-
19
- \${mq("lg")} {
20
- font-size: \${({ theme }) => theme.fontSizes.small.lg};
21
- line-height: \${({ theme }) => theme.lineHeights.small.lg};
22
- }
23
- \`;
24
-
25
- export const StyledChatSurface = styled.div<{ $isVisible: boolean }>\`
26
- position: fixed;
27
- inset: 0;
28
- z-index: 1000;
29
- pointer-events: none;
30
-
31
- & > * {
32
- pointer-events: auto;
33
- }
34
-
35
- \${({ $isVisible }) =>
36
- !$isVisible &&
37
- css\`
38
- visibility: hidden;
39
-
40
- & > * {
41
- pointer-events: none;
42
- }
43
- \`}
44
- \`;
45
-
46
- export const StyledChat = styled.div<{ theme: Theme; $isVisible: boolean }>\`
47
- margin: 0;
48
- position: fixed;
49
- top: 0;
50
- right: 0;
51
- width: 100%;
52
- height: calc(100dvh - 90px);
53
- overflow-y: scroll;
54
- overflow-x: hidden;
55
- z-index: 1000;
56
- padding: 0 20px;
57
- /* See StyledChatForm: visibility snaps open and is delayed on close, so the
58
- panel is focusable as soon as it opens. */
59
- transition:
60
- transform 0.3s ease,
61
- opacity 0.3s ease,
62
- visibility 0s linear 0s;
63
- transform: translateX(0);
64
- background: \${({ theme }) => theme.colors.light};
65
- -webkit-overflow-scrolling: touch;
66
- opacity: 1;
67
- visibility: visible;
68
-
69
- &::-webkit-scrollbar {
70
- display: none;
71
- }
72
-
73
- \${({ $isVisible }) =>
74
- !$isVisible &&
75
- css\`
76
- transform: translateX(100%);
77
- opacity: 0;
78
- visibility: hidden;
79
- transition-delay: 0s, 0s, 0.3s;
80
- \`}
81
-
82
- @media (prefers-reduced-motion: reduce) {
83
- transition: none;
84
- }
85
-
86
- \${mq("lg")} {
87
- width: ${CHAT_WIDTH}px;
88
- border-left: solid 1px \${({ theme }) => theme.colors.grayLight};
89
- }
90
- \`;
91
-
92
- const loadingAnimation = keyframes\`
93
- 0% {
94
- transform: rotate(0deg);
95
- }
96
- 100% {
97
- transform: rotate(360deg);
98
- }
99
- \`;
100
-
101
- const rotateGradient = keyframes\`
102
- 0% {
103
- --gradient-angle: 0deg;
104
- }
105
- 100% {
106
- --gradient-angle: 360deg;
107
- }
108
- \`;
109
-
110
- const pulseGlow = keyframes\`
111
- 0%, 100% {
112
- opacity: 0.5;
113
- filter: blur(16px);
114
- }
115
- 50% {
116
- opacity: 1;
117
- filter: blur(22px);
118
- }
119
- \`;
120
-
121
- const sparkleFloat = keyframes\`
122
- 0%, 100% {
123
- opacity: 0;
124
- transform: translateY(0) scale(0);
125
- }
126
- 50% {
127
- opacity: 0.9;
128
- transform: translateY(-20px) scale(1);
129
- }
130
- \`;
131
-
132
- const shimmer = keyframes\`
133
- 0% {
134
- background-position: 0% center;
135
- }
136
- 50% {
137
- background-position: 100% center;
138
- }
139
- 100% {
140
- background-position: 0% center;
141
- }
142
- \`;
143
-
144
- export const StyledRainbowInputWrapper = styled.div<{
145
- theme: Theme;
146
- $isActive: boolean;
147
- }>\`
148
- @property --gradient-angle {
149
- syntax: "<angle>";
150
- initial-value: 0deg;
151
- inherits: false;
152
- }
153
-
154
- position: relative;
155
- flex: 1;
156
-
157
- &::before {
158
- content: "";
159
- position: absolute;
160
- inset: -2px;
161
- border-radius: 14px;
162
- background: conic-gradient(
163
- from var(--gradient-angle),
164
- #cc5555,
165
- #d9a745,
166
- #3ab0cc,
167
- #cc7fc2,
168
- #4380cc,
169
- #4c1fa3,
170
- #cc5555
171
- );
172
- opacity: 0;
173
- transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
174
- animation: \${rotateGradient} 3s linear infinite;
175
- z-index: 0;
176
- }
177
-
178
- &::after {
179
- content: "";
180
- position: absolute;
181
- inset: -10px;
182
- border-radius: 20px;
183
- background: conic-gradient(
184
- from var(--gradient-angle),
185
- #ff6b6b66,
186
- #feca5766,
187
- #48dbfb66,
188
- #ff9ff366,
189
- #54a0ff66,
190
- #5f27cd66,
191
- #ff6b6b66
192
- );
193
- opacity: 0;
194
- transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
195
- animation:
196
- \${rotateGradient} 3s linear infinite,
197
- \${pulseGlow} 2s ease-in-out infinite;
198
- z-index: -1;
199
- pointer-events: none;
200
- }
201
-
202
- &:hover::before,
203
- &:focus-within::before {
204
- opacity: 1;
205
- }
206
-
207
- &:hover::after,
208
- &:focus-within::after {
209
- opacity: 1;
210
- }
211
-
212
- \${({ $isActive }) =>
213
- $isActive &&
214
- css\`
215
- &::before {
216
- opacity: 1;
217
- }
218
- &::after {
219
- opacity: 1;
220
- }
221
- \`}
222
- \`;
223
-
224
- export const StyledSparkleContainer = styled.div<{ $isActive: boolean }>\`
225
- position: absolute;
226
- inset: -30px;
227
- pointer-events: none;
228
- overflow: hidden;
229
- border-radius: 30px;
230
- z-index: -2;
231
- opacity: 0;
232
- transition: opacity 0.4s ease;
233
-
234
- \${({ $isActive }) =>
235
- $isActive &&
236
- css\`
237
- opacity: 1;
238
- \`}
239
- \`;
240
-
241
- export const StyledSparkle = styled.div<{
242
- $color: string;
243
- $left: number;
244
- $top: number;
245
- $delay: number;
246
- }>\`
247
- position: absolute;
248
- width: 4px;
249
- height: 4px;
250
- border-radius: 50%;
251
- background: \${({ $color }) => $color};
252
- box-shadow: 0 0 6px \${({ $color }) => $color};
253
- left: \${({ $left }) => $left}%;
254
- top: \${({ $top }) => $top}%;
255
- animation: \${sparkleFloat} 2s ease-in-out infinite;
256
- animation-delay: \${({ $delay }) => $delay}s;
257
- \`;
258
-
259
- export const StyledRainbowInput = styled.input<{ theme: Theme }>\`
260
- position: relative;
261
- z-index: 1;
262
- width: 100%;
263
- background: \${({ theme }) => theme.colors.light};
264
- border: 1px solid \${({ theme }) => theme.colors.grayLight};
265
- border-radius: 12px;
266
- padding: 12px 18px;
267
- font-size: \${({ theme }) => theme.fontSizes.text.lg};
268
- font-family: inherit;
269
- color: \${({ theme }) => theme.colors.dark};
270
- outline: none;
271
- transition:
272
- border-color 0.3s ease,
273
- box-shadow 0.3s ease;
274
-
275
- \${mq("lg")} {
276
- font-size: \${({ theme }) => theme.fontSizes.small.lg};
277
- }
278
-
279
- &::placeholder {
280
- color: \${({ theme }) =>
281
- \`color-mix(in srgb, \${theme.colors.dark} 40%, transparent)\`};
282
- transition: color 0.3s ease;
283
- }
284
-
285
- &:focus::placeholder {
286
- color: \${({ theme }) =>
287
- \`color-mix(in srgb, \${theme.colors.dark} 60%, transparent)\`};
288
- }
289
-
290
- &:focus {
291
- border-color: transparent;
292
- }
293
- \`;
294
-
295
- export const StyledRainbowButton = styled(Button)<{
296
- theme: Theme;
297
- $hasContent: boolean;
298
- }>\`
299
- padding-top: 10px;
300
- padding-bottom: 10px;
301
- position: relative;
302
- overflow: hidden;
303
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
304
- color: \${({ theme }) => theme.colors.surface};
305
-
306
- &::before {
307
- content: "";
308
- position: absolute;
309
- inset: 0;
310
- background: linear-gradient(
311
- 135deg,
312
- #ff6b6b,
313
- #feca57,
314
- #48dbfb,
315
- #ff9ff3,
316
- #54a0ff
317
- );
318
- background-size: 300% 300%;
319
- opacity: 0;
320
- transition: opacity 0.3s ease;
321
- z-index: 0;
322
- animation: \${shimmer} 3s linear infinite;
323
- width: 200%;
324
- }
325
-
326
- \${({ $hasContent }) =>
327
- $hasContent &&
328
- css\`
329
- &::before {
330
- opacity: 1;
331
- }
332
- \`}
333
-
334
- &:hover::before {
335
- opacity: 1;
336
- }
337
-
338
- &:hover {
339
- transform: scale(1.05);
340
- }
341
-
342
- &:active {
343
- transform: scale(0.95);
344
- }
345
-
346
- & svg {
347
- position: relative;
348
- z-index: 1;
349
- transition: transform 0.3s ease;
350
- }
351
-
352
- &:disabled,
353
- &:disabled:hover {
354
- background: \${({ theme }) => theme.colors.primaryDark};
355
- transform: none;
356
- box-shadow: none;
357
-
358
- &::before {
359
- opacity: 0;
360
- }
361
- }
362
- \`;
363
-
364
- export const StyledChatForm = styled.form<{
365
- theme: Theme;
366
- $isVisible: boolean;
367
- }>\`
368
- display: flex;
369
- gap: 10px;
370
- justify-content: center;
371
- align-items: center;
372
- background: \${({ theme }) => theme.colors.light};
373
- padding: 20px;
374
- position: fixed;
375
- bottom: 0;
376
- right: 0;
377
- z-index: 1000;
378
- width: 100%;
379
- border-top: solid 1px \${({ theme }) => theme.colors.grayLight};
380
- /* visibility is animatable, so transitioning "all" keeps this hidden for the
381
- whole slide-in - long enough for the focus() that follows opening to be a
382
- silent no-op. Snap it on open (transition-delay below) and delay it on
383
- close so the slide-out stays visible while it animates. */
384
- transition:
385
- transform 0.3s ease,
386
- opacity 0.3s ease,
387
- visibility 0s linear 0.3s;
388
- transform: translateX(100%);
389
- opacity: 0;
390
- visibility: hidden;
391
-
392
- \${mq("lg")} {
393
- width: ${CHAT_WIDTH}px;
394
- border-left: solid 1px \${({ theme }) => theme.colors.grayLight};
395
- }
396
-
397
- \${({ $isVisible }) =>
398
- $isVisible &&
399
- css\`
400
- opacity: 1;
401
- transform: translateX(0);
402
- visibility: visible;
403
- transition-delay: 0s;
404
- \`}
405
-
406
- @media (prefers-reduced-motion: reduce) {
407
- transition: none;
408
- }
409
-
410
- & .loading {
411
- animation: \${loadingAnimation} 1s linear infinite;
412
- }
413
- \`;
414
-
415
- export const StyledGlowSmallButton = styled(StyledSmallButton)<{
416
- theme: Theme;
417
- $hasContent: boolean;
418
- }>\`
419
- @property --gradient-angle {
420
- syntax: "<angle>";
421
- initial-value: 0deg;
422
- inherits: false;
423
- }
424
-
425
- position: relative;
426
- isolation: isolate;
427
- margin-right: 0;
428
- background: \${({ theme }) => theme.colors.light};
429
- padding: 0;
430
-
431
- &::before {
432
- content: "";
433
- inset: -2px;
434
- border-radius: 8px;
435
- background: conic-gradient(
436
- from var(--gradient-angle),
437
- #cc5555,
438
- #d9a745,
439
- #3ab0cc,
440
- #cc7fc2,
441
- #4380cc,
442
- #4c1fa3,
443
- #cc5555
444
- );
445
- opacity: 0;
446
- transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
447
- animation: \${rotateGradient} 3s linear infinite;
448
- z-index: -1;
449
- position: absolute;
450
- top: -2px;
451
- left: -2px;
452
- width: calc(100% + 4px);
453
- height: calc(100% + 4px);
454
- }
455
-
456
- &::after {
457
- content: "";
458
- position: absolute;
459
- inset: -8px;
460
- border-radius: 14px;
461
- background: conic-gradient(
462
- from var(--gradient-angle),
463
- #ff6b6b66,
464
- #feca5766,
465
- #48dbfb66,
466
- #ff9ff366,
467
- #54a0ff66,
468
- #5f27cd66,
469
- #ff6b6b66
470
- );
471
- opacity: 0;
472
- transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
473
- animation:
474
- \${rotateGradient} 3s linear infinite,
475
- \${pulseGlow} 2s ease-in-out infinite;
476
- z-index: -2;
477
- pointer-events: none;
478
- }
479
-
480
- &:hover::before,
481
- &:hover::after {
482
- opacity: 1;
483
- }
484
-
485
- & span {
486
- padding: 6px 8px;
487
- display: flex;
488
- background: \${({ theme }) => theme.colors.light};
489
- border-radius: \${({ theme }) => theme.spacing.radius.xs};
490
- gap: 6px;
491
- }
492
-
493
- \${({ $hasContent }) =>
494
- $hasContent &&
495
- css\`
496
- &::before {
497
- opacity: 1;
498
- }
499
- &::after {
500
- opacity: 1;
501
- }
502
- \`}
503
- \`;
504
-
505
- export const StyledError = styled.div\`
506
- margin: 20px 0;
507
- width: 100%;
508
- \`;
509
-
510
- const loadingDotAnimation = keyframes\`
511
- 0% {
512
- opacity: 0;
513
- }
514
- 50% {
515
- opacity: 1;
516
- }
517
- 100% {
518
- opacity: 0;
519
- }
520
- \`;
521
-
522
- export const StyledLoading = styled.div<{ theme: Theme }>\`
523
- overflow-x: auto;
524
- \${thinScrollbar};
525
- margin: 20px 0;
526
- width: 100%;
527
- font-weight: 600;
528
- \${styledText};
529
- color: \${({ theme }) => theme.colors.dark};
530
-
531
- & span {
532
- &:nth-child(1) {
533
- animation: \${loadingDotAnimation} 1s ease infinite;
534
- }
535
- &:nth-child(2) {
536
- animation: \${loadingDotAnimation} 1s ease infinite;
537
- animation-delay: 0.2s;
538
- }
539
- &:nth-child(3) {
540
- animation: \${loadingDotAnimation} 1s ease infinite;
541
- animation-delay: 0.4s;
542
- }
543
- }
544
- \`;
545
-
546
- export const StyledAnswer = styled.div<{ theme: Theme; $isAnswer: boolean }>\`
547
- overflow-x: auto;
548
- \${thinScrollbar};
549
- background: \${({ theme }) => theme.colors.primary};
550
- color: \${({ theme }) => theme.colors.surface};
551
- padding: 9px 14px;
552
- border-radius: 16px 16px 4px 16px;
553
- margin: 20px 0 20px auto;
554
- width: fit-content;
555
- max-width: min(560px, 88%);
556
- font-weight: 500;
557
- white-space: pre-wrap;
558
- overflow-wrap: anywhere;
559
- \${styledText};
560
-
561
- & p {
562
- \${styledText};
563
- }
564
-
565
- \${({ $isAnswer }) =>
566
- $isAnswer &&
567
- css\`
568
- background: transparent;
569
- color: \${({ theme }) => theme.colors.dark};
570
- padding: 0;
571
- width: 100%;
572
- max-width: 100%;
573
- margin: 20px 0;
574
- border-radius: 0;
575
- font-weight: inherit;
576
- white-space: normal;
577
- \`}
578
-
579
- & code:not([class]) {
580
- background: \${({ theme }) =>
581
- \`color-mix(in srgb, \${theme.colors.primaryLight} 20%, transparent)\`};
582
- color: \${({ theme }) => theme.colors.dark};
583
- padding: 2px 4px;
584
- border-radius: \${({ theme }) => theme.spacing.radius.xs};
585
- white-space: pre;
586
- }
587
-
588
- \${styledAnchor};
589
- \${stylesLists};
590
- \${styledTable};
591
-
592
- & pre,
593
- & .hljs {
594
- margin: 10px 0;
595
- }
596
-
597
- & .code-wrapper pre {
598
- margin: 0;
599
- \${styledText};
600
- }
601
-
602
- & > *:first-child {
603
- margin-top: 0;
604
- }
605
-
606
- & > *:last-child {
607
- margin-bottom: 0;
608
-
609
- & > *:last-child {
610
- margin-bottom: 0;
611
- }
612
- }
613
-
614
- & ul,
615
- & ol {
616
- & li {
617
- \${styledText};
618
- }
619
- }
620
-
621
- & img,
622
- & video,
623
- & iframe {
624
- max-width: 100%;
625
- border-radius: \${({ theme }) => theme.spacing.radius.lg};
626
- margin: 10px 0;
627
- display: block;
628
- }
629
-
630
- & h1,
631
- & h2,
632
- & h3,
633
- & h4,
634
- & h5,
635
- & h6 {
636
- margin: 10px 0;
637
- padding: 0;
638
- }
639
- \`;
640
-
641
- export const StyledSources = styled.div\`
642
- display: flex;
643
- gap: 16px;
644
- flex-wrap: wrap;
645
- margin: -5px 0 20px;
646
- \`;
647
-
648
- export const StyledSourceLink = styled(Link)<{ theme: Theme }>\`
649
- position: relative;
650
- text-decoration: none;
651
- font-size: \${({ theme }) => theme.fontSizes.small.lg};
652
- line-height: 1;
653
- color: \${({ theme }) => theme.colors.primary};
654
- display: flex;
655
- gap: 6px;
656
- transition: all 0.3s ease;
657
- font-weight: 600;
658
- white-space: nowrap;
659
- min-width: fit-content;
660
- background: \${({ theme }) =>
661
- \`color-mix(in srgb, \${theme.colors.primaryLight} 10%, transparent)\`};
662
- padding: 6px 8px;
663
- border-radius: \${({ theme }) => theme.spacing.radius.xs};
664
- \${interactiveStyles};
665
-
666
- & * {
667
- margin: auto 0;
668
- }
669
-
670
- &:hover {
671
- color: \${({ theme }) => theme.colors.accent};
672
- }
673
- \`;
674
-
675
- export const StyledChatTitle = styled.div<{ theme: Theme }>\`
676
- display: flex;
677
- flex-wrap: nowrap;
678
- justify-content: space-between;
679
- position: sticky;
680
- margin: 0 -20px;
681
- padding: 16px 20px;
682
- height: 62px;
683
- top: 0;
684
- background: \${({ theme }) => theme.colors.light};
685
- border-bottom: solid 1px \${({ theme }) => theme.colors.grayLight};
686
- z-index: 1000;
687
- \`;
688
-
689
- export const StyledChatTitleIconWrapper = styled.span<{ theme: Theme }>\`
690
- display: flex;
691
- align-items: center;
692
- gap: 12px;
693
- color: \${({ theme }) => theme.colors.dark};
694
- \`;
695
- `;