@milkdown/preset-gfm 5.4.0 → 6.0.0-next.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 (70) hide show
  1. package/README.md +4 -4
  2. package/lib/{src/auto-link.d.ts → auto-link.d.ts} +0 -0
  3. package/lib/auto-link.d.ts.map +1 -0
  4. package/lib/index.d.ts +36 -1
  5. package/lib/index.d.ts.map +1 -0
  6. package/lib/index.es.js +283 -448
  7. package/lib/index.es.js.map +1 -1
  8. package/lib/{src/strike-through.d.ts → strike-through.d.ts} +1 -1
  9. package/lib/strike-through.d.ts.map +1 -0
  10. package/lib/{src/supported-keys.d.ts → supported-keys.d.ts} +0 -0
  11. package/lib/supported-keys.d.ts.map +1 -0
  12. package/lib/{src/table → table}/command.d.ts +0 -0
  13. package/lib/table/command.d.ts.map +1 -0
  14. package/lib/{src/table → table}/index.d.ts +0 -0
  15. package/lib/table/index.d.ts.map +1 -0
  16. package/lib/{src/table → table}/nodes/index.d.ts +7 -6
  17. package/lib/table/nodes/index.d.ts.map +1 -0
  18. package/lib/{src/table → table}/nodes/schema.d.ts +0 -0
  19. package/lib/table/nodes/schema.d.ts.map +1 -0
  20. package/lib/{src/table → table}/operator-plugin/actions.d.ts +0 -0
  21. package/lib/table/operator-plugin/actions.d.ts.map +1 -0
  22. package/lib/{src/table → table}/operator-plugin/calc-pos.d.ts +0 -0
  23. package/lib/table/operator-plugin/calc-pos.d.ts.map +1 -0
  24. package/lib/{src/table → table}/operator-plugin/constant.d.ts +0 -0
  25. package/lib/table/operator-plugin/constant.d.ts.map +1 -0
  26. package/lib/{src/table → table}/operator-plugin/helper.d.ts +0 -0
  27. package/lib/table/operator-plugin/helper.d.ts.map +1 -0
  28. package/lib/{src/table → table}/operator-plugin/index.d.ts +0 -0
  29. package/lib/table/operator-plugin/index.d.ts.map +1 -0
  30. package/lib/table/operator-plugin/style.d.ts +3 -0
  31. package/lib/table/operator-plugin/style.d.ts.map +1 -0
  32. package/lib/{src/table → table}/operator-plugin/widget.d.ts +0 -0
  33. package/lib/table/operator-plugin/widget.d.ts.map +1 -0
  34. package/lib/{src/table → table}/utils.d.ts +1 -0
  35. package/lib/table/utils.d.ts.map +1 -0
  36. package/lib/{src/task-list-item.d.ts → task-list-item.d.ts} +1 -1
  37. package/lib/task-list-item.d.ts.map +1 -0
  38. package/package.json +36 -12
  39. package/src/auto-link.ts +1 -1
  40. package/src/strike-through.ts +3 -10
  41. package/src/table/nodes/index.ts +24 -18
  42. package/src/table/operator-plugin/actions.ts +9 -9
  43. package/src/table/operator-plugin/helper.ts +1 -1
  44. package/src/table/operator-plugin/index.ts +8 -6
  45. package/src/table/operator-plugin/style.ts +109 -37
  46. package/src/table/operator-plugin/widget.ts +3 -4
  47. package/src/table/utils.ts +9 -6
  48. package/src/task-list-item.ts +69 -134
  49. package/lib/src/auto-link.d.ts.map +0 -1
  50. package/lib/src/index.d.ts +0 -36
  51. package/lib/src/index.d.ts.map +0 -1
  52. package/lib/src/strike-through.d.ts.map +0 -1
  53. package/lib/src/supported-keys.d.ts.map +0 -1
  54. package/lib/src/table/command.d.ts.map +0 -1
  55. package/lib/src/table/index.d.ts.map +0 -1
  56. package/lib/src/table/nodes/index.d.ts.map +0 -1
  57. package/lib/src/table/nodes/schema.d.ts.map +0 -1
  58. package/lib/src/table/nodes/style.d.ts +0 -3
  59. package/lib/src/table/nodes/style.d.ts.map +0 -1
  60. package/lib/src/table/operator-plugin/actions.d.ts.map +0 -1
  61. package/lib/src/table/operator-plugin/calc-pos.d.ts.map +0 -1
  62. package/lib/src/table/operator-plugin/constant.d.ts.map +0 -1
  63. package/lib/src/table/operator-plugin/helper.d.ts.map +0 -1
  64. package/lib/src/table/operator-plugin/index.d.ts.map +0 -1
  65. package/lib/src/table/operator-plugin/style.d.ts +0 -3
  66. package/lib/src/table/operator-plugin/style.d.ts.map +0 -1
  67. package/lib/src/table/operator-plugin/widget.d.ts.map +0 -1
  68. package/lib/src/table/utils.d.ts.map +0 -1
  69. package/lib/src/task-list-item.d.ts.map +0 -1
  70. package/src/table/nodes/style.ts +0 -170
