xtralab 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.
Files changed (56) hide show
  1. package/LICENSE +28 -0
  2. package/README.md +69 -0
  3. package/lib/fileBrowser/commands.d.ts +62 -0
  4. package/lib/fileBrowser/commands.js +418 -0
  5. package/lib/fileBrowser/contents.d.ts +28 -0
  6. package/lib/fileBrowser/contents.js +48 -0
  7. package/lib/fileBrowser/fileBrowser.d.ts +24 -0
  8. package/lib/fileBrowser/fileBrowser.js +535 -0
  9. package/lib/fileBrowser/icons.d.ts +37 -0
  10. package/lib/fileBrowser/icons.js +153 -0
  11. package/lib/fileBrowser/index.d.ts +7 -0
  12. package/lib/fileBrowser/index.js +38 -0
  13. package/lib/fileBrowser/widget.d.ts +97 -0
  14. package/lib/fileBrowser/widget.js +95 -0
  15. package/lib/git/api.d.ts +39 -0
  16. package/lib/git/api.js +164 -0
  17. package/lib/git/commands.d.ts +69 -0
  18. package/lib/git/commands.js +67 -0
  19. package/lib/git/diffWidget.d.ts +108 -0
  20. package/lib/git/diffWidget.js +624 -0
  21. package/lib/git/icons.d.ts +14 -0
  22. package/lib/git/icons.js +19 -0
  23. package/lib/git/index.d.ts +11 -0
  24. package/lib/git/index.js +74 -0
  25. package/lib/git/notebookDiff.d.ts +176 -0
  26. package/lib/git/notebookDiff.js +805 -0
  27. package/lib/git/panel.d.ts +29 -0
  28. package/lib/git/panel.js +42 -0
  29. package/lib/git/panelComponent.d.ts +26 -0
  30. package/lib/git/panelComponent.js +300 -0
  31. package/lib/git/tokens.d.ts +78 -0
  32. package/lib/git/tokens.js +6 -0
  33. package/lib/index.d.ts +10 -0
  34. package/lib/index.js +14 -0
  35. package/package.json +216 -0
  36. package/schema/plugin.json +67 -0
  37. package/src/fileBrowser/commands.ts +507 -0
  38. package/src/fileBrowser/contents.ts +66 -0
  39. package/src/fileBrowser/fileBrowser.tsx +635 -0
  40. package/src/fileBrowser/icons.ts +172 -0
  41. package/src/fileBrowser/index.ts +56 -0
  42. package/src/fileBrowser/widget.tsx +202 -0
  43. package/src/git/api.ts +207 -0
  44. package/src/git/commands.ts +143 -0
  45. package/src/git/diffWidget.tsx +903 -0
  46. package/src/git/icons.ts +20 -0
  47. package/src/git/index.ts +109 -0
  48. package/src/git/notebookDiff.tsx +1294 -0
  49. package/src/git/panel.tsx +56 -0
  50. package/src/git/panelComponent.tsx +558 -0
  51. package/src/git/tokens.ts +91 -0
  52. package/src/index.ts +18 -0
  53. package/style/base.css +175 -0
  54. package/style/git.css +770 -0
  55. package/style/index.css +2 -0
  56. package/style/index.js +2 -0
