@kerebron/extension-dev-toolkit 0.4.27 → 0.4.29

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.
package/esm/mod.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { CommandFactories, type CoreEditor, Extension } from '@kerebron/editor';
2
+ import { CommandShortcuts } from '@kerebron/editor/commands';
3
+ export interface DevToolkitConfig {
4
+ }
5
+ export declare class ExtensionDevToolkit extends Extension {
6
+ protected config: DevToolkitConfig;
7
+ name: string;
8
+ private visible;
9
+ constructor(config?: DevToolkitConfig);
10
+ getCommandFactories(editor: CoreEditor): Partial<CommandFactories>;
11
+ getKeyboardShortcuts(): Partial<CommandShortcuts>;
12
+ }
13
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,KAAK,UAAU,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAG7D,MAAM,WAAW,gBAAgB;CAChC;AAED,qBAAa,mBAAoB,SAAQ,SAAS;cAKjB,MAAM,EAAE,gBAAgB;IAJvD,IAAI,SAAiB;IAErB,OAAO,CAAC,OAAO,CAAS;gBAEO,MAAM,GAAE,gBAAqB;IAInD,mBAAmB,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkBlE,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAM3D"}
package/esm/mod.js ADDED
@@ -0,0 +1,37 @@
1
+ import { applyDevTools, removeDevTools } from 'prosemirror-dev-toolkit';
2
+ import { Extension } from '@kerebron/editor';
3
+ import { EditorView } from 'prosemirror-view';
4
+ export class ExtensionDevToolkit extends Extension {
5
+ config;
6
+ name = 'dev_toolkit';
7
+ visible = false;
8
+ constructor(config = {}) {
9
+ super(config);
10
+ this.config = config;
11
+ }
12
+ getCommandFactories(editor) {
13
+ const commands = {
14
+ toggleDevToolkit: () => () => {
15
+ if (this.visible) {
16
+ removeDevTools();
17
+ this.visible = !this.visible;
18
+ }
19
+ else {
20
+ if (editor.view instanceof EditorView) {
21
+ applyDevTools(editor.view, { devToolsExpanded: true });
22
+ this.visible = !this.visible;
23
+ }
24
+ }
25
+ return true;
26
+ },
27
+ };
28
+ return commands;
29
+ }
30
+ getKeyboardShortcuts() {
31
+ const shortcuts = {
32
+ 'Ctrl-`': 'toggleDevToolkit',
33
+ };
34
+ return shortcuts;
35
+ }
36
+ }
37
+ //# sourceMappingURL=mod.js.map
package/esm/mod.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,EAAqC,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEhF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAK9C,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAKjB;IAJ/B,IAAI,GAAG,aAAa,CAAC;IAEb,OAAO,GAAG,KAAK,CAAC;IAExB,YAA+B,SAA2B,EAAE;QAC1D,KAAK,CAAC,MAAM,CAAC,CAAC;QADe,WAAM,GAAN,MAAM,CAAuB;IAE5D,CAAC;IAEQ,mBAAmB,CAAC,MAAkB;QAC7C,MAAM,QAAQ,GAAqB;YACjC,gBAAgB,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE;gBAC3B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;oBACjB,cAAc,EAAE,CAAC;oBACjB,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;gBAC/B,CAAC;qBAAM,CAAC;oBACN,IAAI,MAAM,CAAC,IAAI,YAAY,UAAU,EAAE,CAAC;wBACtC,aAAa,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC,CAAC;wBACvD,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;oBAC/B,CAAC;gBACH,CAAC;gBACD,OAAO,IAAI,CAAC;YACd,CAAC;SACF,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IAEQ,oBAAoB;QAC3B,MAAM,SAAS,GAAqB;YAClC,QAAQ,EAAE,kBAAkB;SAC7B,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "module"
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kerebron/extension-dev-toolkit",
3
- "version": "0.4.27",
3
+ "version": "0.4.29",
4
4
  "license": "MIT",
5
5
  "module": "./esm/mod.js",
6
6
  "exports": {
@@ -9,9 +9,12 @@
9
9
  }
10
10
  },
11
11
  "scripts": {},
12
- "files": [],
12
+ "files": [
13
+ "esm",
14
+ "src"
15
+ ],
13
16
  "dependencies": {
14
- "@kerebron/editor": "0.4.27",
17
+ "@kerebron/editor": "0.4.29",
15
18
  "prosemirror-dev-toolkit": "1.1.8",
16
19
  "prosemirror-view": "1.40.0"
17
20
  },
package/src/mod.ts ADDED
@@ -0,0 +1,43 @@
1
+ import { applyDevTools, removeDevTools } from 'prosemirror-dev-toolkit';
2
+
3
+ import { CommandFactories, type CoreEditor, Extension } from '@kerebron/editor';
4
+ import { CommandShortcuts } from '@kerebron/editor/commands';
5
+ import { EditorView } from 'prosemirror-view';
6
+
7
+ export interface DevToolkitConfig {
8
+ }
9
+
10
+ export class ExtensionDevToolkit extends Extension {
11
+ name = 'dev_toolkit';
12
+
13
+ private visible = false;
14
+
15
+ constructor(protected override config: DevToolkitConfig = {}) {
16
+ super(config);
17
+ }
18
+
19
+ override getCommandFactories(editor: CoreEditor): Partial<CommandFactories> {
20
+ const commands: CommandFactories = {
21
+ toggleDevToolkit: () => () => {
22
+ if (this.visible) {
23
+ removeDevTools();
24
+ this.visible = !this.visible;
25
+ } else {
26
+ if (editor.view instanceof EditorView) {
27
+ applyDevTools(editor.view, { devToolsExpanded: true });
28
+ this.visible = !this.visible;
29
+ }
30
+ }
31
+ return true;
32
+ },
33
+ };
34
+ return commands;
35
+ }
36
+
37
+ override getKeyboardShortcuts(): Partial<CommandShortcuts> {
38
+ const shortcuts: CommandShortcuts = {
39
+ 'Ctrl-`': 'toggleDevToolkit',
40
+ };
41
+ return shortcuts;
42
+ }
43
+ }