@bridgebrew/rail 0.0.0-stage → 0.0.1
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/LICENSE +21 -0
- package/browser/browser.tsx +1472 -0
- package/browser/order.ts +39 -0
- package/browser/tsconfig.json +15 -0
- package/package.json +38 -4
- package/tsconfig.json +1 -0
- package/README.md +0 -3
package/browser/order.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// The rail's order (SPEC multi-instance CAP-4): the tiles the user arranged, in that order, then the tiles new to it,
|
|
2
|
+
// appended at the end; the tiles taken off the rail left out.
|
|
3
|
+
|
|
4
|
+
const browserOrderKey = 'bridge.workspaceRail.order';
|
|
5
|
+
|
|
6
|
+
/** Local to this browser and Bridge origin; blocked or invalid storage uses the default order. */
|
|
7
|
+
export function readBrowserOrder(): string[] {
|
|
8
|
+
try {
|
|
9
|
+
const stored: unknown = JSON.parse(localStorage.getItem(browserOrderKey) ?? '[]');
|
|
10
|
+
return Array.isArray(stored) && stored.every((key) => typeof key === 'string')
|
|
11
|
+
? [...new Set(stored)]
|
|
12
|
+
: [];
|
|
13
|
+
} catch {
|
|
14
|
+
return [];
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** A blocked store still lets the rail be arranged for this page. */
|
|
19
|
+
export function writeBrowserOrder(order: readonly string[]): boolean {
|
|
20
|
+
try {
|
|
21
|
+
localStorage.setItem(browserOrderKey, JSON.stringify(order));
|
|
22
|
+
return true;
|
|
23
|
+
} catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** `present`'s keys in `order`'s order, those `order` lacks after them (in `present`'s order), `removed` left out. */
|
|
29
|
+
export function arrange(
|
|
30
|
+
order: readonly string[],
|
|
31
|
+
present: readonly string[],
|
|
32
|
+
removed: readonly string[] = [],
|
|
33
|
+
) {
|
|
34
|
+
const here = new Set(present);
|
|
35
|
+
const known = order.filter((key) => here.has(key));
|
|
36
|
+
const seen = new Set(known);
|
|
37
|
+
const off = new Set(removed);
|
|
38
|
+
return [...known, ...present.filter((key) => !seen.has(key))].filter((key) => !off.has(key));
|
|
39
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"//": "The page (its tests are typed with the tests project): its services through the Bridge checkout this repository links (../../bridge), the contracts of the plugins it uses from their folders here.",
|
|
3
|
+
"extends": "../.bridge/tsconfig.browser.json",
|
|
4
|
+
"include": [
|
|
5
|
+
".",
|
|
6
|
+
"../../bridge/packages/browser-boot/src/workspace.d.ts",
|
|
7
|
+
"../../bridge/vendor/types/client-build-environment.d.ts",
|
|
8
|
+
"../../shell/browser/shell.d.ts",
|
|
9
|
+
"../../commands/browser/commands.d.ts"
|
|
10
|
+
],
|
|
11
|
+
"exclude": [
|
|
12
|
+
"./**/*.test.ts",
|
|
13
|
+
"./**/*.test.tsx"
|
|
14
|
+
]
|
|
15
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridgebrew/rail",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "The column of workspace tiles, with the Bridge button and its status dot.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"bridge-plugin"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"files": [
|
|
11
|
+
"*.json",
|
|
12
|
+
"browser/",
|
|
13
|
+
"!**/*.test.ts",
|
|
14
|
+
"!**/*.test.tsx"
|
|
15
|
+
],
|
|
16
|
+
"bridge": {
|
|
17
|
+
"kind": "extension",
|
|
18
|
+
"category": "standard",
|
|
19
|
+
"title": "Workspace rail",
|
|
20
|
+
"icon": "layout-dashboard",
|
|
21
|
+
"domain": "interface",
|
|
22
|
+
"browser": "./browser/browser.tsx",
|
|
23
|
+
"provenance": "official",
|
|
24
|
+
"placement": "host"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"@bridge/kernel": ">=0.0.1",
|
|
28
|
+
"@bridge/ui": ">=0.0.1",
|
|
29
|
+
"cordis": "4.0.0-rc.11",
|
|
30
|
+
"react": "19.3.0"
|
|
31
|
+
},
|
|
32
|
+
"releaseStage": "dev",
|
|
33
|
+
"scripts": {
|
|
34
|
+
"test": "node ../bridge/node_modules/vitest/vitest.mjs run --config ../scripts/vitest.config.ts",
|
|
35
|
+
"typecheck": "bridge plugin check ."
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"bridge": ">=0.0.1-nightly.20261117.1"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "extends": "./.bridge/tsconfig.json" }
|
package/README.md
DELETED