@milkdown/crepe 7.19.2 → 7.20.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 (100) hide show
  1. package/lib/cjs/builder.js +43 -1
  2. package/lib/cjs/builder.js.map +1 -1
  3. package/lib/cjs/feature/block-edit/index.js +8 -2
  4. package/lib/cjs/feature/block-edit/index.js.map +1 -1
  5. package/lib/cjs/feature/code-mirror/index.js +1 -0
  6. package/lib/cjs/feature/code-mirror/index.js.map +1 -1
  7. package/lib/cjs/feature/cursor/index.js +1 -0
  8. package/lib/cjs/feature/cursor/index.js.map +1 -1
  9. package/lib/cjs/feature/image-block/index.js +4 -1
  10. package/lib/cjs/feature/image-block/index.js.map +1 -1
  11. package/lib/cjs/feature/latex/index.js +5 -0
  12. package/lib/cjs/feature/latex/index.js.map +1 -1
  13. package/lib/cjs/feature/link-tooltip/index.js +1 -0
  14. package/lib/cjs/feature/link-tooltip/index.js.map +1 -1
  15. package/lib/cjs/feature/list-item/index.js +1 -0
  16. package/lib/cjs/feature/list-item/index.js.map +1 -1
  17. package/lib/cjs/feature/placeholder/index.js +1 -0
  18. package/lib/cjs/feature/placeholder/index.js.map +1 -1
  19. package/lib/cjs/feature/table/index.js +1 -0
  20. package/lib/cjs/feature/table/index.js.map +1 -1
  21. package/lib/cjs/feature/toolbar/index.js +9 -2
  22. package/lib/cjs/feature/toolbar/index.js.map +1 -1
  23. package/lib/cjs/feature/top-bar/index.js +790 -0
  24. package/lib/cjs/feature/top-bar/index.js.map +1 -0
  25. package/lib/cjs/index.js +630 -142
  26. package/lib/cjs/index.js.map +1 -1
  27. package/lib/esm/builder.js +43 -1
  28. package/lib/esm/builder.js.map +1 -1
  29. package/lib/esm/feature/block-edit/index.js +8 -2
  30. package/lib/esm/feature/block-edit/index.js.map +1 -1
  31. package/lib/esm/feature/code-mirror/index.js +1 -0
  32. package/lib/esm/feature/code-mirror/index.js.map +1 -1
  33. package/lib/esm/feature/cursor/index.js +1 -0
  34. package/lib/esm/feature/cursor/index.js.map +1 -1
  35. package/lib/esm/feature/image-block/index.js +4 -1
  36. package/lib/esm/feature/image-block/index.js.map +1 -1
  37. package/lib/esm/feature/latex/index.js +5 -0
  38. package/lib/esm/feature/latex/index.js.map +1 -1
  39. package/lib/esm/feature/link-tooltip/index.js +1 -0
  40. package/lib/esm/feature/link-tooltip/index.js.map +1 -1
  41. package/lib/esm/feature/list-item/index.js +1 -0
  42. package/lib/esm/feature/list-item/index.js.map +1 -1
  43. package/lib/esm/feature/placeholder/index.js +1 -0
  44. package/lib/esm/feature/placeholder/index.js.map +1 -1
  45. package/lib/esm/feature/table/index.js +1 -0
  46. package/lib/esm/feature/table/index.js.map +1 -1
  47. package/lib/esm/feature/toolbar/index.js +9 -2
  48. package/lib/esm/feature/toolbar/index.js.map +1 -1
  49. package/lib/esm/feature/top-bar/index.js +788 -0
  50. package/lib/esm/feature/top-bar/index.js.map +1 -0
  51. package/lib/esm/index.js +631 -143
  52. package/lib/esm/index.js.map +1 -1
  53. package/lib/theme/common/style.css +1 -0
  54. package/lib/theme/common/top-bar.css +152 -0
  55. package/lib/tsconfig.tsbuildinfo +1 -1
  56. package/lib/types/core/builder.d.ts +2 -1
  57. package/lib/types/core/builder.d.ts.map +1 -1
  58. package/lib/types/feature/block-edit/handle/component.d.ts.map +1 -1
  59. package/lib/types/feature/block-edit/menu/component.d.ts.map +1 -1
  60. package/lib/types/feature/image-block/index.d.ts +2 -0
  61. package/lib/types/feature/image-block/index.d.ts.map +1 -1
  62. package/lib/types/feature/index.d.ts +4 -1
  63. package/lib/types/feature/index.d.ts.map +1 -1
  64. package/lib/types/feature/latex/inline-tooltip/component.d.ts.map +1 -1
  65. package/lib/types/feature/loader.d.ts.map +1 -1
  66. package/lib/types/feature/toolbar/component.d.ts.map +1 -1
  67. package/lib/types/feature/toolbar/config.d.ts +1 -1
  68. package/lib/types/feature/top-bar/component.d.ts +11 -0
  69. package/lib/types/feature/top-bar/component.d.ts.map +1 -0
  70. package/lib/types/feature/top-bar/config.d.ts +34 -0
  71. package/lib/types/feature/top-bar/config.d.ts.map +1 -0
  72. package/lib/types/feature/top-bar/index.d.ts +26 -0
  73. package/lib/types/feature/top-bar/index.d.ts.map +1 -0
  74. package/lib/types/icons/code-block.d.ts +2 -0
  75. package/lib/types/icons/code-block.d.ts.map +1 -0
  76. package/lib/types/icons/index.d.ts +1 -0
  77. package/lib/types/icons/index.d.ts.map +1 -1
  78. package/lib/types/utils/group-builder.d.ts +1 -1
  79. package/lib/types/utils/group-builder.d.ts.map +1 -1
  80. package/lib/types/utils/keep-alive.d.ts +2 -0
  81. package/lib/types/utils/keep-alive.d.ts.map +1 -0
  82. package/package.json +18 -13
  83. package/src/core/builder.ts +39 -2
  84. package/src/feature/block-edit/handle/component.tsx +3 -2
  85. package/src/feature/block-edit/menu/component.tsx +3 -2
  86. package/src/feature/block-edit/menu/config.ts +1 -1
  87. package/src/feature/image-block/index.ts +4 -0
  88. package/src/feature/index.ts +6 -0
  89. package/src/feature/latex/inline-tooltip/component.tsx +4 -2
  90. package/src/feature/loader.ts +4 -0
  91. package/src/feature/toolbar/component.tsx +7 -5
  92. package/src/feature/top-bar/component.tsx +198 -0
  93. package/src/feature/top-bar/config.ts +367 -0
  94. package/src/feature/top-bar/index.ts +113 -0
  95. package/src/icons/code-block.ts +12 -0
  96. package/src/icons/index.ts +1 -0
  97. package/src/theme/common/style.css +1 -0
  98. package/src/theme/common/top-bar.css +156 -0
  99. package/src/utils/group-builder.ts +1 -1
  100. package/src/utils/keep-alive.ts +3 -0
