@kapeta/local-cluster-service 0.30.1 → 0.31.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.
- package/CHANGELOG.md +7 -0
- package/dist/cjs/src/filesystem/routes.js +16 -0
- package/dist/cjs/src/filesystemManager.d.ts +4 -0
- package/dist/cjs/src/filesystemManager.js +14 -0
- package/dist/esm/src/filesystem/routes.js +16 -0
- package/dist/esm/src/filesystemManager.d.ts +4 -0
- package/dist/esm/src/filesystemManager.js +14 -0
- package/package.json +1 -1
- package/src/filesystem/routes.ts +22 -0
- package/src/filesystemManager.ts +18 -0
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
# [0.31.0](https://github.com/kapetacom/local-cluster-service/compare/v0.30.1...v0.31.0) (2023-12-18)
|
2
|
+
|
3
|
+
|
4
|
+
### Features
|
5
|
+
|
6
|
+
* Get/set pixel grid settings ([538b63a](https://github.com/kapetacom/local-cluster-service/commit/538b63a7039d29b24a50c2d37063fe90465bad36))
|
7
|
+
|
1
8
|
## [0.30.1](https://github.com/kapetacom/local-cluster-service/compare/v0.30.0...v0.30.1) (2023-12-18)
|
2
9
|
|
3
10
|
|
@@ -40,6 +40,22 @@ router.post('/release-channel', (req, res) => {
|
|
40
40
|
filesystemManager_1.filesystemManager.setReleaseChannel(req.stringBody ?? '');
|
41
41
|
res.sendStatus(204);
|
42
42
|
});
|
43
|
+
router.get('/show-pixel-grid', (req, res) => {
|
44
|
+
res.send(filesystemManager_1.filesystemManager.getShowPixelGrid());
|
45
|
+
});
|
46
|
+
router.use('/show-pixel-grid', stringBody_1.stringBody);
|
47
|
+
router.post('/show-pixel-grid', (req, res) => {
|
48
|
+
filesystemManager_1.filesystemManager.setShowPixelGrid(req?.stringBody === 'true' ?? false);
|
49
|
+
res.sendStatus(204);
|
50
|
+
});
|
51
|
+
router.get('/snap-to-pixel-grid', (req, res) => {
|
52
|
+
res.send(filesystemManager_1.filesystemManager.getSnapToPixelGrid());
|
53
|
+
});
|
54
|
+
router.use('/snap-to-pixel-grid', stringBody_1.stringBody);
|
55
|
+
router.post('/snap-to-pixel-grid', (req, res) => {
|
56
|
+
filesystemManager_1.filesystemManager.setSnapToPixelGrid(req?.stringBody === 'true' ?? false);
|
57
|
+
res.sendStatus(204);
|
58
|
+
});
|
43
59
|
router.use('/', (req, res, next) => {
|
44
60
|
if (!req.query.path) {
|
45
61
|
res.status(400).send({ error: 'Missing required query parameter "path"' });
|
@@ -18,6 +18,10 @@ declare class FilesystemManager {
|
|
18
18
|
setEditor(editor: string): void;
|
19
19
|
getReleaseChannel(): string | undefined;
|
20
20
|
setReleaseChannel(channel: string): void;
|
21
|
+
getShowPixelGrid(): boolean | undefined;
|
22
|
+
setShowPixelGrid(show: boolean): void;
|
23
|
+
getSnapToPixelGrid(): boolean | undefined;
|
24
|
+
setSnapToPixelGrid(snap: boolean): void;
|
21
25
|
}
|
22
26
|
export declare const filesystemManager: FilesystemManager;
|
23
27
|
export {};
|
@@ -16,6 +16,8 @@ const SECTION_ID = 'filesystem';
|
|
16
16
|
const PROJECT_ROOT = 'project_root';
|
17
17
|
const EDITOR = 'editor';
|
18
18
|
const RELEASE_CHANNEL = 'release_channel';
|
19
|
+
const SHOW_PIXEL_GRID = 'show_pixel_grid';
|
20
|
+
const SNAP_TO_PIXEL_GRID = 'snap_to_pixel_grid';
|
19
21
|
function isFile(path) {
|
20
22
|
try {
|
21
23
|
return fs_1.default.statSync(path).isFile();
|
@@ -100,5 +102,17 @@ class FilesystemManager {
|
|
100
102
|
setReleaseChannel(channel) {
|
101
103
|
storageService_1.storageService.put('app', RELEASE_CHANNEL, channel);
|
102
104
|
}
|
105
|
+
getShowPixelGrid() {
|
106
|
+
return storageService_1.storageService.get('app', SHOW_PIXEL_GRID, false);
|
107
|
+
}
|
108
|
+
setShowPixelGrid(show) {
|
109
|
+
storageService_1.storageService.put('app', SHOW_PIXEL_GRID, show);
|
110
|
+
}
|
111
|
+
getSnapToPixelGrid() {
|
112
|
+
return storageService_1.storageService.get('app', SNAP_TO_PIXEL_GRID, false);
|
113
|
+
}
|
114
|
+
setSnapToPixelGrid(snap) {
|
115
|
+
storageService_1.storageService.put('app', SNAP_TO_PIXEL_GRID, snap);
|
116
|
+
}
|
103
117
|
}
|
104
118
|
exports.filesystemManager = new FilesystemManager();
|
@@ -40,6 +40,22 @@ router.post('/release-channel', (req, res) => {
|
|
40
40
|
filesystemManager_1.filesystemManager.setReleaseChannel(req.stringBody ?? '');
|
41
41
|
res.sendStatus(204);
|
42
42
|
});
|
43
|
+
router.get('/show-pixel-grid', (req, res) => {
|
44
|
+
res.send(filesystemManager_1.filesystemManager.getShowPixelGrid());
|
45
|
+
});
|
46
|
+
router.use('/show-pixel-grid', stringBody_1.stringBody);
|
47
|
+
router.post('/show-pixel-grid', (req, res) => {
|
48
|
+
filesystemManager_1.filesystemManager.setShowPixelGrid(req?.stringBody === 'true' ?? false);
|
49
|
+
res.sendStatus(204);
|
50
|
+
});
|
51
|
+
router.get('/snap-to-pixel-grid', (req, res) => {
|
52
|
+
res.send(filesystemManager_1.filesystemManager.getSnapToPixelGrid());
|
53
|
+
});
|
54
|
+
router.use('/snap-to-pixel-grid', stringBody_1.stringBody);
|
55
|
+
router.post('/snap-to-pixel-grid', (req, res) => {
|
56
|
+
filesystemManager_1.filesystemManager.setSnapToPixelGrid(req?.stringBody === 'true' ?? false);
|
57
|
+
res.sendStatus(204);
|
58
|
+
});
|
43
59
|
router.use('/', (req, res, next) => {
|
44
60
|
if (!req.query.path) {
|
45
61
|
res.status(400).send({ error: 'Missing required query parameter "path"' });
|
@@ -18,6 +18,10 @@ declare class FilesystemManager {
|
|
18
18
|
setEditor(editor: string): void;
|
19
19
|
getReleaseChannel(): string | undefined;
|
20
20
|
setReleaseChannel(channel: string): void;
|
21
|
+
getShowPixelGrid(): boolean | undefined;
|
22
|
+
setShowPixelGrid(show: boolean): void;
|
23
|
+
getSnapToPixelGrid(): boolean | undefined;
|
24
|
+
setSnapToPixelGrid(snap: boolean): void;
|
21
25
|
}
|
22
26
|
export declare const filesystemManager: FilesystemManager;
|
23
27
|
export {};
|
@@ -16,6 +16,8 @@ const SECTION_ID = 'filesystem';
|
|
16
16
|
const PROJECT_ROOT = 'project_root';
|
17
17
|
const EDITOR = 'editor';
|
18
18
|
const RELEASE_CHANNEL = 'release_channel';
|
19
|
+
const SHOW_PIXEL_GRID = 'show_pixel_grid';
|
20
|
+
const SNAP_TO_PIXEL_GRID = 'snap_to_pixel_grid';
|
19
21
|
function isFile(path) {
|
20
22
|
try {
|
21
23
|
return fs_1.default.statSync(path).isFile();
|
@@ -100,5 +102,17 @@ class FilesystemManager {
|
|
100
102
|
setReleaseChannel(channel) {
|
101
103
|
storageService_1.storageService.put('app', RELEASE_CHANNEL, channel);
|
102
104
|
}
|
105
|
+
getShowPixelGrid() {
|
106
|
+
return storageService_1.storageService.get('app', SHOW_PIXEL_GRID, false);
|
107
|
+
}
|
108
|
+
setShowPixelGrid(show) {
|
109
|
+
storageService_1.storageService.put('app', SHOW_PIXEL_GRID, show);
|
110
|
+
}
|
111
|
+
getSnapToPixelGrid() {
|
112
|
+
return storageService_1.storageService.get('app', SNAP_TO_PIXEL_GRID, false);
|
113
|
+
}
|
114
|
+
setSnapToPixelGrid(snap) {
|
115
|
+
storageService_1.storageService.put('app', SNAP_TO_PIXEL_GRID, snap);
|
116
|
+
}
|
103
117
|
}
|
104
118
|
exports.filesystemManager = new FilesystemManager();
|
package/package.json
CHANGED
package/src/filesystem/routes.ts
CHANGED
@@ -50,6 +50,28 @@ router.post('/release-channel', (req: StringBodyRequest, res: Response) => {
|
|
50
50
|
res.sendStatus(204);
|
51
51
|
});
|
52
52
|
|
53
|
+
router.get('/show-pixel-grid', (req: Request, res: Response) => {
|
54
|
+
res.send(filesystemManager.getShowPixelGrid());
|
55
|
+
});
|
56
|
+
|
57
|
+
router.use('/show-pixel-grid', stringBody);
|
58
|
+
|
59
|
+
router.post('/show-pixel-grid', (req: StringBodyRequest, res: Response) => {
|
60
|
+
filesystemManager.setShowPixelGrid(req?.stringBody === 'true' ?? false);
|
61
|
+
res.sendStatus(204);
|
62
|
+
});
|
63
|
+
|
64
|
+
router.get('/snap-to-pixel-grid', (req: Request, res: Response) => {
|
65
|
+
res.send(filesystemManager.getSnapToPixelGrid());
|
66
|
+
});
|
67
|
+
|
68
|
+
router.use('/snap-to-pixel-grid', stringBody);
|
69
|
+
|
70
|
+
router.post('/snap-to-pixel-grid', (req: StringBodyRequest, res: Response) => {
|
71
|
+
filesystemManager.setSnapToPixelGrid(req?.stringBody === 'true' ?? false);
|
72
|
+
res.sendStatus(204);
|
73
|
+
});
|
74
|
+
|
53
75
|
router.use('/', (req: Request, res: Response, next: NextFunction) => {
|
54
76
|
if (!req.query.path) {
|
55
77
|
res.status(400).send({ error: 'Missing required query parameter "path"' });
|
package/src/filesystemManager.ts
CHANGED
@@ -12,6 +12,8 @@ const SECTION_ID = 'filesystem';
|
|
12
12
|
const PROJECT_ROOT = 'project_root';
|
13
13
|
const EDITOR = 'editor';
|
14
14
|
const RELEASE_CHANNEL = 'release_channel';
|
15
|
+
const SHOW_PIXEL_GRID = 'show_pixel_grid';
|
16
|
+
const SNAP_TO_PIXEL_GRID = 'snap_to_pixel_grid';
|
15
17
|
|
16
18
|
function isFile(path: string) {
|
17
19
|
try {
|
@@ -110,6 +112,22 @@ class FilesystemManager {
|
|
110
112
|
setReleaseChannel(channel: string) {
|
111
113
|
storageService.put('app', RELEASE_CHANNEL, channel);
|
112
114
|
}
|
115
|
+
|
116
|
+
getShowPixelGrid() {
|
117
|
+
return storageService.get<boolean>('app', SHOW_PIXEL_GRID, false);
|
118
|
+
}
|
119
|
+
|
120
|
+
setShowPixelGrid(show: boolean) {
|
121
|
+
storageService.put('app', SHOW_PIXEL_GRID, show);
|
122
|
+
}
|
123
|
+
|
124
|
+
getSnapToPixelGrid() {
|
125
|
+
return storageService.get<boolean>('app', SNAP_TO_PIXEL_GRID, false);
|
126
|
+
}
|
127
|
+
|
128
|
+
setSnapToPixelGrid(snap: boolean) {
|
129
|
+
storageService.put('app', SNAP_TO_PIXEL_GRID, snap);
|
130
|
+
}
|
113
131
|
}
|
114
132
|
|
115
133
|
export const filesystemManager = new FilesystemManager();
|