@rtif-sdk/web 1.4.0 → 1.6.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 (50) hide show
  1. package/dist/block-drag-handler.d.ts +26 -0
  2. package/dist/block-drag-handler.d.ts.map +1 -1
  3. package/dist/block-drag-handler.js +33 -23
  4. package/dist/block-drag-handler.js.map +1 -1
  5. package/dist/block-gutter.d.ts +81 -0
  6. package/dist/block-gutter.d.ts.map +1 -0
  7. package/dist/block-gutter.js +331 -0
  8. package/dist/block-gutter.js.map +1 -0
  9. package/dist/context-menu.d.ts +54 -0
  10. package/dist/context-menu.d.ts.map +1 -0
  11. package/dist/context-menu.js +470 -0
  12. package/dist/context-menu.js.map +1 -0
  13. package/dist/drop-indicator.d.ts.map +1 -1
  14. package/dist/drop-indicator.js +8 -34
  15. package/dist/drop-indicator.js.map +1 -1
  16. package/dist/editor.d.ts +1 -1
  17. package/dist/editor.d.ts.map +1 -1
  18. package/dist/editor.js +153 -12
  19. package/dist/editor.js.map +1 -1
  20. package/dist/floating-toolbar.d.ts.map +1 -1
  21. package/dist/floating-toolbar.js +4 -7
  22. package/dist/floating-toolbar.js.map +1 -1
  23. package/dist/index.d.ts +4 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +6 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/link-popover.d.ts.map +1 -1
  28. package/dist/link-popover.js +2 -43
  29. package/dist/link-popover.js.map +1 -1
  30. package/dist/renderer.d.ts.map +1 -1
  31. package/dist/renderer.js +27 -5
  32. package/dist/renderer.js.map +1 -1
  33. package/dist/selection-sync.d.ts.map +1 -1
  34. package/dist/selection-sync.js +20 -3
  35. package/dist/selection-sync.js.map +1 -1
  36. package/dist/types.d.ts +208 -1
  37. package/dist/types.d.ts.map +1 -1
  38. package/package.json +8 -4
  39. package/styles/all.css +21 -0
  40. package/styles/base.css +33 -0
  41. package/styles/block-gutter.css +76 -0
  42. package/styles/blocks.css +199 -0
  43. package/styles/context-menu.css +58 -0
  44. package/styles/drop-indicator.css +37 -0
  45. package/styles/floating-toolbar.css +51 -0
  46. package/styles/link-popover.css +64 -0
  47. package/styles/marks.css +27 -0
  48. package/styles/mention.css +17 -0
  49. package/styles/pickers.css +317 -0
  50. package/styles/toolbar.css +151 -0
