@buoy-gg/shared-ui 7.0.15 → 7.0.17
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/lib/commonjs/JsModal.web.js +1588 -0
- package/lib/commonjs/env/EnvironmentIndicator.web.js +114 -0
- package/lib/commonjs/env/EnvironmentSelectorInline.web.js +178 -0
- package/lib/commonjs/hooks/index.js +7 -0
- package/lib/commonjs/hooks/safe-area-impl.js +1 -1
- package/lib/commonjs/hooks/usePersistedState.js +71 -0
- package/lib/commonjs/icons/index.js +28 -0
- package/lib/commonjs/index.js +45 -3
- package/lib/commonjs/storage/devToolsStorageKeys.js +22 -0
- package/lib/commonjs/stores/ignoredPatternsCore.js +68 -0
- package/lib/commonjs/stores/ignoredPatternsStore.js +16 -52
- package/lib/commonjs/stores/ignoredPatternsStore.web.js +236 -0
- package/lib/commonjs/stores/index.js +1 -1
- package/lib/commonjs/ui/components/ModalHeader.js +69 -0
- package/lib/commonjs/ui/components/ToolButton.js +90 -0
- package/lib/commonjs/ui/components/index.js +7 -0
- package/lib/commonjs/ui/gameUI/constants/gameUIColors.js +5 -3
- package/lib/commonjs/ui/index.js +8 -0
- package/lib/commonjs/ui/toolTheme.js +96 -0
- package/lib/commonjs/utils/index.js +38 -0
- package/lib/commonjs/utils/stateSnapshotRegistry.js +62 -0
- package/lib/module/JsModal.web.js +1586 -0
- package/lib/module/env/EnvironmentIndicator.web.js +108 -0
- package/lib/module/env/EnvironmentSelectorInline.web.js +173 -0
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/safe-area-impl.js +1 -1
- package/lib/module/hooks/usePersistedState.js +68 -0
- package/lib/module/icons/index.js +2 -0
- package/lib/module/index.js +7 -3
- package/lib/module/storage/devToolsStorageKeys.js +22 -0
- package/lib/module/stores/ignoredPatternsCore.js +62 -0
- package/lib/module/stores/ignoredPatternsStore.js +5 -51
- package/lib/module/stores/ignoredPatternsStore.web.js +221 -0
- package/lib/module/stores/index.js +1 -1
- package/lib/module/ui/components/ModalHeader.js +70 -2
- package/lib/module/ui/components/ToolButton.js +86 -0
- package/lib/module/ui/components/index.js +1 -0
- package/lib/module/ui/gameUI/constants/gameUIColors.js +4 -2
- package/lib/module/ui/index.js +3 -0
- package/lib/module/ui/toolTheme.js +93 -0
- package/lib/module/utils/index.js +2 -0
- package/lib/module/utils/stateSnapshotRegistry.js +55 -0
- package/lib/typescript/commonjs/JsModal.web.d.ts +138 -0
- package/lib/typescript/commonjs/JsModal.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/env/EnvironmentIndicator.web.d.ts +16 -0
- package/lib/typescript/commonjs/env/EnvironmentIndicator.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/env/EnvironmentSelectorInline.web.d.ts +8 -0
- package/lib/typescript/commonjs/env/EnvironmentSelectorInline.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/hooks/index.d.ts +1 -0
- package/lib/typescript/commonjs/hooks/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/hooks/usePersistedState.d.ts +16 -0
- package/lib/typescript/commonjs/hooks/usePersistedState.d.ts.map +1 -0
- package/lib/typescript/commonjs/icons/index.d.ts +2 -0
- package/lib/typescript/commonjs/icons/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts +19 -0
- package/lib/typescript/commonjs/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/commonjs/stores/ignoredPatternsCore.d.ts +37 -0
- package/lib/typescript/commonjs/stores/ignoredPatternsCore.d.ts.map +1 -0
- package/lib/typescript/commonjs/stores/ignoredPatternsStore.d.ts +3 -27
- package/lib/typescript/commonjs/stores/ignoredPatternsStore.d.ts.map +1 -1
- package/lib/typescript/commonjs/stores/ignoredPatternsStore.web.d.ts +72 -0
- package/lib/typescript/commonjs/stores/ignoredPatternsStore.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts +13 -1
- package/lib/typescript/commonjs/ui/components/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ToolButton.d.ts +24 -0
- package/lib/typescript/commonjs/ui/components/ToolButton.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/index.d.ts +4 -0
- package/lib/typescript/commonjs/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts +56 -0
- package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +1 -0
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/toolTheme.d.ts +68 -0
- package/lib/typescript/commonjs/ui/toolTheme.d.ts.map +1 -0
- package/lib/typescript/commonjs/utils/index.d.ts +2 -0
- package/lib/typescript/commonjs/utils/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/utils/stateSnapshotRegistry.d.ts +67 -0
- package/lib/typescript/commonjs/utils/stateSnapshotRegistry.d.ts.map +1 -0
- package/lib/typescript/module/JsModal.web.d.ts +138 -0
- package/lib/typescript/module/JsModal.web.d.ts.map +1 -0
- package/lib/typescript/module/env/EnvironmentIndicator.web.d.ts +16 -0
- package/lib/typescript/module/env/EnvironmentIndicator.web.d.ts.map +1 -0
- package/lib/typescript/module/env/EnvironmentSelectorInline.web.d.ts +8 -0
- package/lib/typescript/module/env/EnvironmentSelectorInline.web.d.ts.map +1 -0
- package/lib/typescript/module/hooks/index.d.ts +1 -0
- package/lib/typescript/module/hooks/index.d.ts.map +1 -1
- package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/hooks/usePersistedState.d.ts +16 -0
- package/lib/typescript/module/hooks/usePersistedState.d.ts.map +1 -0
- package/lib/typescript/module/icons/index.d.ts +2 -0
- package/lib/typescript/module/icons/index.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts +19 -0
- package/lib/typescript/module/storage/devToolsStorageKeys.d.ts.map +1 -1
- package/lib/typescript/module/stores/ignoredPatternsCore.d.ts +37 -0
- package/lib/typescript/module/stores/ignoredPatternsCore.d.ts.map +1 -0
- package/lib/typescript/module/stores/ignoredPatternsStore.d.ts +3 -27
- package/lib/typescript/module/stores/ignoredPatternsStore.d.ts.map +1 -1
- package/lib/typescript/module/stores/ignoredPatternsStore.web.d.ts +72 -0
- package/lib/typescript/module/stores/ignoredPatternsStore.web.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/ModalHeader.d.ts +13 -1
- package/lib/typescript/module/ui/components/ModalHeader.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ToolButton.d.ts +24 -0
- package/lib/typescript/module/ui/components/ToolButton.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/index.d.ts +4 -0
- package/lib/typescript/module/ui/components/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts +56 -0
- package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +1 -0
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/toolTheme.d.ts +68 -0
- package/lib/typescript/module/ui/toolTheme.d.ts.map +1 -0
- package/lib/typescript/module/utils/index.d.ts +2 -0
- package/lib/typescript/module/utils/index.d.ts.map +1 -1
- package/lib/typescript/module/utils/stateSnapshotRegistry.d.ts +67 -0
- package/lib/typescript/module/utils/stateSnapshotRegistry.d.ts.map +1 -0
- package/package.json +4 -4
|
@@ -4,12 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ignoredPatternsStore = void 0;
|
|
7
|
-
exports
|
|
8
|
-
|
|
7
|
+
Object.defineProperty(exports, "isUrlIgnored", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _ignoredPatternsCore.isUrlIgnored;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "urlMatchesIgnoredPattern", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _ignoredPatternsCore.urlMatchesIgnoredPattern;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
9
19
|
exports.useIgnoredPatterns = useIgnoredPatterns;
|
|
10
20
|
var _react = require("react");
|
|
11
21
|
var _persistentStorage = require("../utils/persistentStorage.js");
|
|
12
22
|
var _devToolsStorageKeys = require("../storage/devToolsStorageKeys.js");
|
|
23
|
+
var _ignoredPatternsCore = require("./ignoredPatternsCore.js");
|
|
13
24
|
/**
|
|
14
25
|
* Shared "ignored patterns" store for network-style URL filtering.
|
|
15
26
|
*
|
|
@@ -23,57 +34,10 @@ var _devToolsStorageKeys = require("../storage/devToolsStorageKeys.js");
|
|
|
23
34
|
* having to take a hard dependency on @buoy-gg/network (which is optional).
|
|
24
35
|
*/
|
|
25
36
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
* - `contains`: case-insensitive substring match on the full URL (legacy behavior).
|
|
30
|
-
* - `exact`: smart equality — if pattern starts with `/`, matches URL.pathname;
|
|
31
|
-
* if it starts with `http://`/`https://`, matches origin+pathname; otherwise
|
|
32
|
-
* matches URL.host.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
/** A single exclude pattern with its match mode. */
|
|
37
|
+
// Pure matching types/helpers live in ignoredPatternsCore.ts (web-shim-safe);
|
|
38
|
+
// re-exported here so the shared-ui barrel surface is unchanged.
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
const DEFAULT_PATTERNS = [{
|
|
39
|
-
value: "api.keygen.sh",
|
|
40
|
-
mode: "contains"
|
|
41
|
-
}];
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Returns true when `url` matches the ignored `pattern` according to its mode.
|
|
45
|
-
*
|
|
46
|
-
* `contains` → case-insensitive substring on the full URL (legacy behavior).
|
|
47
|
-
* `exact` → smart equality: pattern starting with `/` compares URL.pathname,
|
|
48
|
-
* full URLs compare origin+pathname (ignoring query/hash), bare
|
|
49
|
-
* values compare URL.host. Falls back to literal equality if URL
|
|
50
|
-
* parsing fails (e.g. relative URLs).
|
|
51
|
-
*/
|
|
52
|
-
function urlMatchesIgnoredPattern(url, pattern) {
|
|
53
|
-
const lowerUrl = url.toLowerCase();
|
|
54
|
-
const lowerValue = pattern.value.toLowerCase();
|
|
55
|
-
if (pattern.mode === "contains") {
|
|
56
|
-
return lowerUrl.includes(lowerValue);
|
|
57
|
-
}
|
|
58
|
-
try {
|
|
59
|
-
const parsed = new URL(url);
|
|
60
|
-
if (lowerValue.startsWith("/")) {
|
|
61
|
-
return parsed.pathname.toLowerCase() === lowerValue;
|
|
62
|
-
}
|
|
63
|
-
if (lowerValue.startsWith("http://") || lowerValue.startsWith("https://")) {
|
|
64
|
-
return `${parsed.origin}${parsed.pathname}`.toLowerCase() === lowerValue;
|
|
65
|
-
}
|
|
66
|
-
return parsed.host.toLowerCase() === lowerValue;
|
|
67
|
-
} catch {
|
|
68
|
-
return lowerUrl === lowerValue;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/** Convenience: does `url` match ANY of the ignored `patterns`? */
|
|
73
|
-
function isUrlIgnored(url, patterns) {
|
|
74
|
-
if (!url || patterns.length === 0) return false;
|
|
75
|
-
return patterns.some(pattern => urlMatchesIgnoredPattern(url, pattern));
|
|
76
|
-
}
|
|
40
|
+
const DEFAULT_PATTERNS = _ignoredPatternsCore.DEFAULT_IGNORED_PATTERNS;
|
|
77
41
|
|
|
78
42
|
/** Tolerate the legacy `string[]` persisted format and stray junk. */
|
|
79
43
|
function migratePatterns(raw) {
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ignoredPatternsStore = void 0;
|
|
7
|
+
Object.defineProperty(exports, "isUrlIgnored", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return _ignoredPatternsCore.isUrlIgnored;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, "urlMatchesIgnoredPattern", {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () {
|
|
16
|
+
return _ignoredPatternsCore.urlMatchesIgnoredPattern;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
exports.useIgnoredPatterns = useIgnoredPatterns;
|
|
20
|
+
var _react = require("react");
|
|
21
|
+
var _devToolsStorageKeys = require("../storage/devToolsStorageKeys.js");
|
|
22
|
+
var _ignoredPatternsCore = require("./ignoredPatternsCore.js");
|
|
23
|
+
/**
|
|
24
|
+
* ignoredPatternsStore.web — web twin of ignoredPatternsStore.ts (the shared
|
|
25
|
+
* persisted "ignored patterns" singleton for network-style URL filtering).
|
|
26
|
+
*
|
|
27
|
+
* The native store imports shared's RN `persistentStorage` (whose module graph
|
|
28
|
+
* carries guarded expo-file-system / async-storage requires), which is why the
|
|
29
|
+
* web shims never re-exported it. This twin keeps the ENTIRE store class, hook
|
|
30
|
+
* and persistence contract identical — same class shape, same
|
|
31
|
+
* `devToolsStorageKeys.network.ignoredDomains()` storage key, same persisted
|
|
32
|
+
* JSON shape (`IgnoredPattern[]`, with the legacy `string[]` migration) — and
|
|
33
|
+
* swaps only the storage backing: a file-local localStorage adapter that
|
|
34
|
+
* matches the `persistentStorage` API (async getItem/setItem, best-effort,
|
|
35
|
+
* provenance: example-tauri/src/shims/shared-ui.web.ts's adapter — web Buoy
|
|
36
|
+
* chrome persistence lives in webview localStorage).
|
|
37
|
+
*
|
|
38
|
+
* Everything else — pure matching (`ignoredPatternsCore`), the migration +
|
|
39
|
+
* ensure-defaults logic, the dirty-flag load race guard, the module-scope
|
|
40
|
+
* stable mutation identities — is the native code, not a fork of its
|
|
41
|
+
* semantics. Web consumers get the same shared, persisted pattern list the
|
|
42
|
+
* phone has, keyed identically, so a DOM port and a react-native-web port of
|
|
43
|
+
* the same app read/write the same entry.
|
|
44
|
+
*
|
|
45
|
+
* @platform React DOM Web
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
// Pure matching types/helpers live in ignoredPatternsCore.ts (web-shim-safe);
|
|
49
|
+
// re-exported here so this module's surface twins the native store's.
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* localStorage-backed implementation of the shared `persistentStorage` API
|
|
53
|
+
* (getItem/setItem returning promises, silent best-effort failure) — the same
|
|
54
|
+
* adapter recipe the web shared-ui shims use for Buoy chrome persistence.
|
|
55
|
+
* Local to this file so the web store pulls zero RN/expo modules.
|
|
56
|
+
*/
|
|
57
|
+
const persistentStorage = {
|
|
58
|
+
async getItem(key) {
|
|
59
|
+
try {
|
|
60
|
+
return window.localStorage.getItem(key);
|
|
61
|
+
} catch {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
async setItem(key, value) {
|
|
66
|
+
try {
|
|
67
|
+
window.localStorage.setItem(key, value);
|
|
68
|
+
} catch {
|
|
69
|
+
// Ignore quota/availability errors — callers treat this as best-effort.
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const DEFAULT_PATTERNS = _ignoredPatternsCore.DEFAULT_IGNORED_PATTERNS;
|
|
74
|
+
|
|
75
|
+
/** Tolerate the legacy `string[]` persisted format and stray junk. */
|
|
76
|
+
function migratePatterns(raw) {
|
|
77
|
+
if (!Array.isArray(raw)) return [];
|
|
78
|
+
const migrated = [];
|
|
79
|
+
for (const entry of raw) {
|
|
80
|
+
if (typeof entry === "string" && entry.trim()) {
|
|
81
|
+
migrated.push({
|
|
82
|
+
value: entry,
|
|
83
|
+
mode: "contains"
|
|
84
|
+
});
|
|
85
|
+
} else if (entry && typeof entry === "object" && typeof entry.value === "string") {
|
|
86
|
+
const e = entry;
|
|
87
|
+
migrated.push({
|
|
88
|
+
value: e.value,
|
|
89
|
+
mode: e.mode === "exact" ? "exact" : "contains"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return migrated;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Always keep the default patterns present (e.g. Buoy's license API). */
|
|
97
|
+
function ensureDefaults(patterns) {
|
|
98
|
+
const result = [...patterns];
|
|
99
|
+
for (const def of DEFAULT_PATTERNS) {
|
|
100
|
+
if (!result.some(p => p.value === def.value)) {
|
|
101
|
+
result.push({
|
|
102
|
+
...def
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Singleton store. One instance per JS runtime, so every consumer (Network
|
|
110
|
+
* tool, Events tool, any web panel) shares the same patterns.
|
|
111
|
+
*/
|
|
112
|
+
class IgnoredPatternsStore {
|
|
113
|
+
patterns = ensureDefaults(DEFAULT_PATTERNS.map(p => ({
|
|
114
|
+
...p
|
|
115
|
+
})));
|
|
116
|
+
listeners = new Set();
|
|
117
|
+
loaded = false;
|
|
118
|
+
loadPromise = null;
|
|
119
|
+
/** Set once a mutation happens so a slow initial load can't clobber it. */
|
|
120
|
+
dirty = false;
|
|
121
|
+
|
|
122
|
+
/** Current patterns (stable reference until a mutation occurs). */
|
|
123
|
+
getPatterns() {
|
|
124
|
+
return this.patterns;
|
|
125
|
+
}
|
|
126
|
+
subscribe(listener) {
|
|
127
|
+
this.listeners.add(listener);
|
|
128
|
+
// Lazily hydrate from storage the first time anyone cares.
|
|
129
|
+
void this.ensureLoaded();
|
|
130
|
+
return () => {
|
|
131
|
+
this.listeners.delete(listener);
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
emit() {
|
|
135
|
+
this.listeners.forEach(l => l());
|
|
136
|
+
}
|
|
137
|
+
ensureLoaded() {
|
|
138
|
+
if (this.loaded) return Promise.resolve();
|
|
139
|
+
if (this.loadPromise) return this.loadPromise;
|
|
140
|
+
this.loadPromise = (async () => {
|
|
141
|
+
try {
|
|
142
|
+
const stored = await persistentStorage.getItem(_devToolsStorageKeys.devToolsStorageKeys.network.ignoredDomains());
|
|
143
|
+
// A mutation may have raced this read — never overwrite user intent.
|
|
144
|
+
if (stored && !this.dirty) {
|
|
145
|
+
const migrated = ensureDefaults(migratePatterns(JSON.parse(stored)));
|
|
146
|
+
this.patterns = migrated;
|
|
147
|
+
}
|
|
148
|
+
} catch {
|
|
149
|
+
// Silently fall back to defaults.
|
|
150
|
+
} finally {
|
|
151
|
+
this.loaded = true;
|
|
152
|
+
this.emit();
|
|
153
|
+
}
|
|
154
|
+
})();
|
|
155
|
+
return this.loadPromise;
|
|
156
|
+
}
|
|
157
|
+
persist() {
|
|
158
|
+
persistentStorage.setItem(_devToolsStorageKeys.devToolsStorageKeys.network.ignoredDomains(), JSON.stringify(this.patterns)).catch(() => {
|
|
159
|
+
// Silently fail — patterns remain in memory.
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
commit(next) {
|
|
163
|
+
this.dirty = true;
|
|
164
|
+
this.patterns = next;
|
|
165
|
+
this.emit();
|
|
166
|
+
this.persist();
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** Add a pattern (no-op if its value already exists). */
|
|
170
|
+
add(pattern) {
|
|
171
|
+
const value = pattern.value.trim();
|
|
172
|
+
if (!value) return;
|
|
173
|
+
if (this.patterns.some(p => p.value === value)) return;
|
|
174
|
+
this.commit([...this.patterns, {
|
|
175
|
+
value,
|
|
176
|
+
mode: pattern.mode
|
|
177
|
+
}]);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Remove a pattern by value. */
|
|
181
|
+
remove(value) {
|
|
182
|
+
if (!this.patterns.some(p => p.value === value)) return;
|
|
183
|
+
this.commit(this.patterns.filter(p => p.value !== value));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/** Add as `contains` if absent, otherwise remove (used by detail-view chips). */
|
|
187
|
+
toggle(value) {
|
|
188
|
+
const trimmed = value.trim();
|
|
189
|
+
if (!trimmed) return;
|
|
190
|
+
this.commit(this.patterns.some(p => p.value === trimmed) ? this.patterns.filter(p => p.value !== trimmed) : [...this.patterns, {
|
|
191
|
+
value: trimmed,
|
|
192
|
+
mode: "contains"
|
|
193
|
+
}]);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** Flip an existing pattern between `contains` and `exact`. */
|
|
197
|
+
toggleMode(value) {
|
|
198
|
+
if (!this.patterns.some(p => p.value === value)) return;
|
|
199
|
+
this.commit(this.patterns.map(p => p.value === value ? {
|
|
200
|
+
...p,
|
|
201
|
+
mode: p.mode === "contains" ? "exact" : "contains"
|
|
202
|
+
} : p));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const ignoredPatternsStore = exports.ignoredPatternsStore = new IgnoredPatternsStore();
|
|
206
|
+
/**
|
|
207
|
+
* Mutations live at module scope so they keep a STABLE identity across
|
|
208
|
+
* renders (same rationale as native: inline arrows handed every consumer a
|
|
209
|
+
* fresh `toggle` per render and defeated `memo` downstream).
|
|
210
|
+
*/
|
|
211
|
+
const addPattern = pattern => ignoredPatternsStore.add(pattern);
|
|
212
|
+
const removePattern = value => ignoredPatternsStore.remove(value);
|
|
213
|
+
const togglePattern = value => ignoredPatternsStore.toggle(value);
|
|
214
|
+
const togglePatternMode = value => ignoredPatternsStore.toggleMode(value);
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Subscribe to the shared ignored-patterns store. All consumers in a runtime
|
|
218
|
+
* see the same patterns and the same mutations.
|
|
219
|
+
*/
|
|
220
|
+
function useIgnoredPatterns() {
|
|
221
|
+
const [patterns, setPatterns] = (0, _react.useState)(() => ignoredPatternsStore.getPatterns());
|
|
222
|
+
(0, _react.useEffect)(() => {
|
|
223
|
+
return ignoredPatternsStore.subscribe(() => {
|
|
224
|
+
setPatterns(ignoredPatternsStore.getPatterns());
|
|
225
|
+
});
|
|
226
|
+
}, []);
|
|
227
|
+
const values = (0, _react.useMemo)(() => new Set(patterns.map(p => p.value)), [patterns]);
|
|
228
|
+
return {
|
|
229
|
+
patterns,
|
|
230
|
+
values,
|
|
231
|
+
add: addPattern,
|
|
232
|
+
remove: removePattern,
|
|
233
|
+
toggle: togglePattern,
|
|
234
|
+
toggleMode: togglePatternMode
|
|
235
|
+
};
|
|
236
|
+
}
|
|
@@ -5,9 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.Actions = Actions;
|
|
7
7
|
exports.Content = Content;
|
|
8
|
+
exports.HeaderSearch = HeaderSearch;
|
|
8
9
|
exports.ModalHeader = ModalHeader;
|
|
9
10
|
exports.Navigation = Navigation;
|
|
10
11
|
var _reactNative = require("react-native");
|
|
12
|
+
var _react = require("react");
|
|
11
13
|
var _index = require("../../icons/index.js");
|
|
12
14
|
var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
|
|
13
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -118,10 +120,51 @@ function Actions({
|
|
|
118
120
|
}
|
|
119
121
|
Actions.displayName = "ModalHeaderActions";
|
|
120
122
|
|
|
123
|
+
// Expanding search input for the header. Render this IN PLACE OF
|
|
124
|
+
// `ModalHeader.Content` while search is active — it fills the same flex slot.
|
|
125
|
+
// Extracts the idiom env/network/storage each hand-rolled (~50 lines apiece).
|
|
126
|
+
|
|
127
|
+
function HeaderSearch({
|
|
128
|
+
value,
|
|
129
|
+
onChangeText,
|
|
130
|
+
onCancel,
|
|
131
|
+
placeholder = "Search...",
|
|
132
|
+
autoFocus = true
|
|
133
|
+
}) {
|
|
134
|
+
const inputRef = (0, _react.useRef)(null);
|
|
135
|
+
(0, _react.useEffect)(() => {
|
|
136
|
+
if (autoFocus) inputRef.current?.focus();
|
|
137
|
+
}, [autoFocus]);
|
|
138
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
139
|
+
style: styles.searchContainer,
|
|
140
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.Search, {
|
|
141
|
+
size: 12,
|
|
142
|
+
color: _gameUIColors.buoyColors.textSecondary
|
|
143
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
144
|
+
ref: inputRef,
|
|
145
|
+
style: styles.searchInput,
|
|
146
|
+
placeholder: placeholder,
|
|
147
|
+
placeholderTextColor: _gameUIColors.buoyColors.textMuted,
|
|
148
|
+
value: value,
|
|
149
|
+
onChangeText: onChangeText,
|
|
150
|
+
autoCorrect: false,
|
|
151
|
+
autoCapitalize: "none"
|
|
152
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
|
|
153
|
+
onPress: onCancel,
|
|
154
|
+
style: styles.searchCancelButton,
|
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.X, {
|
|
156
|
+
size: 12,
|
|
157
|
+
color: _gameUIColors.buoyColors.textSecondary
|
|
158
|
+
})
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
121
163
|
// Attach sub-components to the main component
|
|
122
164
|
ModalHeader.Navigation = Navigation;
|
|
123
165
|
ModalHeader.Content = Content;
|
|
124
166
|
ModalHeader.Actions = Actions;
|
|
167
|
+
ModalHeader.Search = HeaderSearch;
|
|
125
168
|
const styles = _reactNative.StyleSheet.create({
|
|
126
169
|
headerContainer: {
|
|
127
170
|
flexDirection: "row",
|
|
@@ -169,5 +212,31 @@ const styles = _reactNative.StyleSheet.create({
|
|
|
169
212
|
},
|
|
170
213
|
headerContentNoMargin: {
|
|
171
214
|
marginHorizontal: 0
|
|
215
|
+
},
|
|
216
|
+
searchContainer: {
|
|
217
|
+
flexDirection: "row",
|
|
218
|
+
alignItems: "center",
|
|
219
|
+
flex: 1,
|
|
220
|
+
backgroundColor: _gameUIColors.buoyColors.input,
|
|
221
|
+
borderRadius: 6,
|
|
222
|
+
paddingHorizontal: 10,
|
|
223
|
+
paddingVertical: 4,
|
|
224
|
+
marginHorizontal: 12,
|
|
225
|
+
marginVertical: 4,
|
|
226
|
+
height: 32,
|
|
227
|
+
borderWidth: 1,
|
|
228
|
+
borderColor: _gameUIColors.buoyColors.border
|
|
229
|
+
},
|
|
230
|
+
searchInput: {
|
|
231
|
+
flex: 1,
|
|
232
|
+
marginLeft: 8,
|
|
233
|
+
fontSize: 13,
|
|
234
|
+
color: _gameUIColors.buoyColors.text,
|
|
235
|
+
padding: 0,
|
|
236
|
+
height: "100%"
|
|
237
|
+
},
|
|
238
|
+
searchCancelButton: {
|
|
239
|
+
padding: 4,
|
|
240
|
+
marginLeft: 4
|
|
172
241
|
}
|
|
173
242
|
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToolButton = ToolButton;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _gameUIColors = require("../gameUI/constants/gameUIColors.js");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
/**
|
|
11
|
+
* The shared action button for dev-tool surfaces. Fills the gap where every
|
|
12
|
+
* tool hand-styled its own TouchableOpacity for "Clear", "Apply", "Reset".
|
|
13
|
+
*/
|
|
14
|
+
function ToolButton({
|
|
15
|
+
label,
|
|
16
|
+
onPress,
|
|
17
|
+
variant = "primary",
|
|
18
|
+
size = "medium",
|
|
19
|
+
disabled = false,
|
|
20
|
+
icon,
|
|
21
|
+
style
|
|
22
|
+
}) {
|
|
23
|
+
const palette = VARIANTS[variant];
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.TouchableOpacity, {
|
|
25
|
+
accessibilityRole: "button",
|
|
26
|
+
accessibilityLabel: label,
|
|
27
|
+
onPress: onPress,
|
|
28
|
+
disabled: disabled,
|
|
29
|
+
style: [styles.base, size === "small" ? styles.small : styles.medium, {
|
|
30
|
+
backgroundColor: palette.background,
|
|
31
|
+
borderColor: palette.border,
|
|
32
|
+
borderWidth: variant === "ghost" ? 0 : 1
|
|
33
|
+
}, disabled && styles.disabled, style],
|
|
34
|
+
children: [icon, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
35
|
+
style: [styles.label, size === "small" && styles.labelSmall, {
|
|
36
|
+
color: palette.text
|
|
37
|
+
}],
|
|
38
|
+
children: label
|
|
39
|
+
})]
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const VARIANTS = {
|
|
43
|
+
primary: {
|
|
44
|
+
background: _gameUIColors.buoyColors.primary + "22",
|
|
45
|
+
border: _gameUIColors.buoyColors.primary + "66",
|
|
46
|
+
text: _gameUIColors.buoyColors.primary
|
|
47
|
+
},
|
|
48
|
+
danger: {
|
|
49
|
+
background: _gameUIColors.gameUIColors.error + "15",
|
|
50
|
+
border: _gameUIColors.gameUIColors.error + "60",
|
|
51
|
+
text: _gameUIColors.gameUIColors.error
|
|
52
|
+
},
|
|
53
|
+
warning: {
|
|
54
|
+
background: _gameUIColors.gameUIColors.warning + "15",
|
|
55
|
+
border: _gameUIColors.gameUIColors.warning + "60",
|
|
56
|
+
text: _gameUIColors.gameUIColors.warning
|
|
57
|
+
},
|
|
58
|
+
ghost: {
|
|
59
|
+
background: "transparent",
|
|
60
|
+
border: "transparent",
|
|
61
|
+
text: _gameUIColors.buoyColors.textSecondary
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
const styles = _reactNative.StyleSheet.create({
|
|
65
|
+
base: {
|
|
66
|
+
flexDirection: "row",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
gap: 6,
|
|
70
|
+
borderRadius: 8
|
|
71
|
+
},
|
|
72
|
+
medium: {
|
|
73
|
+
paddingVertical: 8,
|
|
74
|
+
paddingHorizontal: 14
|
|
75
|
+
},
|
|
76
|
+
small: {
|
|
77
|
+
paddingVertical: 5,
|
|
78
|
+
paddingHorizontal: 10
|
|
79
|
+
},
|
|
80
|
+
disabled: {
|
|
81
|
+
opacity: 0.4
|
|
82
|
+
},
|
|
83
|
+
label: {
|
|
84
|
+
fontSize: 12,
|
|
85
|
+
fontWeight: "600"
|
|
86
|
+
},
|
|
87
|
+
labelSmall: {
|
|
88
|
+
fontSize: 11
|
|
89
|
+
}
|
|
90
|
+
});
|
|
@@ -297,6 +297,12 @@ Object.defineProperty(exports, "TimeDisplay", {
|
|
|
297
297
|
return _TimeDisplay.TimeDisplay;
|
|
298
298
|
}
|
|
299
299
|
});
|
|
300
|
+
Object.defineProperty(exports, "ToolButton", {
|
|
301
|
+
enumerable: true,
|
|
302
|
+
get: function () {
|
|
303
|
+
return _ToolButton.ToolButton;
|
|
304
|
+
}
|
|
305
|
+
});
|
|
300
306
|
Object.defineProperty(exports, "ToolbarClearButton", {
|
|
301
307
|
enumerable: true,
|
|
302
308
|
get: function () {
|
|
@@ -352,6 +358,7 @@ var _FilterComponents = require("./FilterComponents.js");
|
|
|
352
358
|
var _CompactFilterChips = require("./CompactFilterChips.js");
|
|
353
359
|
var _Badge = require("./Badge.js");
|
|
354
360
|
var _TabSelector = require("./TabSelector.js");
|
|
361
|
+
var _ToolButton = require("./ToolButton.js");
|
|
355
362
|
var _EventListItem = require("./EventListItem.js");
|
|
356
363
|
var _StatsCard = require("./StatsCard.js");
|
|
357
364
|
var _CompactRow = require("./CompactRow.js");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.refreshGameUIColors = exports.gameUIColors = exports.dialColors = exports.buoyColors = void 0;
|
|
6
|
+
exports.refreshGameUIColors = exports.gameUIColors = exports.dialColors = exports.buoyColors = exports._defaultTheme = void 0;
|
|
7
7
|
var _macOSDesignSystemColors = require("./macOSDesignSystemColors.js");
|
|
8
8
|
/**
|
|
9
9
|
* Game UI Color Palette - Simple Theme Swapping
|
|
@@ -18,7 +18,9 @@ var _macOSDesignSystemColors = require("./macOSDesignSystemColors.js");
|
|
|
18
18
|
// THEME DEFINITIONS
|
|
19
19
|
// ============================================
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
// Kept (and exported) as the reference palette for theme swapping — see the
|
|
22
|
+
// header comment. Unused by the active theme selection.
|
|
23
|
+
const _defaultTheme = exports._defaultTheme = {
|
|
22
24
|
// Base colors
|
|
23
25
|
border: "#00B8E666",
|
|
24
26
|
blackTint1: "rgba(8, 12, 21, 0.95)",
|
|
@@ -122,7 +124,7 @@ const macOSTheme = _macOSDesignSystemColors.macOSGameUIColors;
|
|
|
122
124
|
// THEME SELECTION - Just change this one line!
|
|
123
125
|
// ============================================
|
|
124
126
|
|
|
125
|
-
// const activeTheme =
|
|
127
|
+
// const activeTheme = _defaultTheme; // DEFAULT - Mixed colors (original)
|
|
126
128
|
const activeTheme = macOSTheme; // macOS - Apple HIG design system
|
|
127
129
|
|
|
128
130
|
// ============================================
|
package/lib/commonjs/ui/index.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
|
+
toolTheme: true,
|
|
7
8
|
CyberpunkSectionButton: true
|
|
8
9
|
};
|
|
9
10
|
Object.defineProperty(exports, "CyberpunkSectionButton", {
|
|
@@ -12,6 +13,12 @@ Object.defineProperty(exports, "CyberpunkSectionButton", {
|
|
|
12
13
|
return _CyberpunkSectionButton.CyberpunkSectionButton;
|
|
13
14
|
}
|
|
14
15
|
});
|
|
16
|
+
Object.defineProperty(exports, "toolTheme", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function () {
|
|
19
|
+
return _toolTheme.toolTheme;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
15
22
|
var _index = require("./components/index.js");
|
|
16
23
|
Object.keys(_index).forEach(function (key) {
|
|
17
24
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -24,6 +31,7 @@ Object.keys(_index).forEach(function (key) {
|
|
|
24
31
|
}
|
|
25
32
|
});
|
|
26
33
|
});
|
|
34
|
+
var _toolTheme = require("./toolTheme.js");
|
|
27
35
|
var _CyberpunkSectionButton = require("./console/CyberpunkSectionButton.js");
|
|
28
36
|
var _index2 = require("./gameUI/index.js");
|
|
29
37
|
Object.keys(_index2).forEach(function (key) {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toolTheme = void 0;
|
|
7
|
+
var _gameUIColors = require("./gameUI/constants/gameUIColors.js");
|
|
8
|
+
/**
|
|
9
|
+
* Semantic design tokens for dev-tool surfaces — the single documented entry
|
|
10
|
+
* point for custom-tool authors (and, over time, internal tools).
|
|
11
|
+
*
|
|
12
|
+
* Buoy historically grew three color systems (`buoyColors`, `gameUIColors`,
|
|
13
|
+
* `macOSColors`) with tribal knowledge about which to use where. `toolTheme`
|
|
14
|
+
* encodes that knowledge: surfaces/text come from the brand palette, semantic
|
|
15
|
+
* status colors from the gameUI palette. Consumers should not need to know
|
|
16
|
+
* that split exists.
|
|
17
|
+
*/
|
|
18
|
+
const toolTheme = exports.toolTheme = {
|
|
19
|
+
colors: {
|
|
20
|
+
/** Modal/page background. */
|
|
21
|
+
surface: _gameUIColors.buoyColors.base,
|
|
22
|
+
/** Card / row background, one step above surface. */
|
|
23
|
+
card: _gameUIColors.buoyColors.card,
|
|
24
|
+
/** Pressed/hover background. */
|
|
25
|
+
hover: _gameUIColors.buoyColors.hover,
|
|
26
|
+
/** Text-input background. */
|
|
27
|
+
input: _gameUIColors.buoyColors.input,
|
|
28
|
+
border: _gameUIColors.buoyColors.border,
|
|
29
|
+
borderStrong: _gameUIColors.buoyColors.borderStrong,
|
|
30
|
+
text: _gameUIColors.buoyColors.text,
|
|
31
|
+
textSecondary: _gameUIColors.buoyColors.textSecondary,
|
|
32
|
+
textMuted: _gameUIColors.buoyColors.textMuted,
|
|
33
|
+
/** Buoy teal — primary accent. */
|
|
34
|
+
accent: _gameUIColors.buoyColors.primary,
|
|
35
|
+
success: _gameUIColors.gameUIColors.success,
|
|
36
|
+
warning: _gameUIColors.gameUIColors.warning,
|
|
37
|
+
error: _gameUIColors.gameUIColors.error,
|
|
38
|
+
info: _gameUIColors.gameUIColors.info
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* Text presets matching the styles internal tools re-declare per file.
|
|
42
|
+
* Spread into a style: `style={[toolTheme.text.label, { color: ... }]}`.
|
|
43
|
+
*/
|
|
44
|
+
text: {
|
|
45
|
+
/** Modal/section titles. */
|
|
46
|
+
title: {
|
|
47
|
+
fontSize: 14,
|
|
48
|
+
fontWeight: "600",
|
|
49
|
+
color: _gameUIColors.buoyColors.text
|
|
50
|
+
},
|
|
51
|
+
/** Default body copy. */
|
|
52
|
+
body: {
|
|
53
|
+
fontSize: 13,
|
|
54
|
+
color: _gameUIColors.buoyColors.text
|
|
55
|
+
},
|
|
56
|
+
/** Secondary copy under a primary line. */
|
|
57
|
+
subtitle: {
|
|
58
|
+
fontSize: 12,
|
|
59
|
+
color: _gameUIColors.buoyColors.textSecondary
|
|
60
|
+
},
|
|
61
|
+
/** ALL-CAPS section labels ("LOCAL OVERRIDES"). */
|
|
62
|
+
label: {
|
|
63
|
+
fontSize: 10,
|
|
64
|
+
fontWeight: "700",
|
|
65
|
+
color: _gameUIColors.buoyColors.textMuted,
|
|
66
|
+
letterSpacing: 1.2,
|
|
67
|
+
fontFamily: "monospace"
|
|
68
|
+
},
|
|
69
|
+
/** Monospace values (keys, ids, payload snippets). */
|
|
70
|
+
mono: {
|
|
71
|
+
fontSize: 11,
|
|
72
|
+
color: _gameUIColors.buoyColors.textSecondary,
|
|
73
|
+
fontFamily: "monospace"
|
|
74
|
+
},
|
|
75
|
+
/** Timestamps and fine print. */
|
|
76
|
+
small: {
|
|
77
|
+
fontSize: 9,
|
|
78
|
+
color: _gameUIColors.buoyColors.textMuted,
|
|
79
|
+
fontFamily: "monospace"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
/** 4-based spacing scale used across tool surfaces. */
|
|
83
|
+
spacing: {
|
|
84
|
+
xs: 4,
|
|
85
|
+
sm: 8,
|
|
86
|
+
md: 12,
|
|
87
|
+
lg: 16,
|
|
88
|
+
xl: 24
|
|
89
|
+
},
|
|
90
|
+
radius: {
|
|
91
|
+
sm: 6,
|
|
92
|
+
md: 8,
|
|
93
|
+
lg: 12,
|
|
94
|
+
pill: 9999
|
|
95
|
+
}
|
|
96
|
+
};
|