@@ -1,6 +1,5 @@
1
1
  /* Copyright 2021, Milkdown by Mirone. */
2
- import { createCmd, createCmdKey, themeToolCtx } from '@milkdown/core';
3
- import type { Icon } from '@milkdown/design-system';
2
+ import { createCmd, createCmdKey, editorViewCtx, ThemeTaskListItemType } from '@milkdown/core';
4
3
  import { liftListItem, sinkListItem, splitListItem, wrapIn, wrappingInputRule } from '@milkdown/prose';
5
4
  import { createNode, createShortcut } from '@milkdown/utils';
6
5
 
@@ -8,66 +7,17 @@ import { SupportedKeys } from './supported-keys';
8
7
 
9
8
  type Keys = Extract<keyof SupportedKeys, 'SinkListItem' | 'LiftListItem' | 'NextListItem' | 'TaskList'>;
10
9
 
11
- export const SplitTaskListItem = createCmdKey();
12
- export const SinkTaskListItem = createCmdKey();
13
- export const LiftTaskListItem = createCmdKey();
14
- export const TurnIntoTaskList = createCmdKey();
10
+ export const SplitTaskListItem = createCmdKey('SplitTaskListItem');
11
+ export const SinkTaskListItem = createCmdKey('SinkTaskListItem');
12
+ export const LiftTaskListItem = createCmdKey('LiftTaskListItem');
13
+ export const TurnIntoTaskList = createCmdKey('TurnIntoTaskList');
15
14
 