package/src/index.ts ADDED
@@ -0,0 +1,18 @@
1
+ import { JupyterFrontEndPlugin } from '@jupyterlab/application';
2
+
3
+ import fileBrowserPlugin from './fileBrowser';
4
+ import gitPlugin from './git';
5
+
6
+ /**
7
+ * Every plugin contributed by `xtralab`. The entry point of the
8
+ * labextension is an array because the package bundles several independent
9
+ * enhancements (file browser, git changes panel, …) — JupyterLab activates
10
+ * each plugin individually and only the ones whose required tokens are
11
+ * available end up running.
12
+ */
13
+ const plugins: JupyterFrontEndPlugin<unknown>[] = [
14
+ fileBrowserPlugin,
15
+ gitPlugin
16
+ ];
17
+
18
+ export default plugins;
package/style/base.css ADDED
@@ -0,0 +1,175 @@
1
+ /*
2
+ See the JupyterLab Developer Guide for useful CSS Patterns:
3
+
4
+ https://jupyterlab.readthedocs.io/en/stable/developer/css.html
5
+ */
6
+
7
+ .jp-xtralab-FileBrowser {
8
+ display: flex;
9
+ flex-direction: column;
10
+ min-width: 200px;
11
+ overflow: hidden;
12
+ background-color: var(--jp-layout-color1);
13
+
14
+ /*
15
+ * Map @pierre/trees CSS variables to the active JupyterLab theme. The
16
+ * `*-override` variants take precedence over the library's defaults, so
17
+ * these values track the JupyterLab theme automatically — no JS needed
18
+ * when the theme switches.
19
+ */
20
+ --trees-bg-override: var(--jp-layout-color1);
21
+ --trees-bg-muted-override: var(--jp-layout-color2);
22
+ --trees-fg-override: var(--jp-ui-font-color1);
23
+ --trees-fg-muted-override: var(--jp-ui-font-color2);
24
+ --trees-accent-override: var(--jp-brand-color1);
25
+ --trees-border-color-override: var(--jp-border-color2);
26
+ --trees-indent-guide-bg-override: var(--jp-border-color3);
27
+ --trees-input-bg-override: var(--jp-input-background);
28
+ --trees-search-bg-override: var(--jp-input-background);
29
+ --trees-search-fg-override: var(--jp-ui-font-color1);
30
+ --trees-focus-ring-color-override: var(--jp-brand-color1);
31
+ --trees-selected-bg-override: var(--jp-brand-color1);
32
+ --trees-selected-fg-override: var(--jp-ui-inverse-font-color1);
33
+ --trees-selected-focused-border-color-override: var(--jp-brand-color1);
34
+ --trees-font-family-override: var(--jp-ui-font-family);
35
+ --trees-font-size-override: var(--jp-ui-font-size1);
36
+
37
+ /*
38
+ * Push the search box, the scroll wrapper, and every row inside the
39
+ * tree away from the sidebar edge. `--trees-padding-inline` is the
40
+ * outer gutter the @pierre/trees host uses for the search box and the
41
+ * scroll container, and the row strip sits inside that gutter — so
42
+ * matching the 12px the JupyterLab toolbar uses on its sides keeps
43
+ * the toolbar buttons, the search bar, and the row hover/selection
44
+ * highlights vertically aligned. Row content padding stays at the
45
+ * default 4px so the icon → text rhythm doesn't change.
46
+ */
47
+ --trees-padding-inline-override: 12px;
48
+ --trees-item-padding-x-override: 4px;
49
+
50
+ /* Must carry a length unit. The library subtracts this from
51
+ `--trees-padding-inline` inside a `calc()`; a unitless `0` makes the
52
+ subtraction type-invalid, the whole padding-inline rule drops out,
53
+ and the rows snap back to the sidebar edge. */
54
+ --trees-item-margin-x-override: 0px;
55
+ }
56
+
57
+ /*
58
+ * Match the spacing the default file browser uses around its top toolbar
59
+ * (8px above, 12px on each side, flush with the content below). Without
60
+ * this, the toolbar inherits jp-Toolbar's default border + padding which
61
+ * looks heavier than the rest of the JupyterLab sidebar.
62
+ */
63
+ .jp-xtralab-FileBrowser-toolbar.jp-Toolbar {
64
+ flex: 0 0 auto;
65
+ height: auto;
66
+ margin: 8px 12px 0;
67
+ padding: 0;
68
+ border-bottom: none;
69
+ box-shadow: none;
70
+ }
71
+
72
+ .jp-xtralab-FileBrowser-toolbar.jp-Toolbar::part(positioning-region) {
73
+ row-gap: 12px;
74
+ }
75
+
76
+ .jp-xtralab-FileBrowser-toolbar > .jp-Toolbar-item {
77
+ flex: 0 0 auto;
78
+ padding-left: 0;
79
+ align-items: center;
80
+ height: unset;
81
+ }
82
+
83
+ .jp-xtralab-FileBrowser-toolbar
84
+ > .jp-Toolbar-item
85
+ .jp-ToolbarButtonComponent {
86
+ width: 28px;
87
+ }
88
+
89
+ /*
90
+ * Promote the "new launcher" button to the same blue, wider call-to-action
91
+ * the default file browser uses for `launcher:create`. The selectors mirror
92
+ * the rules in `@jupyterlab/launcher-extension/style/base.css`, but target
93
+ * our own command id and toolbar wrapper class.
94
+ */
95
+ .jp-xtralab-FileBrowser-toolbar
96
+ > .jp-Toolbar-item
97
+ .jp-ToolbarButtonComponent[data-command='xtralab:new-launcher'] {
98
+ width: 72px;
99
+ background: var(--jp-accept-color-normal, var(--jp-brand-color1));
100
+ }
101
+
102
+ .jp-xtralab-FileBrowser-toolbar
103
+ > .jp-Toolbar-item
104
+ .jp-ToolbarButtonComponent[data-command='xtralab:new-launcher']:hover {
105
+ background-color: var(--jp-accept-color-hover);
106
+ }
107
+
108
+ .jp-xtralab-FileBrowser-toolbar
109
+ > .jp-Toolbar-item
110
+ .jp-ToolbarButtonComponent[data-command='xtralab:new-launcher']:focus-visible {
111
+ background-color: var(--jp-accept-color-active, var(--jp-brand-color0));
112
+ }
113
+
114
+ .jp-xtralab-FileBrowser-toolbar
115
+ > .jp-Toolbar-item
116
+ .jp-ToolbarButtonComponent[data-command='xtralab:new-launcher']
117
+ .jp-icon3 {
118
+ fill: var(--jp-layout-color1);
119
+ }
120
+
121
+ .jp-xtralab-FileBrowser-content {
122
+ flex: 1 1 auto;
123
+ display: flex;
124
+ min-height: 0;
125
+ }
126
+
127
+ .jp-xtralab-FileBrowser-content > div {
128
+ flex: 1 1 auto;
129
+ display: flex;
130
+ min-height: 0;
131
+ }
132
+
133
+ .jp-xtralab-FileBrowser file-tree-container {
134
+ flex: 1 1 auto;
135
+ min-height: 0;
136
+ }
137
+
138
+ /*
139
+ * Drag image shown next to the cursor while dragging files out of the
140
+ * tree. Mirrors the visual weight of the default file browser's drag
141
+ * preview without depending on its DOM.
142
+ */
143
+ .jp-xtralab-DragImage {
144
+ position: absolute;
145
+ display: flex;
146
+ align-items: center;
147
+ gap: 4px;
148
+ padding: 2px 6px;
149
+ background-color: var(--jp-layout-color1);
150
+ border: 1px solid var(--jp-border-color2);
151
+ border-radius: 2px;
152
+ color: var(--jp-ui-font-color1);
153
+ font-family: var(--jp-ui-font-family);
154
+ font-size: var(--jp-ui-font-size1);
155
+ pointer-events: none;
156
+ }
157
+
158
+ .jp-xtralab-DragImage-icon {
159
+ display: inline-flex;
160
+ align-items: center;
161
+ }
162
+
163
+ .jp-xtralab-DragImage-count {
164
+ display: inline-flex;
165
+ align-items: center;
166
+ justify-content: center;
167
+ min-width: 16px;
168
+ height: 16px;
169
+ padding: 0 4px;
170
+ background-color: var(--jp-brand-color1);
171
+ border-radius: 8px;
172
+ color: var(--jp-ui-inverse-font-color1);
173
+ font-size: var(--jp-ui-font-size0);
174
+ line-height: 1;
175
+ }