@@ -10,3 +10,4 @@
10
10
  @import './toolbar.css';
11
11
  @import './table.css';
12
12
  @import './latex.css';
13
+ @import './top-bar.css';
@@ -0,0 +1,152 @@
1
+ .milkdown .milkdown-top-bar {
2
+ position: sticky;
3
+ top: 0;
4
+ z-index: 10;
5
+ display: flex;
6
+ align-items: center;
7
+ background: var(--crepe-color-surface);
8
+ padding: 0 12px;
9
+ min-height: 44px;
10
+ border-bottom: 1px solid
11
+ color-mix(in srgb, var(--crepe-color-outline), transparent 80%);
12
+ flex-wrap: wrap;
13
+ }
14
+
15
+ .milkdown .milkdown-top-bar .top-bar-inner {
16
+ display: flex;
17
+ align-items: center;
18
+ flex-wrap: wrap;
19
+ width: 100%;
20
+ }
21
+
22
+ .milkdown .milkdown-top-bar .top-bar-divider {
23
+ width: 1px;
24
+ background: color-mix(
25
+ in srgb,
26
+ var(--crepe-color-outline),
27
+ transparent 80%
28
+ );
29
+ height: 24px;
30
+ margin: 10px;
31
+ flex-shrink: 0;
32
+ }
33
+
34
+ .milkdown .milkdown-top-bar .top-bar-heading-selector {
35
+ position: relative;
36
+ flex-shrink: 0;
37
+ padding: 6px;
38
+ }
39
+
40
+ .milkdown .milkdown-top-bar .top-bar-heading-button {
41
+ display: flex;
42
+ align-items: center;
43
+ text-align: left;
44
+ padding: 4px 4px 4px 10px;
45
+ border-radius: 4px;
46
+ cursor: pointer;
47
+ height: 32px;
48
+ box-sizing: border-box;
49
+ }
50
+
51
+ .milkdown .milkdown-top-bar .top-bar-heading-button:hover {
52
+ background: var(--crepe-color-hover);
53
+ }
54
+
55
+ .milkdown .milkdown-top-bar .top-bar-heading-button .top-bar-heading-label {
56
+ font-family: var(--crepe-font-default);
57
+ font-size: 14px;
58
+ font-weight: 600;
59
+ line-height: 20px;
60
+ letter-spacing: 0.1px;
61
+ color: var(--crepe-color-on-surface);
62
+ white-space: nowrap;
63
+ min-width: 80px;
64
+ }
65
+
66
+ .milkdown .milkdown-top-bar .top-bar-heading-button .top-bar-chevron {
67
+ width: 24px;
68
+ height: 24px;
69
+ flex-shrink: 0;
70
+ display: flex;
71
+ align-items: center;
72
+ justify-content: center;
73
+ }
74
+
75
+ .milkdown .milkdown-top-bar .top-bar-heading-button .top-bar-chevron svg {
76
+ width: 16px;
77
+ height: 16px;
78
+ color: var(--crepe-color-outline);
79
+ stroke: var(--crepe-color-outline);
80
+ fill: none;
81
+ }
82
+
83
+ .milkdown .milkdown-top-bar .top-bar-heading-dropdown {
84
+ position: absolute;
85
+ top: 100%;
86
+ left: 0;
87
+ z-index: 20;
88
+ background: var(--crepe-color-surface);
89
+ box-shadow: var(--crepe-shadow-2);
90
+ border-radius: 8px;
91
+ padding: 8px 4px 4px;
92
+ min-width: 160px;
93
+ }
94
+
95
+ .milkdown .milkdown-top-bar .top-bar-heading-option {
96
+ display: flex;
97
+ align-items: center;
98
+ justify-content: flex-start;
99
+ text-align: left;
100
+ width: 100%;
101
+ padding: 8px 12px;
102
+ border-radius: 4px;
103
+ cursor: pointer;
104
+ font-family: var(--crepe-font-default);
105
+ font-size: 14px;
106
+ font-weight: 400;
107
+ line-height: 20px;
108
+ color: var(--crepe-color-on-surface);
109
+ white-space: nowrap;
110
+ }
111
+
112
+ .milkdown .milkdown-top-bar .top-bar-heading-option:hover {
113
+ background: var(--crepe-color-hover);
114
+ }
115
+
116
+ .milkdown .milkdown-top-bar .top-bar-heading-option.active {
117
+ font-weight: 600;
118
+ color: var(--crepe-color-primary);
119
+ }
120
+
121
+ .milkdown .milkdown-top-bar .top-bar-item {
122
+ width: 32px;
123
+ height: 32px;
124
+ margin: 6px;
125
+ padding: 4px;
126
+ cursor: pointer;
127
+ border-radius: 4px;
128
+ flex-shrink: 0;
129
+ display: flex;
130
+ align-items: center;
131
+ justify-content: center;
132
+ }
133
+
134
+ .milkdown .milkdown-top-bar .top-bar-item:hover {
135
+ background: var(--crepe-color-hover);
136
+ }
137
+
138
+ .milkdown .milkdown-top-bar .top-bar-item:active {
139
+ background: var(--crepe-color-selected);
140
+ }
141
+
142
+ .milkdown .milkdown-top-bar .top-bar-item svg {
143
+ height: 24px;
144
+ width: 24px;
145
+ color: var(--crepe-color-outline);
146
+ fill: var(--crepe-color-outline);
147
+ }
148
+
149
+ .milkdown .milkdown-top-bar .top-bar-item.active svg {
150
+ color: var(--crepe-color-primary);
151
+ fill: var(--crepe-color-primary);
152
+ }