16
15
  export const taskListItem = createNode<Keys>((utils) => {
17
16
  const id = 'task_list_item';
18
- const style = utils.getStyle(
19
- ({ palette, size }, { css }) =>
20
- css`
21
- list-style-type: none;
22
- position: relative;
23
-
24
- & > div {
25
- overflow: hidden;
26
- padding: 0 2px;
27
- }
28
-
29
- label {
30
- position: absolute;
31
- top: 0;
32
- left: -2rem;
33
- display: inline-block;
34
- width: 1.5rem;
35
- height: 1.5rem;
36
- margin: 0.5rem 0;
37
- input {
38
- visibility: hidden;
39
- }
40
- }
41
- label:before {
42
- position: absolute;
43
- top: 0;
44
- right: 0;
45
- bottom: 0;
46
- left: 0;
47
- border-radius: ${size.radius};
48
- }
49
- label:hover:before {
50
- background: ${palette('background')};
51
- }
52
- &[data-checked='true'] {
53
- label {
54
- color: ${palette('primary')};
55
- }
56
- }
57
- &[data-checked='false'] {
58
- label {
59
- color: ${palette('solid', 0.87)};
60
- }
61
- }
62
- .paragraph {
63
- margin: 0.5rem 0;
64
- }
65
- `,
66
- );
67
17
 
68
18
  return {
69
19
  id,
70
- schema: () => ({
20
+ schema: (ctx) => ({
71
21
  group: 'listItem',
72
22
  content: 'paragraph block*',
73
23
  defining: true,
@@ -84,25 +34,55 @@ export const taskListItem = createNode<Keys>((utils) => {
84
34
  if (!(dom instanceof HTMLElement)) {
85
35
  throw new Error();
86
36
  }
87
- return { checked: dom.dataset.checked === 'true' };
37
+ return { checked: dom.dataset['checked'] === 'true' };
88
38
  },
89
39
  },
90
40
  ],
91
- toDOM: (node) => [
92
- 'li',
93
- {
94
- 'data-type': 'task-item',
95
- 'data-checked': node.attrs.checked ? 'true' : 'false',
96
- class: utils.getClassName(node.attrs, 'task-list-item', style),
97
- },
98
- 0,
99
- ],
41
+ toDOM: (node) => {
42
+ const checkbox = document.createElement('input');
43
+ checkbox.type = 'checkbox';
44
+ checkbox.checked = node.attrs['checked'];
45
+ checkbox.className = utils.getClassName(node.attrs, 'task-list-item_checkbox');
46
+ checkbox.onchange = (event) => {
47
+ const target = event.target;
48
+ if (!(target instanceof HTMLInputElement)) return;
49
+ const view = ctx.get(editorViewCtx);
50
+
51
+ if (!view.editable) {
52
+ checkbox.checked = !checkbox.checked;
53
+
54
+ return;
55
+ }
56
+
57
+ const { top, left } = target.getBoundingClientRect();
58
+ const result = view.posAtCoords({ top, left });
59
+ if (!result) return;
60
+
61
+ const { tr } = view.state;
62
+
63
+ view.dispatch(
64
+ tr.setNodeMarkup(result.inside, undefined, {
65
+ checked: target.checked,
66
+ }),
67
+ );
68
+ };
69
+ return [
70
+ 'li',
71
+ {
72
+ 'data-type': 'task-item',
73
+ 'data-checked': node.attrs['checked'] ? 'true' : 'false',
74
+ class: utils.getClassName(node.attrs, 'task-list-item'),
75
+ },
76
+ checkbox,
77
+ ['span', { class: utils.getClassName(node.attrs, 'task-list-item_body') }, 0],
78
+ ];
79
+ },
100
80
  parseMarkdown: {
101
81
  match: ({ type, checked }) => {
102
82
  return type === 'listItem' && checked !== null;
103
83
  },
104
84
  runner: (state, node, type) => {
105
- state.openNode(type, { checked: node.checked as boolean });
85
+ state.openNode(type, { checked: node['checked'] as boolean });
106
86
  state.next(node.children);
107
87
  state.closeNode();
108
88
  },
@@ -110,7 +90,7 @@ export const taskListItem = createNode<Keys>((utils) => {
110
90
  toMarkdown: {
111
91
  match: (node) => node.type.name === id,
112
92
  runner: (state, node) => {
113
- state.openNode('listItem', undefined, { checked: node.attrs.checked });
93
+ state.openNode('listItem', undefined, { checked: node.attrs['checked'] });
114
94
  state.next(node.content);
115
95
  state.closeNode();
116
96
  },
@@ -133,82 +113,37 @@ export const taskListItem = createNode<Keys>((utils) => {
133
113
  [SupportedKeys.LiftListItem]: createShortcut(LiftTaskListItem, 'Mod-['),
134
114
  [SupportedKeys.TaskList]: createShortcut(TurnIntoTaskList, 'Mod-Alt-9'),
135
115
  },
136
- view: (ctx) => (node, view, getPos) => {
137
- const createIcon = ctx.get(themeToolCtx).slots.icon;
138
-
139
- const listItem = document.createElement('li');
140
- const checkboxWrapper = document.createElement('label');
141
- const checkboxStyler = document.createElement('span');
142
- const checkbox = document.createElement('input');
143
- const content = document.createElement('div');
144
-
145
- let icon = createIcon('unchecked');
146
- checkboxWrapper.appendChild(icon);
147
- const setIcon = (name: Icon) => {
148
- const nextIcon = createIcon(name);
149
- checkboxWrapper.replaceChild(nextIcon, icon);
150
- icon = nextIcon;
151
- };
152
-
153
- checkboxWrapper.contentEditable = 'false';
154
- checkbox.type = 'checkbox';
155
- const onChange = (event: Event) => {
156
- const target = event.target;
157
- if (!(target instanceof HTMLInputElement)) return;
158
-
159
- if (!view.editable) {
160
- checkbox.checked = !checkbox.checked;
161
-
162
- return;
163
- }
164
-
165
- const { tr } = view.state;
166
-
167
- view.dispatch(
168
- tr.setNodeMarkup(getPos(), undefined, {
169
- checked: target.checked,
170
- }),
171
- );
172
- };
173
- checkbox.addEventListener('change', onChange);
174
-
175
- listItem.dataset.checked = node.attrs.checked;
176
- if (node.attrs.checked) {
177
- checkbox.setAttribute('checked', 'checked');
178
- }
116
+ view: () => (node, view, getPos) => {
117
+ let currNode = node;
118
+
119
+ const renderer = utils.themeManager.get<ThemeTaskListItemType>('task-list-item', {
120
+ editable: () => view.editable,
121
+ onChange: (selected) => {
122
+ const { tr } = view.state;
123
+ view.dispatch(
124
+ tr.setNodeMarkup(getPos(), undefined, {
125
+ checked: selected,
126
+ }),
127
+ );
128
+ },
129
+ });
179
130
 
180
- checkboxWrapper.append(checkbox, checkboxStyler);
181
- listItem.append(checkboxWrapper, content);
131
+ if (!renderer) return {};
182
132
 
183
- const attributes = {
184
- 'data-type': 'task-item',
185
- 'data-checked': node.attrs.checked ? 'true' : 'false',
186
- class: utils.getClassName(node.attrs, 'task-list-item', style),
187
- };
188
- Object.entries(attributes).forEach(([key, value]) => {
189
- listItem.setAttribute(key, value);
190
- });
191
- setIcon(node.attrs.checked ? 'checked' : 'unchecked');
133
+ const { dom, contentDOM, onUpdate } = renderer;
134
+ onUpdate(currNode);
192
135
 
193
136
  return {
194
- dom: listItem,
195
- contentDOM: content,
137
+ dom,
138
+ contentDOM,
196
139
  update: (updatedNode) => {
197
140
  if (updatedNode.type.name !== id) return false;
198
141
 
199
- listItem.dataset.checked = updatedNode.attrs.checked;
200
- if (updatedNode.attrs.checked) {
201
- checkbox.setAttribute('checked', 'checked');
202
- } else {
203
- checkbox.removeAttribute('checked');
204
- }
205
- setIcon(updatedNode.attrs.checked ? 'checked' : 'unchecked');
142
+ currNode = updatedNode;
143
+ onUpdate(currNode);
206
144
 
207
145
  return true;
208
146
  },
209
- destroy: () => {
210
- checkbox.removeEventListener('change', onChange);
211
- },
212
147
  };
213
148
  },
214
149
  };
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto-link.d.ts","sourceRoot":"","sources":["auto-link.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,SAAS,kCAAiC,CAAC"}
@@ -1,36 +0,0 @@
1
- import { AtomList } from '@milkdown/utils';
2
- export * from './strike-through';
3
- export { SupportedKeys } from './supported-keys';
4
- export { BreakTable, createTable, InsertTable, NextCell, PrevCell, table, } from './table';
5
- export * from './task-list-item';
6
- export { blockquote, bulletList, codeFence, codeInline, commonmark, commonmarkNodes, commonmarkPlugins, doc, em, hardbreak, heading, hr, image, InsertHardbreak, InsertHr, InsertImage, LiftListItem, link, listItem, ModifyImage, ModifyLink, orderedList, paragraph, SinkListItem, SplitListItem, strong, text, ToggleBold, ToggleInlineCode, ToggleItalic, ToggleLink, TurnIntoCodeFence, TurnIntoHeading, TurnIntoText, WrapInBlockquote, WrapInBulletList, WrapInOrderedList, } from '@milkdown/preset-commonmark';
7
- export declare const gfm: AtomList<import("@milkdown/utils").$Prose | (import("@milkdown/utils/lib/src/types").Metadata<import("@milkdown/utils/lib/src/types").GetPlugin<"CodeFence", {
8
- languageList?: string[] | undefined;
9
- }>> & import("@milkdown/core").MilkdownPlugin) | (import("@milkdown/utils/lib/src/types").Metadata<import("@milkdown/utils/lib/src/types").GetPlugin<string, import("@milkdown/preset-commonmark").ImageOptions>> & import("@milkdown/core").MilkdownPlugin) | import("@milkdown/utils").$Remark>;
10
- export declare const commands: {
11
- readonly ToggleStrikeThrough: import("@milkdown/core").CmdKey<undefined>;
12
- readonly TurnIntoTaskList: import("@milkdown/core").CmdKey<undefined>;
13
- readonly SinkTaskListItem: import("@milkdown/core").CmdKey<undefined>;
14
- readonly LiftTaskListItem: import("@milkdown/core").CmdKey<undefined>;
15
- readonly SplitTaskListItem: import("@milkdown/core").CmdKey<undefined>;
16
- readonly ToggleInlineCode: import("@milkdown/core").CmdKey<undefined>;
17
- readonly ToggleItalic: import("@milkdown/core").CmdKey<undefined>;
18
- readonly ToggleLink: import("@milkdown/core").CmdKey<string>;
19
- readonly ToggleBold: import("@milkdown/core").CmdKey<undefined>;
20
- readonly ModifyLink: import("@milkdown/core").CmdKey<string>;
21
- readonly ModifyImage: import("@milkdown/core").CmdKey<string>;
22
- readonly WrapInBlockquote: import("@milkdown/core").CmdKey<undefined>;
23
- readonly WrapInBulletList: import("@milkdown/core").CmdKey<undefined>;
24
- readonly WrapInOrderedList: import("@milkdown/core").CmdKey<undefined>;
25
- readonly TurnIntoCodeFence: import("@milkdown/core").CmdKey<undefined>;
26
- readonly TurnIntoHeading: import("@milkdown/core").CmdKey<number>;
27
- readonly TurnIntoText: import("@milkdown/core").CmdKey<undefined>;
28
- readonly InsertHardbreak: import("@milkdown/core").CmdKey<undefined>;
29
- readonly InsertHr: import("@milkdown/core").CmdKey<string>;
30
- readonly InsertImage: import("@milkdown/core").CmdKey<string>;
31
- readonly SplitListItem: import("@milkdown/core").CmdKey<undefined>;
32
- readonly SinkListItem: import("@milkdown/core").CmdKey<undefined>;
33
- readonly LiftListItem: import("@milkdown/core").CmdKey<undefined>;
34
- };
35
- export declare type Commands = typeof commands;
36
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAcpD,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACH,UAAU,EAEV,WAAW,EACX,WAAW,EACX,QAAQ,EACR,QAAQ,EAER,KAAK,GACR,MAAM,SAAS,CAAC;AACjB,cAAc,kBAAkB,CAAC;AACjC,OAAO,EACH,UAAU,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,UAAU,EAEV,eAAe,EACf,iBAAiB,EAEjB,GAAG,EACH,EAAE,EACF,SAAS,EACT,OAAO,EACP,EAAE,EACF,KAAK,EAEL,eAAe,EACf,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,WAAW,EACX,SAAS,EACT,YAAY,EACZ,aAAa,EACb,MAAM,EACN,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GACpB,MAAM,6BAA6B,CAAC;AAErC,eAAO,MAAM,GAAG;;iSAOd,CAAC;AAEH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;CAOX,CAAC;AACX,oBAAY,QAAQ,GAAG,OAAO,QAAQ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"strike-through.d.ts","sourceRoot":"","sources":["strike-through.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,mBAAmB,4CAAiB,CAAC;AAElD,eAAO,MAAM,aAAa;;;;EAyCxB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"supported-keys.d.ts","sourceRoot":"","sources":["supported-keys.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;CAKhB,CAAC;AACX,oBAAY,aAAa,GAAG,OAAO,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAmB,QAAQ,EAAa,MAAM,iBAAiB,CAAC;AAEhF,eAAO,MAAM,SAAS,SACX,QAAQ,KAAG,OAWjB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AACX,oBAAY,QAAQ,GAAG,OAAO,QAAQ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,aAAa;;;;CAIhB,CAAC;AACX,oBAAY,aAAa,GAAG,OAAO,aAAa,CAAC;AAIjD,eAAO,MAAM,QAAQ,4CAAiB,CAAC;AACvC,eAAO,MAAM,QAAQ,4CAAiB,CAAC;AACvC,eAAO,MAAM,UAAU,4CAAiB,CAAC;AACzC,eAAO,MAAM,WAAW,4CAAiB,CAAC;AAE1C,eAAO,MAAM,KAAK;;;;;;;;;;;;;;;;;;;;EA+IhB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["schema.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM,sCAYjB,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Utils } from '@milkdown/utils';
2
- export declare const injectStyle: (utils: Utils) => string | undefined;
3
- //# sourceMappingURL=style.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AA+CxC,eAAO,MAAM,WAAW,UAAW,KAAK,uBAwHvC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["actions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAgB,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAGH,OAAO,EAIP,UAAU,EAIb,MAAM,iBAAiB,CAAC;AAKzB,oBAAY,IAAI,GAAG;IACf,CAAC,EAAE,WAAW,CAAC;IACf,OAAO,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;CAC3C,CAAC;AAEF,oBAAY,MAAM;IACd,UAAU,IAAA;IACV,WAAW,IAAA;IACX,SAAS,IAAA;IACT,YAAY,IAAA;IACZ,SAAS,IAAA;IACT,WAAW,IAAA;IACX,UAAU,IAAA;IACV,MAAM,IAAA;CACT;AAED,eAAO,MAAM,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,MAAM,CAAC,MAAM,EAAE,IAAI,CA+E3D,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"calc-pos.d.ts","sourceRoot":"","sources":["calc-pos.ts"],"names":[],"mappings":"AAEA,OAAO,EAAwC,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEnF,eAAO,MAAM,iBAAiB,SAAU,UAAU,OAAO,WAAW,SAoBnE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["constant.ts"],"names":[],"mappings":"AAEA,oBAAY,UAAU;IAClB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;CAClB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"helper.d.ts","sourceRoot":"","sources":["helper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAY,MAAM,iBAAiB,CAAC;AAEtE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,eAAO,MAAM,gBAAgB,SAAU,UAAU,KAAG,aAAiE,CAAC;AAEtH,eAAO,MAAM,kBAAkB,cAAe,aAAa,YAmB1D,CAAC;AAEF,eAAO,MAAM,aAAa,YAAa,OAAO,MAAM,EAAE,IAAI,CAAC,QAAQ,UAAU,SAS5E,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAA4C,MAAM,EAAa,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAUxC,eAAO,MAAM,GAAG,0BAA0B,CAAC;AAE3C,eAAO,MAAM,cAAc,QAAS,GAAG,SAAS,KAAK,qBAiFpD,CAAC"}
@@ -1,3 +0,0 @@
1
- import { Emotion, ThemeTool } from '@milkdown/core';
2
- export declare const injectStyle: ({ size, mixin, palette }: ThemeTool, { css }: Emotion) => string;
3
- //# sourceMappingURL=style.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEpD,eAAO,MAAM,WAAW,6BAA8B,SAAS,WAAW,OAAO,WA8ChF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"widget.d.ts","sourceRoot":"","sources":["widget.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,GAAG,EAAgB,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,EAAE,OAAO,EAA2B,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAiBxC,wBAAgB,YAAY,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC/G,wBAAgB,YAAY,CACxB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,UAAU,CAAC,IAAI,EACpB,KAAK,EAAE,MAAM,GACd,UAAU,CAAC,oBAAoB,CAAC,CAAC;AACpC,wBAAgB,YAAY,CACxB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,OAAO,EACb,GAAG,EAAE,UAAU,CAAC,GAAG,EACnB,KAAK,EAAE,MAAM,GACd,UAAU,CAAC,oBAAoB,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["utils.ts"],"names":[],"mappings":"AACA,OAAO,EAIH,IAAI,IAAI,eAAe,EACvB,MAAM,EACN,SAAS,EAGT,SAAS,EACT,WAAW,EACd,MAAM,iBAAiB,CAAC;AAEzB,oBAAY,OAAO,GAAG;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,eAAe,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,SAAS,cAAe,SAAS,6DAC+B,CAAC;AAE9E,eAAO,MAAM,gBAAgB,gBACX,MAAM,iBACR,SAAS,KAAG,OAAO,EAAE,GAAG,SAkBnC,CAAC;AAEN,eAAO,MAAM,aAAa,aACX,MAAM,iBACL,SAAS,KAAG,OAAO,EAAE,GAAG,SAkBnC,CAAC;AAEN,eAAO,MAAM,WAAW,WAAY,MAAM,iEAgBzC,CAAC;AAEF,eAAO,MAAM,UAAU,SAAU,KAAK,GAAG,KAAK,aAAa,MAAM,UAAU,WAAW,QAuBrF,CAAC;AAEF,eAAO,MAAM,eAAe,cAAe,SAAS;;;;eAiBnD,CAAC;AAEF,eAAO,MAAM,WAAW,OAAQ,WAAW,QAQ1C,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,oBAkBtG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"task-list-item.d.ts","sourceRoot":"","sources":["task-list-item.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,aAAK,IAAI,GAAG,OAAO,CAAC,MAAM,aAAa,EAAE,cAAc,GAAG,cAAc,GAAG,cAAc,GAAG,UAAU,CAAC,CAAC;AAExG,eAAO,MAAM,iBAAiB,4CAAiB,CAAC;AAChD,eAAO,MAAM,gBAAgB,4CAAiB,CAAC;AAC/C,eAAO,MAAM,gBAAgB,4CAAiB,CAAC;AAC/C,eAAO,MAAM,gBAAgB,4CAAiB,CAAC;AAE/C,eAAO,MAAM,YAAY;;;;EAuMvB,CAAC"}
@@ -1,170 +0,0 @@
1
- /* Copyright 2021, Milkdown by Mirone. */
2
- import { Emotion } from '@milkdown/design-system';
3
- import { Utils } from '@milkdown/utils';
4
-
5
- const proseTableStyle = ({ css }: Emotion) => css`
6
- /* copy from https://github.com/ProseMirror/prosemirror-tables/blob/master/style/tables.css */
7
- .ProseMirror .tableWrapper {
8
- overflow-x: auto;
9
- }
10
- .ProseMirror table {
11
- border-collapse: collapse;
12
- table-layout: fixed;
13
- width: 100%;
14
- overflow: hidden;
15
- }
16
- .ProseMirror td,
17
- .ProseMirror th {
18
- vertical-align: top;
19
- box-sizing: border-box;
20
- position: relative;
21
- }
22
- .ProseMirror .column-resize-handle {
23
- position: absolute;
24
- right: -2px;
25
- top: 0;
26
- bottom: 0;
27
- width: 4px;
28
- z-index: 20;
29
- background-color: #adf;
30
- pointer-events: none;
31
- }
32
- .ProseMirror.resize-cursor {
33
- cursor: ew-resize;
34
- cursor: col-resize;
35
- }
36
- /* Give selected cells a blue overlay */
37
- .ProseMirror .selectedCell:after {
38
- z-index: 2;
39
- position: absolute;
40
- content: '';
41
- left: 0;
42
- right: 0;
43
- top: 0;
44
- bottom: 0;
45
- background: rgba(200, 200, 255, 0.4);
46
- pointer-events: none;
47
- }
48
- `;
49
-
50
- export const injectStyle = (utils: Utils) => {
51
- return utils.getStyle(({ size, palette, mixin }, emotion) => {
52
- const css = emotion.injectGlobal;
53
- css`
54
- ${proseTableStyle(emotion)}
55
-
56
- .tableWrapper {
57
- margin: 0 !important;
58
-
59
- ${mixin.scrollbar?.('x')};
60
-
61
- width: 100%;
62
-
63
- table {
64
- width: calc(100% - 2rem) !important;
65
- border-radius: ${size.radius};
66
- box-sizing: border-box;
67
- margin: 1rem 0 1rem 1rem !important;
68
- overflow: auto !important;
69
- * {
70
- margin: 0 !important;
71
- box-sizing: border-box;
72
- font-size: 1rem;
73
- }
74
- tr {
75
- ${mixin.border?.('bottom')};
76
- }
77
-
78
- th {
79
- background: ${palette('background', 0.5)};
80
- font-weight: 400;
81
- }
82
-
83
- th,
84
- td {
85
- min-width: 100px;
86
- ${mixin.border?.()};
87
- text-align: left;
88
- position: relative;
89
- line-height: 3rem;
90
- box-sizing: border-box;
91
- height: 3rem;
92
- }
93
-
94
- .selectedCell {
95
- &::after {
96
- background: ${palette('secondary', 0.38)};
97
- }
98
- & ::selection {
99
- background: transparent;
100
- }
101
- }
102
-
103
- .column-resize-handle {
104
- background: ${palette('primary')};
105
- width: ${size.lineWidth};
106
- }
107
-
108
- th,
109
- td {
110
- padding: 0 1rem;
111
- p {
112
- line-height: unset !important;
113
- }
114
- }
115
-
116
- .milkdown-cell-left,
117
- .milkdown-cell-point,
118
- .milkdown-cell-top {
119
- position: absolute;
120
-
121
- &::after {
122
- cursor: pointer;
123
- position: absolute;
124
- top: 0;
125
- left: 0;
126
- height: 100%;
127
- width: 100%;
128
- display: block;
129
- transition: all 0.2s ease-in-out;
130
- background: ${palette('secondary', 0.12)};
131
- content: '';
132
- }
133
- &:hover::after {
134
- background: ${palette('secondary', 0.38)};
135
- }
136
- }
137
-
138
- .milkdown-cell-left {
139
- left: calc(-6px - 0.5rem);
140
- top: 0;
141
- bottom: 0;
142
- width: 0.5rem;
143
- }
144
-
145
- .milkdown-cell-top {
146
- left: 0;
147
- right: 0;
148
- top: calc(-6px - 0.5rem);
149
- height: 0.5rem;
150
- }
151
-
152
- .milkdown-cell-point {
153
- left: calc(-2px - 1rem);
154
- top: calc(-2px - 1rem);
155
- width: 1rem;
156
- height: 1rem;
157
-
158
- .icon {
159
- position: absolute;
160
- top: 0;
161
- bottom: 0;
162
- left: 0;
163
- right: 0;
164
- }
165
- }
166
- }
167
- }
168
- `;
169
- });
170
- };