@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.
- 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/safe-area-impl.js +1 -1
- package/lib/commonjs/icons/index.js +14 -0
- package/lib/commonjs/index.js +3 -3
- 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/gameUI/constants/gameUIColors.js +5 -3
- 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/safe-area-impl.js +1 -1
- package/lib/module/icons/index.js +1 -0
- package/lib/module/index.js +3 -3
- 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/gameUI/constants/gameUIColors.js +4 -2
- 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/safe-area-impl.d.ts +1 -1
- package/lib/typescript/commonjs/icons/index.d.ts +1 -0
- package/lib/typescript/commonjs/icons/index.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/gameUI/constants/gameUIColors.d.ts +56 -0
- package/lib/typescript/commonjs/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
- 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/safe-area-impl.d.ts +1 -1
- package/lib/typescript/module/icons/index.d.ts +1 -0
- package/lib/typescript/module/icons/index.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/gameUI/constants/gameUIColors.d.ts +56 -0
- package/lib/typescript/module/ui/gameUI/constants/gameUIColors.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EnvironmentIndicator = EnvironmentIndicator;
|
|
7
|
+
exports.getEnvironmentConfig = getEnvironmentConfig;
|
|
8
|
+
var _gameUIColors = require("../ui/gameUI/constants/gameUIColors.js");
|
|
9
|
+
var _types = require("../types/types.js");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/**
|
|
12
|
+
* EnvironmentIndicator — Web (React DOM) twin of EnvironmentIndicator.tsx.
|
|
13
|
+
* Same env→color/label map and layout; lucide glyph icons are omitted from
|
|
14
|
+
* the badge on native too (dot + label only), so parity holds.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
function getEnvironmentConfig(environment) {
|
|
18
|
+
switch ((0, _types.normalizeEnvironment)(String(environment))) {
|
|
19
|
+
case 'dev':
|
|
20
|
+
return {
|
|
21
|
+
label: 'DEV',
|
|
22
|
+
backgroundColor: _gameUIColors.gameUIColors.warning
|
|
23
|
+
};
|
|
24
|
+
case 'qa':
|
|
25
|
+
return {
|
|
26
|
+
label: 'QA',
|
|
27
|
+
backgroundColor: _gameUIColors.gameUIColors.optional
|
|
28
|
+
};
|
|
29
|
+
case 'staging':
|
|
30
|
+
return {
|
|
31
|
+
label: 'STAGING',
|
|
32
|
+
backgroundColor: _gameUIColors.gameUIColors.success
|
|
33
|
+
};
|
|
34
|
+
case 'prod':
|
|
35
|
+
return {
|
|
36
|
+
label: 'PROD',
|
|
37
|
+
backgroundColor: _gameUIColors.gameUIColors.error
|
|
38
|
+
};
|
|
39
|
+
case 'local':
|
|
40
|
+
default:
|
|
41
|
+
return {
|
|
42
|
+
label: 'LOCAL',
|
|
43
|
+
backgroundColor: _gameUIColors.gameUIColors.info
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function ChevronDownGlyph({
|
|
48
|
+
color
|
|
49
|
+
}) {
|
|
50
|
+
// native: ChevronDown size 12 from shared lucide icons
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
52
|
+
width: 12,
|
|
53
|
+
height: 12,
|
|
54
|
+
viewBox: "0 0 24 24",
|
|
55
|
+
"aria-hidden": "true",
|
|
56
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
57
|
+
d: "M6 9l6 6 6-6",
|
|
58
|
+
fill: "none",
|
|
59
|
+
stroke: color,
|
|
60
|
+
strokeWidth: "2",
|
|
61
|
+
strokeLinecap: "round",
|
|
62
|
+
strokeLinejoin: "round"
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function EnvironmentIndicator({
|
|
67
|
+
environment,
|
|
68
|
+
interactive = false,
|
|
69
|
+
onPress
|
|
70
|
+
}) {
|
|
71
|
+
const envConfig = getEnvironmentConfig(environment);
|
|
72
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
73
|
+
onClick: interactive ? onPress : undefined,
|
|
74
|
+
"aria-label": `Environment: ${envConfig.label}`,
|
|
75
|
+
style: {
|
|
76
|
+
display: 'flex',
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
// native: paddingVertical 6, paddingLeft 8, paddingRight interactive?4:8
|
|
80
|
+
padding: `6px ${interactive ? 4 : 8}px 6px 8px`,
|
|
81
|
+
flexShrink: 0,
|
|
82
|
+
background: 'none',
|
|
83
|
+
border: 'none',
|
|
84
|
+
cursor: interactive ? 'pointer' : 'default'
|
|
85
|
+
},
|
|
86
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
87
|
+
style: {
|
|
88
|
+
width: 8,
|
|
89
|
+
height: 8,
|
|
90
|
+
borderRadius: 4,
|
|
91
|
+
backgroundColor: envConfig.backgroundColor,
|
|
92
|
+
marginRight: 6,
|
|
93
|
+
// native: shadowOpacity 0.6, shadowRadius 4 glow
|
|
94
|
+
boxShadow: `0 0 4px ${envConfig.backgroundColor}99`
|
|
95
|
+
}
|
|
96
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
97
|
+
style: {
|
|
98
|
+
fontSize: 11,
|
|
99
|
+
fontWeight: 600,
|
|
100
|
+
color: _gameUIColors.gameUIColors.primaryLight,
|
|
101
|
+
letterSpacing: 0.5
|
|
102
|
+
},
|
|
103
|
+
children: envConfig.label
|
|
104
|
+
}), interactive && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
105
|
+
style: {
|
|
106
|
+
marginLeft: 2,
|
|
107
|
+
display: 'flex'
|
|
108
|
+
},
|
|
109
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ChevronDownGlyph, {
|
|
110
|
+
color: "#7A8599"
|
|
111
|
+
})
|
|
112
|
+
})]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EnvironmentSelectorInline = EnvironmentSelectorInline;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _gameUIColors = require("../ui/gameUI/constants/gameUIColors.js");
|
|
9
|
+
var _EnvironmentIndicatorWeb = require("./EnvironmentIndicator.web.js");
|
|
10
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
11
|
+
/**
|
|
12
|
+
* EnvironmentSelectorInline — Web (React DOM) twin of
|
|
13
|
+
* EnvironmentSelectorInline.tsx: the interactive environment badge that
|
|
14
|
+
* expands a drop-UP panel (absolute bottom:100%, opens upward so the bubble
|
|
15
|
+
* layout doesn't shift). Same geometry: OPTION_HEIGHT 36, 200ms animation,
|
|
16
|
+
* selected row gets a green check.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const OPTION_HEIGHT = 36; // native EnvironmentSelectorInline OPTION_HEIGHT
|
|
20
|
+
|
|
21
|
+
function ChevronUpGlyph({
|
|
22
|
+
color,
|
|
23
|
+
flipped
|
|
24
|
+
}) {
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
26
|
+
width: 10,
|
|
27
|
+
height: 10,
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
"aria-hidden": "true",
|
|
30
|
+
style: {
|
|
31
|
+
transform: flipped ? 'rotate(180deg)' : 'rotate(0deg)',
|
|
32
|
+
transition: 'transform 200ms ease' // native: 200ms rotation
|
|
33
|
+
},
|
|
34
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
35
|
+
d: "M18 15l-6-6-6 6",
|
|
36
|
+
fill: "none",
|
|
37
|
+
stroke: color,
|
|
38
|
+
strokeWidth: "2",
|
|
39
|
+
strokeLinecap: "round",
|
|
40
|
+
strokeLinejoin: "round"
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function CheckGlyph() {
|
|
45
|
+
// native: Check size 12 color #4AFF9F strokeWidth 3
|
|
46
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", {
|
|
47
|
+
width: 12,
|
|
48
|
+
height: 12,
|
|
49
|
+
viewBox: "0 0 24 24",
|
|
50
|
+
"aria-hidden": "true",
|
|
51
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
|
|
52
|
+
d: "M20 6L9 17l-5-5",
|
|
53
|
+
fill: "none",
|
|
54
|
+
stroke: "#4AFF9F",
|
|
55
|
+
strokeWidth: "3",
|
|
56
|
+
strokeLinecap: "round",
|
|
57
|
+
strokeLinejoin: "round"
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function EnvironmentSelectorInline({
|
|
62
|
+
currentEnvironment,
|
|
63
|
+
availableEnvironments,
|
|
64
|
+
onSelect
|
|
65
|
+
}) {
|
|
66
|
+
const [expanded, setExpanded] = (0, _react.useState)(false);
|
|
67
|
+
const [hoveredEnv, setHoveredEnv] = (0, _react.useState)(null);
|
|
68
|
+
const current = (0, _EnvironmentIndicatorWeb.getEnvironmentConfig)(currentEnvironment);
|
|
69
|
+
const panelHeight = availableEnvironments.length * OPTION_HEIGHT;
|
|
70
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
71
|
+
style: {
|
|
72
|
+
position: 'relative',
|
|
73
|
+
zIndex: 1000,
|
|
74
|
+
flexShrink: 0
|
|
75
|
+
},
|
|
76
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
77
|
+
style: {
|
|
78
|
+
position: 'absolute',
|
|
79
|
+
bottom: '100%',
|
|
80
|
+
left: 0,
|
|
81
|
+
right: 0,
|
|
82
|
+
height: expanded ? panelHeight : 0,
|
|
83
|
+
opacity: expanded ? 1 : 0,
|
|
84
|
+
overflow: 'hidden',
|
|
85
|
+
transition: 'height 200ms ease, opacity 200ms ease',
|
|
86
|
+
backgroundColor: 'rgba(8,12,21,0.95)',
|
|
87
|
+
border: '1px solid #00B8E666',
|
|
88
|
+
borderBottomWidth: 0,
|
|
89
|
+
borderTopLeftRadius: 6,
|
|
90
|
+
borderTopRightRadius: 6,
|
|
91
|
+
boxShadow: '0 -4px 8px rgba(0,0,0,0.3)'
|
|
92
|
+
},
|
|
93
|
+
children: availableEnvironments.map(env => {
|
|
94
|
+
const config = (0, _EnvironmentIndicatorWeb.getEnvironmentConfig)(env);
|
|
95
|
+
const isSelected = String(env).toLowerCase() === String(currentEnvironment).toLowerCase();
|
|
96
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
97
|
+
onClick: () => {
|
|
98
|
+
setExpanded(false);
|
|
99
|
+
onSelect(env);
|
|
100
|
+
},
|
|
101
|
+
onMouseEnter: () => setHoveredEnv(String(env)),
|
|
102
|
+
onMouseLeave: () => setHoveredEnv(null),
|
|
103
|
+
style: {
|
|
104
|
+
display: 'flex',
|
|
105
|
+
alignItems: 'center',
|
|
106
|
+
justifyContent: 'space-between',
|
|
107
|
+
width: '100%',
|
|
108
|
+
height: OPTION_HEIGHT,
|
|
109
|
+
padding: '0 10px',
|
|
110
|
+
background: isSelected ? 'rgba(128,128,128,0.1)' : hoveredEnv === String(env) ? 'rgba(128,128,128,0.2)' : 'none',
|
|
111
|
+
border: 'none',
|
|
112
|
+
cursor: 'pointer'
|
|
113
|
+
},
|
|
114
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
115
|
+
style: {
|
|
116
|
+
display: 'flex',
|
|
117
|
+
alignItems: 'center'
|
|
118
|
+
},
|
|
119
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
120
|
+
style: {
|
|
121
|
+
width: 6,
|
|
122
|
+
height: 6,
|
|
123
|
+
borderRadius: 3,
|
|
124
|
+
backgroundColor: config.backgroundColor,
|
|
125
|
+
marginRight: 8
|
|
126
|
+
}
|
|
127
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
128
|
+
style: {
|
|
129
|
+
fontSize: 10,
|
|
130
|
+
fontWeight: 600,
|
|
131
|
+
color: _gameUIColors.gameUIColors.primaryLight,
|
|
132
|
+
letterSpacing: 0.5
|
|
133
|
+
},
|
|
134
|
+
children: config.label
|
|
135
|
+
})]
|
|
136
|
+
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)(CheckGlyph, {})]
|
|
137
|
+
}, String(env));
|
|
138
|
+
})
|
|
139
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
140
|
+
onClick: () => setExpanded(e => !e),
|
|
141
|
+
"aria-expanded": expanded,
|
|
142
|
+
"aria-label": `Environment: ${current.label}. Click to switch.`,
|
|
143
|
+
style: {
|
|
144
|
+
display: 'flex',
|
|
145
|
+
alignItems: 'center',
|
|
146
|
+
gap: 6,
|
|
147
|
+
padding: '6px 6px 6px 8px',
|
|
148
|
+
borderRadius: 6,
|
|
149
|
+
// native: expanded trigger fuses with panel (squared top corners)
|
|
150
|
+
borderTopLeftRadius: expanded ? 0 : 6,
|
|
151
|
+
borderTopRightRadius: expanded ? 0 : 6,
|
|
152
|
+
backgroundColor: expanded ? 'rgba(8,12,21,0.95)' : 'transparent',
|
|
153
|
+
border: 'none',
|
|
154
|
+
cursor: 'pointer'
|
|
155
|
+
},
|
|
156
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
157
|
+
style: {
|
|
158
|
+
width: 8,
|
|
159
|
+
height: 8,
|
|
160
|
+
borderRadius: 4,
|
|
161
|
+
backgroundColor: current.backgroundColor,
|
|
162
|
+
boxShadow: `0 0 4px ${current.backgroundColor}99`
|
|
163
|
+
}
|
|
164
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
165
|
+
style: {
|
|
166
|
+
fontSize: 11,
|
|
167
|
+
fontWeight: 600,
|
|
168
|
+
color: _gameUIColors.gameUIColors.primaryLight,
|
|
169
|
+
letterSpacing: 0.5
|
|
170
|
+
},
|
|
171
|
+
children: current.label
|
|
172
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ChevronUpGlyph, {
|
|
173
|
+
color: "#7A8599",
|
|
174
|
+
flipped: expanded
|
|
175
|
+
})]
|
|
176
|
+
})]
|
|
177
|
+
});
|
|
178
|
+
}
|
|
@@ -7,7 +7,7 @@ exports.useNativeSafeAreaInsets = exports.safeAreaType = exports.hasSafeAreaPack
|
|
|
7
7
|
/**
|
|
8
8
|
* Auto-generated safe area implementation
|
|
9
9
|
* Detected: none
|
|
10
|
-
* Generated at: 2026-08-
|
|
10
|
+
* Generated at: 2026-08-06T20:33:57.771Z
|
|
11
11
|
*
|
|
12
12
|
* DO NOT EDIT - This file is generated by scripts/detect-safe-area.js
|
|
13
13
|
*
|
|
@@ -12,6 +12,8 @@ var _exportNames = {
|
|
|
12
12
|
CONSOLE_ICON_COLOR: true,
|
|
13
13
|
ImagesIcon: true,
|
|
14
14
|
IMAGES_ICON_COLOR: true,
|
|
15
|
+
AssetsIcon: true,
|
|
16
|
+
ASSETS_ICON_COLOR: true,
|
|
15
17
|
ImpersonateIcon: true,
|
|
16
18
|
IMPERSONATE_ICON_COLOR: true,
|
|
17
19
|
ImageOverlayIcon: true,
|
|
@@ -36,6 +38,18 @@ var _exportNames = {
|
|
|
36
38
|
BenchmarkIcon: true,
|
|
37
39
|
IconBackground: true
|
|
38
40
|
};
|
|
41
|
+
Object.defineProperty(exports, "ASSETS_ICON_COLOR", {
|
|
42
|
+
enumerable: true,
|
|
43
|
+
get: function () {
|
|
44
|
+
return _floatingToolsCore.ASSETS_ICON_COLOR;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
Object.defineProperty(exports, "AssetsIcon", {
|
|
48
|
+
enumerable: true,
|
|
49
|
+
get: function () {
|
|
50
|
+
return _floatingToolsCore.AssetsIcon;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
39
53
|
Object.defineProperty(exports, "BenchmarkIcon", {
|
|
40
54
|
enumerable: true,
|
|
41
55
|
get: function () {
|
package/lib/commonjs/index.js
CHANGED
|
@@ -599,12 +599,12 @@ Object.keys(_index0).forEach(function (key) {
|
|
|
599
599
|
});
|
|
600
600
|
});
|
|
601
601
|
var _index1 = require("./hooks/index.js");
|
|
602
|
-
var _JsModal = require("./JsModal
|
|
602
|
+
var _JsModal = require("./JsModal");
|
|
603
603
|
var _gameUIColors = require("./ui/gameUI/constants/gameUIColors.js");
|
|
604
604
|
var _macOSDesignSystemColors = require("./ui/gameUI/constants/macOSDesignSystemColors.js");
|
|
605
|
-
var _EnvironmentIndicator = require("./env/EnvironmentIndicator
|
|
605
|
+
var _EnvironmentIndicator = require("./env/EnvironmentIndicator");
|
|
606
606
|
var _EnvironmentSelector = require("./env/EnvironmentSelector.js");
|
|
607
|
-
var _EnvironmentSelectorInline = require("./env/EnvironmentSelectorInline
|
|
607
|
+
var _EnvironmentSelectorInline = require("./env/EnvironmentSelectorInline");
|
|
608
608
|
var _types = require("./types/types.js");
|
|
609
609
|
var _index10 = require("./context/index.js");
|
|
610
610
|
var _index11 = require("./history/index.js");
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DEFAULT_IGNORED_PATTERNS = void 0;
|
|
7
|
+
exports.isUrlIgnored = isUrlIgnored;
|
|
8
|
+
exports.urlMatchesIgnoredPattern = urlMatchesIgnoredPattern;
|
|
9
|
+
/**
|
|
10
|
+
* Pure, dependency-free part of the ignored-patterns feature — split from
|
|
11
|
+
* ignoredPatternsStore.ts so web consumers (which shim `@buoy-gg/shared-ui`
|
|
12
|
+
* and must not pull the store's relative `../utils/persistentStorage` import
|
|
13
|
+
* with its expo/async-storage requires into the bundle graph) can share the
|
|
14
|
+
* exact matching semantics. The store imports and re-exports everything here;
|
|
15
|
+
* the native barrel is unchanged.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* How a pattern matches a URL:
|
|
20
|
+
*
|
|
21
|
+
* - `contains`: case-insensitive substring match on the full URL (legacy behavior).
|
|
22
|
+
* - `exact`: smart equality — if pattern starts with `/`, matches URL.pathname;
|
|
23
|
+
* if it starts with `http://`/`https://`, matches origin+pathname; otherwise
|
|
24
|
+
* matches URL.host.
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** A single exclude pattern with its match mode. */
|
|
28
|
+
|
|
29
|
+
/** Patterns hidden by default — Buoy's own license API traffic. */
|
|
30
|
+
const DEFAULT_IGNORED_PATTERNS = exports.DEFAULT_IGNORED_PATTERNS = [{
|
|
31
|
+
value: "api.keygen.sh",
|
|
32
|
+
mode: "contains"
|
|
33
|
+
}];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Returns true when `url` matches the ignored `pattern` according to its mode.
|
|
37
|
+
*
|
|
38
|
+
* `contains` → case-insensitive substring on the full URL (legacy behavior).
|
|
39
|
+
* `exact` → smart equality: pattern starting with `/` compares URL.pathname,
|
|
40
|
+
* full URLs compare origin+pathname (ignoring query/hash), bare
|
|
41
|
+
* values compare URL.host. Falls back to literal equality if URL
|
|
42
|
+
* parsing fails (e.g. relative URLs).
|
|
43
|
+
*/
|
|
44
|
+
function urlMatchesIgnoredPattern(url, pattern) {
|
|
45
|
+
const lowerUrl = url.toLowerCase();
|
|
46
|
+
const lowerValue = pattern.value.toLowerCase();
|
|
47
|
+
if (pattern.mode === "contains") {
|
|
48
|
+
return lowerUrl.includes(lowerValue);
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const parsed = new URL(url);
|
|
52
|
+
if (lowerValue.startsWith("/")) {
|
|
53
|
+
return parsed.pathname.toLowerCase() === lowerValue;
|
|
54
|
+
}
|
|
55
|
+
if (lowerValue.startsWith("http://") || lowerValue.startsWith("https://")) {
|
|
56
|
+
return `${parsed.origin}${parsed.pathname}`.toLowerCase() === lowerValue;
|
|
57
|
+
}
|
|
58
|
+
return parsed.host.toLowerCase() === lowerValue;
|
|
59
|
+
} catch {
|
|
60
|
+
return lowerUrl === lowerValue;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** Convenience: does `url` match ANY of the ignored `patterns`? */
|
|
65
|
+
function isUrlIgnored(url, patterns) {
|
|
66
|
+
if (!url || patterns.length === 0) return false;
|
|
67
|
+
return patterns.some(pattern => urlMatchesIgnoredPattern(url, pattern));
|
|
68
|
+
}
|
|
@@ -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) {
|