@buoy-gg/shared-ui 7.0.15 → 7.0.16

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 (57) hide show
  1. package/lib/commonjs/JsModal.web.js +1588 -0
  2. package/lib/commonjs/env/EnvironmentIndicator.web.js +114 -0
  3. package/lib/commonjs/env/EnvironmentSelectorInline.web.js +178 -0
  4. package/lib/commonjs/hooks/safe-area-impl.js +1 -1
  5. package/lib/commonjs/icons/index.js +14 -0
  6. package/lib/commonjs/index.js +3 -3
  7. package/lib/commonjs/stores/ignoredPatternsCore.js +68 -0
  8. package/lib/commonjs/stores/ignoredPatternsStore.js +16 -52
  9. package/lib/commonjs/stores/ignoredPatternsStore.web.js +236 -0
  10. package/lib/commonjs/stores/index.js +1 -1
  11. package/lib/commonjs/ui/gameUI/constants/gameUIColors.js +5 -3
  12. package/lib/module/JsModal.web.js +1586 -0
  13. package/lib/module/env/EnvironmentIndicator.web.js +108 -0
  14. package/lib/module/env/EnvironmentSelectorInline.web.js +173 -0
  15. package/lib/module/hooks/safe-area-impl.js +1 -1
  16. package/lib/module/icons/index.js +1 -0
  17. package/lib/module/index.js +3 -3
  18. package/lib/module/stores/ignoredPatternsCore.js +62 -0
  19. package/lib/module/stores/ignoredPatternsStore.js +5 -51
  20. package/lib/module/stores/ignoredPatternsStore.web.js +221 -0
  21. package/lib/module/stores/index.js +1 -1
  22. package/lib/module/ui/gameUI/constants/gameUIColors.js +4 -2
  23. package/lib/typescript/commonjs/JsModal.web.d.ts +138 -0
  24. package/lib/typescript/commonjs/JsModal.web.d.ts.map +1 -0
  25. package/lib/typescript/commonjs/env/EnvironmentIndicator.web.d.ts +16 -0
  26. package/lib/typescript/commonjs/env/EnvironmentIndicator.web.d.ts.map +1 -0
  27. package/lib/typescript/commonjs/env/EnvironmentSelectorInline.web.d.ts +8 -0
  28. package/lib/typescript/commonjs/env/EnvironmentSelectorInline.web.d.ts.map +1 -0
  29. package/lib/typescript/commonjs/hooks/safe-area-impl.d.ts +1 -1
  30. package/lib/typescript/commonjs/icons/index.d.ts +1 -0
  31. package/lib/typescript/commonjs/icons/index.d.ts.map +1 -1
  32. package/lib/typescript/commonjs/stores/ignoredPatternsCore.d.ts +37 -0
  33. package/lib/typescript/commonjs/stores/ignoredPatternsCore.d.ts.map +1 -0
  34. package/lib/typescript/commonjs/stores/ignoredPatternsStore.d.ts +3 -27
  35. package/lib/typescript/commonjs/stores/ignoredPatternsStore.d.ts.map +1 -1
  36. package/lib/typescript/commonjs/stores/ignoredPatternsStore.web.d.ts +72 -0
  37. package/lib/typescript/commonjs/stores/ignoredPatternsStore.web.d.ts.map +1 -0
  38. package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts +56 -0
  39. package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
  40. package/lib/typescript/module/JsModal.web.d.ts +138 -0
  41. package/lib/typescript/module/JsModal.web.d.ts.map +1 -0
  42. package/lib/typescript/module/env/EnvironmentIndicator.web.d.ts +16 -0
  43. package/lib/typescript/module/env/EnvironmentIndicator.web.d.ts.map +1 -0
  44. package/lib/typescript/module/env/EnvironmentSelectorInline.web.d.ts +8 -0
  45. package/lib/typescript/module/env/EnvironmentSelectorInline.web.d.ts.map +1 -0
  46. package/lib/typescript/module/hooks/safe-area-impl.d.ts +1 -1
  47. package/lib/typescript/module/icons/index.d.ts +1 -0
  48. package/lib/typescript/module/icons/index.d.ts.map +1 -1
  49. package/lib/typescript/module/stores/ignoredPatternsCore.d.ts +37 -0
  50. package/lib/typescript/module/stores/ignoredPatternsCore.d.ts.map +1 -0
  51. package/lib/typescript/module/stores/ignoredPatternsStore.d.ts +3 -27
  52. package/lib/typescript/module/stores/ignoredPatternsStore.d.ts.map +1 -1
  53. package/lib/typescript/module/stores/ignoredPatternsStore.web.d.ts +72 -0
  54. package/lib/typescript/module/stores/ignoredPatternsStore.web.d.ts.map +1 -0
  55. package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts +56 -0
  56. package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
  57. package/package.json +4 -4
@@ -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
+ }
@@ -34,4 +34,4 @@ Object.defineProperty(exports, "useIgnoredPatterns", {
34
34
  }
35
35
  });
36
36
  var _BaseEventStore = require("./BaseEventStore.js");
37
- var _ignoredPatternsStore = require("./ignoredPatternsStore.js");
37
+ var _ignoredPatternsStore = require("./ignoredPatternsStore");
@@ -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
- const defaultTheme = {
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 = defaultTheme; // DEFAULT - Mixed colors (original)
127
+ // const activeTheme = _defaultTheme; // DEFAULT - Mixed colors (original)
126
128
  const activeTheme = macOSTheme; // macOS - Apple HIG design system
127
129
 
128
130
  // ============================================