@@ -0,0 +1,33 @@
1
+ /* --------------------------------------------------------
2
+ * RTIF Base Styles
3
+ *
4
+ * CSS custom properties for theming, scoped to .rtif-editor.
5
+ * Uses :where() for 0 specificity — easy to override.
6
+ * -------------------------------------------------------- */
7
+
8
+ :where(.rtif-editor) {
9
+ --rtif-accent-color: #2563eb;
10
+ --rtif-surface: #fff;
11
+ --rtif-border: #ccc;
12
+ --rtif-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
13
+ --rtif-radius: 6px;
14
+ --rtif-radius-sm: 4px;
15
+ --rtif-ui-font: system-ui, -apple-system, sans-serif;
16
+ --rtif-ui-font-size: 14px;
17
+ --rtif-z-gutter: 5;
18
+ --rtif-z-drop-line: 10;
19
+ --rtif-z-drop-overlay: 20;
20
+ --rtif-z-popover: 9999;
21
+ }
22
+
23
+ /* Utility: hide elements via class toggle instead of inline display */
24
+ .rtif-hidden {
25
+ display: none !important;
26
+ }
27
+
28
+ /* Placeholder text for empty editor */
29
+ [data-empty]::before {
30
+ content: attr(data-placeholder);
31
+ color: #aaa;
32
+ pointer-events: none;
33
+ }
@@ -0,0 +1,76 @@
1
+ /* --------------------------------------------------------
2
+ * RTIF Block Gutter & Drag Handle Styles
3
+ *
4
+ * Notion-style hover toolbar to the left of blocks.
5
+ * Position (top, height) set by JS. Left offset defined
6
+ * here as a CSS property for easy override.
7
+ * -------------------------------------------------------- */
8
+
9
+ .rtif-block-gutter {
10
+ position: absolute;
11
+ left: -48px;
12
+ display: flex;
13
+ align-items: center;
14
+ gap: 2px;
15
+ z-index: var(--rtif-z-gutter, 5);
16
+ user-select: none;
17
+ }
18
+
19
+ .rtif-gutter-add {
20
+ width: 20px;
21
+ height: 20px;
22
+ border: none;
23
+ background: transparent;
24
+ cursor: pointer;
25
+ border-radius: var(--rtif-radius-sm, 4px);
26
+ font-size: 16px;
27
+ line-height: 1;
28
+ color: currentColor;
29
+ opacity: 0.4;
30
+ padding: 0;
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: center;
34
+ }
35
+
36
+ .rtif-gutter-add:hover {
37
+ opacity: 0.7;
38
+ background: rgba(0, 0, 0, 0.04);
39
+ }
40
+
41
+ /* Drag handle — shared visual styles for gutter and standalone contexts */
42
+ .rtif-drag-handle {
43
+ width: 20px;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ cursor: grab;
48
+ opacity: 0.4;
49
+ user-select: none;
50
+ font-size: 14px;
51
+ line-height: 1;
52
+ color: currentColor;
53
+ border: none;
54
+ background: transparent;
55
+ padding: 0;
56
+ }
57
+
58
+ /* Standalone drag handle (outside gutter) — positioned absolutely */
59
+ .rtif-drag-handle:not(.rtif-block-gutter .rtif-drag-handle) {
60
+ position: absolute;
61
+ z-index: var(--rtif-z-gutter, 5);
62
+ }
63
+
64
+ /* Drag handle inside gutter — inherits gutter's positioning, add height */
65
+ .rtif-block-gutter .rtif-drag-handle {
66
+ height: 20px;
67
+ }
68
+
69
+ .rtif-drag-handle:hover {
70
+ opacity: 0.7;
71
+ }
72
+
73
+ /* Block being dragged */
74
+ .rtif-block-dragging {
75
+ opacity: 0.5;
76
+ }
@@ -0,0 +1,199 @@
1
+ /* --------------------------------------------------------
2
+ * RTIF Block Type Styles
3
+ *
4
+ * Classes applied by block renderers in block-renderer.ts.
5
+ * Block attrs (align, indent) use inline styles for dynamic
6
+ * values — not covered here.
7
+ * -------------------------------------------------------- */
8
+
9
+ /* ---- Headings ---- */
10
+ .rtif-heading {
11
+ font-weight: 700;
12
+ line-height: 1.3;
13
+ margin-top: 0.5em;
14
+ }
15
+
16
+ .rtif-h1 { font-size: 1.75em; }
17
+ .rtif-h2 { font-size: 1.375em; }
18
+ .rtif-h3 { font-size: 1.125em; }
19
+ .rtif-h4 { font-size: 1em; }
20
+ .rtif-h5 { font-size: 0.875em; }
21
+ .rtif-h6 { font-size: 0.75em; }
22
+
23
+ /* ---- Lists ---- */
24
+ [data-block-type="list-item"] {
25
+ padding-left: 1.5em;
26
+ position: relative;
27
+ }
28
+
29
+ [data-block-type="list-item"][data-list-style="bullet"]::before {
30
+ content: '\2022'; /* bullet */
31
+ position: absolute;
32
+ left: 0.25em;
33
+ color: #888;
34
+ }
35
+
36
+ [data-block-type="list-item"][data-list-style="ordered"] {
37
+ counter-increment: rtif-list;
38
+ }
39
+
40
+ [data-block-type="list-item"][data-list-style="ordered"]::before {
41
+ content: counter(rtif-list) '.';
42
+ position: absolute;
43
+ left: 0;
44
+ color: #888;
45
+ font-size: 0.875em;
46
+ }
47
+
48
+ /* Reset counter when a non-list block appears */
49
+ [data-block-type="text"],
50
+ .rtif-heading,
51
+ .rtif-blockquote,
52
+ .rtif-code-block {
53
+ counter-reset: rtif-list;
54
+ }
55
+
56
+ /* Nested list indentation */
57
+ [data-list-depth="1"] { padding-left: 3em; }
58
+ [data-list-depth="2"] { padding-left: 4.5em; }
59
+ [data-list-depth="3"] { padding-left: 6em; }
60
+ [data-list-depth="4"] { padding-left: 7.5em; }
61
+ [data-list-depth="5"] { padding-left: 9em; }
62
+
63
+ /* ---- Blockquote ---- */
64
+ .rtif-blockquote {
65
+ border-left: 3px solid #d0d0d0;
66
+ padding-left: 1em;
67
+ color: #555;
68
+ font-style: italic;
69
+ }
70
+
71
+ /* ---- Code block ---- */
72
+ .rtif-code-block {
73
+ font-family: 'SF Mono', Menlo, Consolas, monospace;
74
+ font-size: 0.875rem;
75
+ background: #1e1e2e;
76
+ color: #cdd6f4;
77
+ padding: 1em 1.25em;
78
+ border-radius: 6px;
79
+ line-height: 1.5;
80
+ white-space: pre-wrap;
81
+ }
82
+
83
+ /* ---- Horizontal rule ---- */
84
+ [data-block-type="hr"] {
85
+ border: none;
86
+ border-top: 1px solid #ddd;
87
+ margin: 0.75em 0;
88
+ min-height: 1px;
89
+ }
90
+
91
+ /* ---- Callout ---- */
92
+ .rtif-callout {
93
+ padding: 0.75em 1em;
94
+ border-radius: 6px;
95
+ border-left: 4px solid;
96
+ margin: 0.5em 0;
97
+ }
98
+
99
+ .rtif-callout[data-variant="info"] { background: #e8f4fd; border-color: #3b82f6; }
100
+ .rtif-callout[data-variant="warning"] { background: #fef3cd; border-color: #f59e0b; }
101
+ .rtif-callout[data-variant="error"] { background: #fee2e2; border-color: #ef4444; }
102
+ .rtif-callout[data-variant="success"] { background: #d1fae5; border-color: #10b981; }
103
+ .rtif-callout[data-variant="note"] { background: #f3f4f6; border-color: #6b7280; }
104
+
105
+ .rtif-callout-icon {
106
+ margin-right: 0.5em;
107
+ }
108
+
109
+ /* ---- Image block ---- */
110
+ [data-block-type="image"] {
111
+ text-align: center;
112
+ padding: 0.5em 0;
113
+ margin: 0.5em 0;
114
+ }
115
+
116
+ [data-block-type="image"] img {
117
+ max-width: 100%;
118
+ max-height: 500px;
119
+ border-radius: 6px;
120
+ object-fit: contain;
121
+ }
122
+
123
+ /* Upload in progress (data URL src) */
124
+ [data-block-type="image"] img[src^="data:"] {
125
+ opacity: 0.7;
126
+ outline: 2px dashed #3b82f6;
127
+ outline-offset: 4px;
128
+ }
129
+
130
+ /* ---- Embed block ---- */
131
+ [data-block-type="embed"] {
132
+ margin: 0.5em 0;
133
+ border-radius: 6px;
134
+ overflow: hidden;
135
+ }
136
+
137
+ /* Video embeds (YouTube, Vimeo) — 16:9 responsive */
138
+ .rtif-embed-video {
139
+ position: relative;
140
+ padding-bottom: 56.25%;
141
+ height: 0;
142
+ overflow: hidden;
143
+ background: #000;
144
+ border-radius: 6px;
145
+ }
146
+
147
+ .rtif-embed-video .rtif-embed-iframe {
148
+ position: absolute;
149
+ top: 0;
150
+ left: 0;
151
+ width: 100%;
152
+ height: 100%;
153
+ border: none;
154
+ }
155
+
156
+ /* Twitter/X embeds */
157
+ .rtif-embed-tweet {
158
+ padding: 1em;
159
+ background: #f9fafb;
160
+ border: 1px solid #e0e0e0;
161
+ border-radius: 6px;
162
+ }
163
+
164
+ .rtif-embed-tweet-quote {
165
+ margin: 0;
166
+ padding: 0.75em 1em;
167
+ border-left: 3px solid #1da1f2;
168
+ font-size: 0.9375rem;
169
+ color: #333;
170
+ }
171
+
172
+ .rtif-embed-tweet-quote a {
173
+ color: #1da1f2;
174
+ text-decoration: none;
175
+ font-weight: 500;
176
+ }
177
+
178
+ .rtif-embed-tweet-quote a:hover {
179
+ text-decoration: underline;
180
+ }
181
+
182
+ /* Generic embeds */
183
+ .rtif-embed-generic {
184
+ padding: 1em;
185
+ background: #f9fafb;
186
+ border: 1px solid #e0e0e0;
187
+ border-radius: 6px;
188
+ text-align: center;
189
+ }
190
+
191
+ .rtif-embed-link {
192
+ color: #1a73e8;
193
+ text-decoration: none;
194
+ font-size: 0.875rem;
195
+ }
196
+
197
+ .rtif-embed-link:hover {
198
+ text-decoration: underline;
199
+ }
@@ -0,0 +1,58 @@
1
+ /* --------------------------------------------------------
2
+ * RTIF Context Menu Styles
3
+ *
4
+ * Right-click menu for Cut/Copy/Paste/Select All.
5
+ * Positioned via JS (top/left). All visual properties
6
+ * are CSS-driven. Uses RTIF CSS custom properties.
7
+ * -------------------------------------------------------- */
8
+
9
+ .rtif-context-menu {
10
+ position: fixed;
11
+ z-index: var(--rtif-z-popover, 9999);
12
+ background-color: var(--rtif-surface, #fff);
13
+ border: 1px solid var(--rtif-border, #d0d0d0);
14
+ border-radius: var(--rtif-radius, 6px);
15
+ box-shadow: var(--rtif-shadow, 0 4px 12px rgba(0, 0, 0, 0.15));
16
+ padding: 4px 0;
17
+ min-width: 180px;
18
+ font-family: var(--rtif-ui-font, system-ui, -apple-system, sans-serif);
19
+ font-size: var(--rtif-ui-font-size, 13px);
20
+ line-height: 1;
21
+ user-select: none;
22
+ }
23
+
24
+ .rtif-context-menu-separator {
25
+ height: 1px;
26
+ background-color: var(--rtif-border, #e0e0e0);
27
+ margin: 4px 0;
28
+ }
29
+
30
+ .rtif-context-menu-item {
31
+ display: flex;
32
+ align-items: center;
33
+ justify-content: space-between;
34
+ padding: 6px 12px;
35
+ cursor: pointer;
36
+ color: #333;
37
+ }
38
+
39
+ .rtif-context-menu-item[aria-disabled="true"] {
40
+ cursor: default;
41
+ color: #999;
42
+ }
43
+
44
+ .rtif-context-menu-item:not([aria-disabled="true"]):hover,
45
+ .rtif-context-menu-item-highlighted:not([aria-disabled="true"]) {
46
+ background-color: var(--rtif-accent-color, #2563eb);
47
+ color: #fff;
48
+ }
49
+
50
+ .rtif-context-menu-item-highlighted:not([aria-disabled="true"]) .rtif-context-menu-item-shortcut {
51
+ color: rgba(255, 255, 255, 0.7);
52
+ }
53
+
54
+ .rtif-context-menu-item-shortcut {
55
+ margin-left: 24px;
56
+ color: #999;
57
+ font-size: 12px;
58
+ }
@@ -0,0 +1,37 @@
1
+ /* --------------------------------------------------------
2
+ * RTIF Drop Indicator Styles
3
+ *
4
+ * Visual feedback for drag-and-drop. Line position (top)
5
+ * set by JS. All visual properties are CSS-driven.
6
+ * -------------------------------------------------------- */
7
+
8
+ .rtif-drop-indicator {
9
+ position: absolute;
10
+ height: 2px;
11
+ left: 0;
12
+ right: 0;
13
+ background-color: var(--rtif-accent-color, #2563eb);
14
+ pointer-events: none;
15
+ z-index: var(--rtif-z-drop-line, 10);
16
+ }
17
+
18
+ .rtif-drop-overlay {
19
+ position: absolute;
20
+ inset: 0;
21
+ z-index: var(--rtif-z-drop-overlay, 20);
22
+ pointer-events: none;
23
+ border: 2px dashed var(--rtif-accent-color, #2563eb);
24
+ border-radius: var(--rtif-radius-sm, 4px);
25
+ background-color: rgba(37, 99, 235, 0.05);
26
+ display: flex;
27
+ align-items: center;
28
+ justify-content: center;
29
+ }
30
+
31
+ .rtif-drop-overlay-label {
32
+ color: var(--rtif-accent-color, #2563eb);
33
+ font-size: var(--rtif-ui-font-size, 14px);
34
+ font-weight: 500;
35
+ pointer-events: none;
36
+ user-select: none;
37
+ }
@@ -0,0 +1,51 @@
1
+ /* --------------------------------------------------------
2
+ * RTIF Floating Toolbar Styles
3
+ *
4
+ * Appears near text selection. Positioned via JS (top/left).
5
+ * Structural properties (position, z-index) defined here.
6
+ * -------------------------------------------------------- */
7
+
8
+ .rtif-floating-toolbar {
9
+ position: fixed;
10
+ z-index: var(--rtif-z-popover, 9999);
11
+ display: flex;
12
+ align-items: center;
13
+ gap: 2px;
14
+ padding: 4px;
15
+ background: var(--rtif-surface, #fff);
16
+ border: 1px solid var(--rtif-border, #d0d0d0);
17
+ border-radius: var(--rtif-radius, 6px);
18
+ box-shadow: var(--rtif-shadow, 0 2px 8px rgba(0, 0, 0, 0.15));
19
+ }
20
+
21
+ .rtif-floating-toolbar-button {
22
+ display: inline-flex;
23
+ align-items: center;
24
+ justify-content: center;
25
+ min-width: 28px;
26
+ height: 28px;
27
+ padding: 0 4px;
28
+ border: none;
29
+ border-radius: var(--rtif-radius-sm, 4px);
30
+ background: transparent;
31
+ font-size: 0.75rem;
32
+ font-weight: 600;
33
+ color: #444;
34
+ cursor: pointer;
35
+ transition: background 0.1s;
36
+ }
37
+
38
+ .rtif-floating-toolbar-button:hover {
39
+ background: #e8e8e8;
40
+ }
41
+
42
+ .rtif-floating-toolbar-button[aria-pressed="true"],
43
+ .rtif-floating-toolbar-button.rtif-floating-toolbar-active {
44
+ background: #d0e0ff;
45
+ color: #1a5ccc;
46
+ }
47
+
48
+ .rtif-floating-toolbar-button[aria-disabled="true"] {
49
+ opacity: 0.3;
50
+ cursor: not-allowed;
51
+ }
@@ -0,0 +1,64 @@
1
+ /* --------------------------------------------------------
2
+ * RTIF Link Popover Styles
3
+ *
4
+ * Floating dialog for creating/editing links. Positioned
5
+ * via JS (top/left). All visual properties are CSS-driven.
6
+ * -------------------------------------------------------- */
7
+
8
+ .rtif-link-popover {
9
+ position: fixed;
10
+ z-index: var(--rtif-z-popover, 9999);
11
+ background-color: var(--rtif-surface, #fff);
12
+ border: 1px solid var(--rtif-border, #ccc);
13
+ border-radius: var(--rtif-radius, 6px);
14
+ padding: 8px;
15
+ box-shadow: var(--rtif-shadow, 0 2px 8px rgba(0, 0, 0, 0.15));
16
+ display: flex;
17
+ align-items: center;
18
+ gap: 6px;
19
+ font-family: var(--rtif-ui-font, system-ui, -apple-system, sans-serif);
20
+ font-size: var(--rtif-ui-font-size, 14px);
21
+ }
22
+
23
+ .rtif-link-popover-input {
24
+ flex: 1;
25
+ min-width: 200px;
26
+ padding: 4px 8px;
27
+ border: 1px solid var(--rtif-border, #ccc);
28
+ border-radius: var(--rtif-radius-sm, 4px);
29
+ font-size: var(--rtif-ui-font-size, 14px);
30
+ outline: none;
31
+ }
32
+
33
+ .rtif-link-popover-input:focus {
34
+ border-color: var(--rtif-accent-color, #0066cc);
35
+ box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
36
+ }
37
+
38
+ .rtif-link-popover-apply {
39
+ padding: 4px 12px;
40
+ border: none;
41
+ border-radius: var(--rtif-radius-sm, 4px);
42
+ background-color: var(--rtif-accent-color, #0066cc);
43
+ color: #fff;
44
+ cursor: pointer;
45
+ font-size: 13px;
46
+ }
47
+
48
+ .rtif-link-popover-apply:hover {
49
+ filter: brightness(0.85);
50
+ }
51
+
52
+ .rtif-link-popover-remove {
53
+ padding: 4px 12px;
54
+ border: 1px solid #cc0000;
55
+ border-radius: var(--rtif-radius-sm, 4px);
56
+ background-color: transparent;
57
+ color: #cc0000;
58
+ cursor: pointer;
59
+ font-size: 13px;
60
+ }
61
+
62
+ .rtif-link-popover-remove:hover {
63
+ background-color: rgba(204, 0, 0, 0.08);
64
+ }
@@ -0,0 +1,27 @@
1
+ /* --------------------------------------------------------
2
+ * RTIF Inline Mark Styles
3
+ *
4
+ * Classes applied by mark renderers in mark-renderer.ts.
5
+ * Parameterized marks (color, fontSize, fontFamily) use
6
+ * inline styles for dynamic values — not covered here.
7
+ * -------------------------------------------------------- */
8
+
9
+ .rtif-bold { font-weight: 700; }
10
+ .rtif-italic { font-style: italic; }
11
+ .rtif-underline { text-decoration: underline; }
12
+ .rtif-strikethrough { text-decoration: line-through; }
13
+ .rtif-underline.rtif-strikethrough { text-decoration: underline line-through; }
14
+
15
+ .rtif-code {
16
+ font-family: 'SF Mono', Menlo, Consolas, monospace;
17
+ font-size: 0.875em;
18
+ padding: 0.15em 0.35em;
19
+ border-radius: 3px;
20
+ background: #f0f0f0;
21
+ }
22
+
23
+ .rtif-link {
24
+ color: #1a73e8;
25
+ text-decoration: underline;
26
+ cursor: pointer;
27
+ }
@@ -0,0 +1,17 @@
1
+ /* --------------------------------------------------------
2
+ * RTIF Mention Chip Styles
3
+ *
4
+ * Inline mention chip rendered by mention-plugin.ts.
5
+ * The element has contenteditable="false" and atomic: true.
6
+ * -------------------------------------------------------- */
7
+
8
+ .rtif-mention {
9
+ display: inline;
10
+ padding: 0.1em 0.4em;
11
+ border-radius: 4px;
12
+ background: #e8f0fe;
13
+ color: #1a5ccc;
14
+ font-weight: 500;
15
+ font-size: 0.9375em;
16
+ white-space: nowrap;
17
+ }