misaki-studio-internal 0.1.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.
@@ -0,0 +1,556 @@
1
+ import { useLayoutEffect, useRef } from "react";
2
+ import styled from "styled-components";
3
+ import { highlightElement } from "@speed-highlight/core";
4
+ import React from "react";
5
+
6
+ export const Body = styled.div`
7
+ position: relative;
8
+ display: block;
9
+ flex-direction: row;
10
+ user-select: none;
11
+ `;
12
+
13
+ export enum TextSize {
14
+ HEADLINE_1,
15
+ HEADLINE_2,
16
+ HEADLINE_3,
17
+ HEADLINE_4,
18
+ HEADLINE_5,
19
+ HEADLINE_6,
20
+ BODY_1,
21
+ BODY_2,
22
+ }
23
+
24
+ export enum TextStyle {
25
+ BOLD,
26
+ UNDERLINE,
27
+ LINE_THRONG,
28
+ ITALIC,
29
+ }
30
+
31
+ export const emptyBulletSvg = () => (
32
+ <svg
33
+ width="7"
34
+ height="7"
35
+ viewBox="0 0 7 7"
36
+ fill="none"
37
+ xmlns="http://www.w3.org/2000/svg"
38
+ >
39
+ <rect
40
+ x="0.5"
41
+ y="0.5"
42
+ width="6"
43
+ height="6"
44
+ rx="3"
45
+ fill="#000000"
46
+ stroke="black"
47
+ />
48
+ </svg>
49
+ );
50
+
51
+ export const solidBulletSvg = (
52
+ <svg
53
+ width="7"
54
+ height="7"
55
+ viewBox="0 0 7 7"
56
+ fill="none"
57
+ xmlns="http://www.w3.org/2000/svg"
58
+ >
59
+ <rect x="0.5" y="0.5" width="6" height="6" rx="3" stroke="black" />
60
+ </svg>
61
+ );
62
+
63
+ export const Text = styled.div`
64
+ display: flex;
65
+ flex-direction: row;
66
+ gap: 8px;
67
+ justify-content: start;
68
+ padding-left: 10px;
69
+ padding-right: 10px;
70
+ padding-top: 4px;
71
+ padding-bottom: 4px;
72
+ user-select: none;
73
+ white-space: pre-line;
74
+ &.text-${TextSize.HEADLINE_1} {
75
+ --font-size: 96px;
76
+ --line-height: 112px;
77
+ }
78
+ &.text-${TextSize.HEADLINE_2} {
79
+ --font-size: 60px;
80
+ --line-height: 70px;
81
+ }
82
+ &.text-${TextSize.HEADLINE_3} {
83
+ --font-size: 48px;
84
+ --line-height: 56px;
85
+ }
86
+ &.text-${TextSize.HEADLINE_4} {
87
+ --font-size: 34px;
88
+ --line-height: 40px;
89
+ }
90
+ &.text-${TextSize.HEADLINE_5} {
91
+ --font-size: 24px;
92
+ --line-height: 28px;
93
+ }
94
+ &.text-${TextSize.HEADLINE_6} {
95
+ --font-size: 20px;
96
+ --line-height: 23px;
97
+ }
98
+ &.text-${TextSize.BODY_1} {
99
+ --font-size: 14px;
100
+ --line-height: 24px;
101
+ }
102
+ &.text-${TextSize.BODY_2} {
103
+ --font-size: 12px;
104
+ --line-height: 20px;
105
+ }
106
+ font-size: var(--font-size);
107
+ > .bullet {
108
+ display: flex;
109
+ flex-direction: row;
110
+ justify-content: center;
111
+ align-items: center;
112
+ max-height: var(--line-height);
113
+ user-select: none;
114
+ }
115
+ > .content {
116
+ display: inline-block;
117
+ flex-direction: row;
118
+ justify-content: start;
119
+ align-items: center;
120
+ flex: 1;
121
+ font-weight: 400;
122
+ user-select: text;
123
+ min-height: var(--line-height);
124
+ line-height: var(--line-height);
125
+ > span:first-child:empty::before {
126
+ content: " ";
127
+ }
128
+ > span {
129
+ &.S${TextStyle.BOLD} {
130
+ font-weight: bold;
131
+ }
132
+ &.S${TextStyle.ITALIC} {
133
+ font-style: italic;
134
+ }
135
+ &.S${TextStyle.UNDERLINE} {
136
+ text-decoration: underline;
137
+ }
138
+ &.S${TextStyle.LINE_THRONG} {
139
+ text-decoration: line-through;
140
+ }
141
+ &.S${TextStyle.UNDERLINE}.S${TextStyle.LINE_THRONG} {
142
+ text-decoration: underline line-through;
143
+ }
144
+ }
145
+ }
146
+ `;
147
+ export const Image = styled.div`
148
+ display: flex;
149
+ flex-direction: row;
150
+ gap: 8px;
151
+ justify-content: start;
152
+ padding: 2px;
153
+ user-select: none;
154
+ white-space: pre-line;
155
+ width: 100%;
156
+ height: auto;
157
+ justify-content: center;
158
+ align-items: center;
159
+ padding-top: 10px;
160
+ padding-bottom: 10px;
161
+ border-radius: 8px;
162
+ box-sizing: border-box;
163
+ &:hover {
164
+ background-color: transparent;
165
+ }
166
+ > div {
167
+ display: flex;
168
+ width: 100%;
169
+ padding: 4px;
170
+ border-radius: 8px;
171
+ border: 1px solid #ddd;
172
+ background-color: #fcfcfc;
173
+ position: relative;
174
+ > .image {
175
+ width: 100%;
176
+ border-radius: 4px;
177
+ height: auto;
178
+ }
179
+ > .place-holder {
180
+ min-width: 150px;
181
+ min-height: 150px;
182
+ min-width: 100%;
183
+ border-radius: 4px;
184
+ padding: 10px;
185
+ box-sizing: border-box;
186
+ color: #999;
187
+ }
188
+ }
189
+ &.size-2 > div {
190
+ max-width: calc(100% / 2);
191
+ }
192
+ &.size-3 > div {
193
+ max-width: calc(100% / 3);
194
+ }
195
+ &.size-4 > div {
196
+ max-width: calc(100% / 4);
197
+ }
198
+ &.size-5 > div {
199
+ max-width: calc(100% / 5);
200
+ }
201
+ &.align-left {
202
+ justify-content: left;
203
+ }
204
+ &.align-right > div {
205
+ justify-content: right;
206
+ }
207
+ `;
208
+
209
+ export const Separator = styled.div`
210
+ display: flex;
211
+ flex-direction: row;
212
+ gap: 8px;
213
+ justify-content: start;
214
+ padding-left: 10px;
215
+ padding-right: 10px;
216
+ padding-top: 4px;
217
+ padding-bottom: 4px;
218
+ user-select: none;
219
+ white-space: pre-line;
220
+ width: 100%;
221
+ height: 22px;
222
+ justify-content: center;
223
+ align-items: center;
224
+ > .line {
225
+ width: 100%;
226
+ background-color: #eee;
227
+ height: 2px;
228
+ }
229
+ `;
230
+
231
+ const CodeStyle = styled.div`
232
+ display: flex;
233
+ flex-direction: row;
234
+ gap: 8px;
235
+ justify-content: start;
236
+ padding: 2px;
237
+ user-select: none;
238
+ white-space: pre-line;
239
+ width: 100%;
240
+ height: auto;
241
+ justify-content: center;
242
+ align-items: center;
243
+ padding: 10px;
244
+ border-radius: 8px;
245
+ box-sizing: border-box;
246
+ &:hover {
247
+ background-color: transparent;
248
+ }
249
+ > div {
250
+ width: 100%;
251
+ padding: 4px;
252
+ border-radius: 8px;
253
+ border: 1px solid #ddd;
254
+ background-color: #fcfcfc;
255
+ > .iframe {
256
+ min-height: 150px;
257
+ min-width: 100%;
258
+ max-width: 100%;
259
+ border-radius: 4px;
260
+ aspect-ratio: 1.7;
261
+ border: 0px;
262
+ }
263
+ > .place-holder {
264
+ min-width: 100%;
265
+ border-radius: 4px;
266
+ padding: 10px;
267
+ box-sizing: border-box;
268
+ color: #999;
269
+ margin: 0px !important;
270
+ box-shadow: none;
271
+ font-family: monospace;
272
+ font-size: 14px;
273
+ background: transparent;
274
+ user-select: text;
275
+ }
276
+ }
277
+ `;
278
+
279
+ export const Code = ({ code }: { code?: string }) => {
280
+ const ref = useRef<HTMLDivElement>(null);
281
+
282
+ useLayoutEffect(() => {
283
+ const element = ref.current;
284
+ if (element) {
285
+ if (code) {
286
+ highlightElement(element, "js");
287
+ } else {
288
+ element.innerText = "Code is not set.";
289
+ }
290
+ }
291
+ }, [code]);
292
+
293
+ return (
294
+ <CodeStyle>
295
+ <div>
296
+ <link
297
+ rel="stylesheet"
298
+ href={`https://cdn.jsdelivr.net/gh/speed-highlight/core/dist/themes/github-light.css`}
299
+ />
300
+ <div
301
+ ref={ref}
302
+ className="place-holder header shj-lang-js shj-multiline fira"
303
+ >
304
+ {!!code && code}
305
+ </div>
306
+ </div>
307
+ </CodeStyle>
308
+ );
309
+ };
310
+
311
+ export const YoutubeVideo = styled.div`
312
+ display: flex;
313
+ flex-direction: row;
314
+ gap: 8px;
315
+ justify-content: start;
316
+ padding: 2px;
317
+ user-select: none;
318
+ white-space: pre-line;
319
+ width: 100%;
320
+ height: auto;
321
+ justify-content: center;
322
+ align-items: center;
323
+ padding: 10px;
324
+ border-radius: 8px;
325
+ box-sizing: border-box;
326
+ &:hover {
327
+ background-color: transparent;
328
+ }
329
+ > div {
330
+ background-color: #fff;
331
+ width: 100%;
332
+ padding: 4px;
333
+ border-radius: 8px;
334
+ border: 1px solid #000;
335
+ display: flex;
336
+ > .iframe {
337
+ min-height: 150px;
338
+ min-width: 100%;
339
+ max-width: 100%;
340
+ border-radius: 4px;
341
+ aspect-ratio: 1.7;
342
+ border: 0px;
343
+ }
344
+ > .place-holder {
345
+ min-width: 150px;
346
+ min-height: 150px;
347
+ min-width: 100%;
348
+ border-radius: 4px;
349
+ padding: 10px;
350
+ box-sizing: border-box;
351
+ color: #999;
352
+ }
353
+ }
354
+ `;
355
+
356
+ export const DocWrapper = styled.div`
357
+ position: relative;
358
+ display: flex;
359
+ flex-direction: column;
360
+ transition: all 250ms;
361
+ width: 100%;
362
+ min-height: 100%;
363
+ > .tiptap {
364
+ position: relative;
365
+ display: flex;
366
+ transition: all 250ms;
367
+ flex: auto;
368
+ > div {
369
+ position: relative;
370
+ display: block;
371
+ transition: all 250ms;
372
+ flex: auto;
373
+ font-size: 14px;
374
+ color: #32302c;
375
+ caret-color: #000;
376
+ &:first-child > * {
377
+ padding-top: 8px;
378
+ padding-bottom: 8px;
379
+ margin: 0;
380
+ }
381
+ &:first-child > div {
382
+ display: flex;
383
+ flex-direction: row;
384
+ min-height: fit-content;
385
+ }
386
+
387
+ .youtube-wrapper {
388
+ border: 1px solid #ddd;
389
+ padding: 4px;
390
+ border-radius: 8px;
391
+ width: 100%;
392
+ height: auto;
393
+ display: flex;
394
+ &.empty {
395
+ padding: 10px;
396
+ font-size: 12px;
397
+ color: #999;
398
+ }
399
+ &.selected-node {
400
+ border: 1px solid #0094e8;
401
+ }
402
+ > iframe {
403
+ width: 100%;
404
+ aspect-ratio: 1.85/1;
405
+ border-radius: 4px;
406
+ }
407
+ &.selected-node {
408
+ border: 1px solid #333;
409
+ }
410
+ &.size-2 {
411
+ max-width: calc(100% / 2);
412
+ }
413
+ &.size-3 {
414
+ max-width: calc(100% / 3);
415
+ }
416
+ &.size-4 {
417
+ max-width: calc(100% / 4);
418
+ }
419
+ &.size-5 {
420
+ max-width: calc(100% / 5);
421
+ }
422
+ }
423
+
424
+ .image-wrapper {
425
+ border: 1px solid #ddd;
426
+ padding: 4px;
427
+ border-radius: 8px;
428
+ width: 100%;
429
+ height: auto;
430
+ display: flex;
431
+ &.empty {
432
+ padding: 10px;
433
+ font-size: 12px;
434
+ color: #999;
435
+ }
436
+ > img {
437
+ width: 100%;
438
+ border-radius: 4px;
439
+ }
440
+ &.selected-node {
441
+ border: 1px solid#0094E8;
442
+ }
443
+ &.size-2 {
444
+ max-width: calc(100% / 2);
445
+ }
446
+ &.size-3 {
447
+ max-width: calc(100% / 3);
448
+ }
449
+ &.size-4 {
450
+ max-width: calc(100% / 4);
451
+ }
452
+ &.size-5 {
453
+ max-width: calc(100% / 5);
454
+ }
455
+ &.align-left {
456
+ justify-content: left;
457
+ }
458
+ &.align-right > div {
459
+ justify-content: right;
460
+ }
461
+ }
462
+
463
+ h1,
464
+ h2,
465
+ h3,
466
+ h4 {
467
+ display: inline-block;
468
+ padding-top: 20px !important;
469
+ padding-bottom: 8px;
470
+ font-weight: normal;
471
+ }
472
+
473
+ h5,
474
+ h6 {
475
+ display: inline-block;
476
+ padding-top: 8px !important;
477
+ padding-bottom: 8px;
478
+ font-weight: normal;
479
+ }
480
+
481
+ p.is-editor-empty:first-child:before {
482
+ color: #999;
483
+ content: attr(data-placeholder);
484
+ float: left;
485
+ height: 0;
486
+ pointer-events: none;
487
+ }
488
+ p {
489
+ font-size: 15px;
490
+ line-height: 24px;
491
+ padding-top: 2px;
492
+ padding-bottom: 2px;
493
+ margin: 0;
494
+ }
495
+ h1 {
496
+ font-size: 96px;
497
+ }
498
+ h2 {
499
+ font-size: 60px;
500
+ }
501
+ h3 {
502
+ font-size: 48px;
503
+ }
504
+ h4 {
505
+ font-size: 34px;
506
+ }
507
+ h5 {
508
+ font-size: 24px;
509
+ }
510
+ h6 {
511
+ font-size: 24px;
512
+ }
513
+ a {
514
+ font-weight: 500;
515
+ text-decoration: underline;
516
+ cursor: pointer;
517
+ }
518
+ ul {
519
+ padding-left: 16px;
520
+ }
521
+ ul {
522
+ list-style-type: disc;
523
+ ul {
524
+ list-style-type: circle;
525
+ ul {
526
+ list-style-type: square;
527
+ }
528
+ }
529
+ }
530
+ }
531
+ > div > .drag {
532
+ padding-right: 20px;
533
+ > .menu {
534
+ width: 24px;
535
+ height: 24px;
536
+ display: flex;
537
+ flex-direction: row;
538
+ background: #fff;
539
+ border: 1px solid #f0f0f0;
540
+ box-shadow: rgba(0, 0, 0, 0.07) 0px 5px 30px 0px;
541
+ padding: 8px;
542
+ border-radius: 16px;
543
+ gap: 6px;
544
+ }
545
+ }
546
+ }
547
+ .drag-handle {
548
+ width: 20px;
549
+ height: 20px;
550
+ }
551
+ .prosemirror-dropcursor-block {
552
+ background-color: #ddd !important;
553
+ height: 2px !important;
554
+ border-radius: 2px;
555
+ }
556
+ `;
@@ -0,0 +1,41 @@
1
+ const canPush = <T, V extends T>(array: T[], value: V) => {};
2
+
3
+ const canRemove = canPush;
4
+
5
+ const canRemoveAll = canPush;
6
+
7
+ const canPushAt = <T, V extends T>(
8
+ array: T[],
9
+ value: V,
10
+ index: NonNullable<number>,
11
+ ) => {};
12
+
13
+ const canRemoveAt = <T,>(array: T[], index: NonNullable<number>) => {};
14
+
15
+ const canMath = (left: NonNullable<number>, right: NonNullable<number>) => {
16
+ left = right;
17
+ };
18
+
19
+ type ArgumentTypes<F extends Function> = F extends (...args: infer A) => any
20
+ ? A
21
+ : never;
22
+
23
+ const canCall = <CALL extends Function>(
24
+ fn?: CALL,
25
+ ...args: ArgumentTypes<CALL>
26
+ ) => {};
27
+
28
+ const isType = <T,>(value: T) => value;
29
+ const isArrayType = <T,>(value: T[]) => value;
30
+
31
+ export default {
32
+ canPush,
33
+ canRemove,
34
+ canRemoveAll,
35
+ canPushAt,
36
+ canRemoveAt,
37
+ canMath,
38
+ canCall,
39
+ isType,
40
+ isArrayType,
41
+ };
@@ -0,0 +1,45 @@
1
+ .background {
2
+ position: absolute;
3
+ background-color: white;
4
+ border: 1px solid #999;
5
+ width: auto;
6
+ height: auto;
7
+ min-width: min(calc(100% - 120px), 600px);
8
+ min-height: min(calc(100% - 120px), 400px);
9
+ top: var(--top-value, 50%);
10
+ left: var(--left-value, 50%);
11
+ border-radius: 14px;
12
+ box-shadow: 0px 5px 25px rgb(0 0 0 / 7%);
13
+ transition-delay: 150ms;
14
+ transition: all 300ms;
15
+ transform: var(
16
+ --transform-value,
17
+ translateX(-50%) translateY(-50%) scale(0.9)
18
+ );
19
+ opacity: var(--opacity-value, 0);
20
+ }
21
+
22
+ .popup-element {
23
+ position: absolute;
24
+ background-color: white;
25
+ border: 1px solid #ddd;
26
+ width: auto;
27
+ height: auto;
28
+ border-radius: 8px;
29
+ box-shadow: 0px 5px 25px rgb(0 0 0 / 7%);
30
+ opacity: 0;
31
+ padding: 8px;
32
+ z-index: 100000;
33
+ box-sizing: border-box;
34
+ &:empty {
35
+ opacity: 0;
36
+ }
37
+ }
38
+
39
+ .root {
40
+ position: absolute;
41
+ width: 100%;
42
+ height: 100%;
43
+ transition: background-color 150ms;
44
+ background-color: var(--background-color, rgba(0, 0, 0, 0.4));
45
+ }