@jsenv/navi 0.3.5 → 0.4.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/dist/jsenv_navi.js +22 -7
- package/index.js +7 -2
- package/package.json +1 -1
- package/src/components/callout/callout.js +3 -2
- package/src/route/route.js +18 -4
package/dist/jsenv_navi.js
CHANGED
|
@@ -11735,6 +11735,7 @@ const openCallout = (
|
|
|
11735
11735
|
level = "warning",
|
|
11736
11736
|
onClose,
|
|
11737
11737
|
closeOnClickOutside = level === "info",
|
|
11738
|
+
hideErrorStack,
|
|
11738
11739
|
debug = false,
|
|
11739
11740
|
} = {},
|
|
11740
11741
|
) => {
|
|
@@ -11802,8 +11803,8 @@ const openCallout = (
|
|
|
11802
11803
|
if (Error.isError(newMessage)) {
|
|
11803
11804
|
const error = newMessage;
|
|
11804
11805
|
newMessage = error.message;
|
|
11805
|
-
if (error.stack) {
|
|
11806
|
-
newMessage += `<pre class="navi_callout_error_stack">${escapeHtml(error.stack)}</pre>`;
|
|
11806
|
+
if (!hideErrorStack && error.stack) {
|
|
11807
|
+
newMessage += `<pre class="navi_callout_error_stack">${escapeHtml(String(error.stack))}</pre>`;
|
|
11807
11808
|
}
|
|
11808
11809
|
}
|
|
11809
11810
|
|
|
@@ -16758,6 +16759,14 @@ let baseUrl = window.location.origin;
|
|
|
16758
16759
|
const setBaseUrl = (value) => {
|
|
16759
16760
|
baseUrl = new URL(value, window.location).href;
|
|
16760
16761
|
};
|
|
16762
|
+
|
|
16763
|
+
const encodedSymbol = Symbol("encoded_uri_component");
|
|
16764
|
+
const encodedURIComponent = (value) => {
|
|
16765
|
+
return {
|
|
16766
|
+
[encodedSymbol]: true,
|
|
16767
|
+
value,
|
|
16768
|
+
};
|
|
16769
|
+
};
|
|
16761
16770
|
const NO_PARAMS = { [SYMBOL_IDENTITY]: Symbol("no_params") };
|
|
16762
16771
|
// Controls what happens to actions when their route becomes inactive:
|
|
16763
16772
|
// 'abort' - Cancel the action immediately when route deactivates
|
|
@@ -17033,10 +17042,17 @@ const createRoute = (urlPatternInput) => {
|
|
|
17033
17042
|
const buildRelativeUrl = (params = {}) => {
|
|
17034
17043
|
let relativeUrl = urlPatternInput;
|
|
17035
17044
|
|
|
17045
|
+
const encode = (value) => {
|
|
17046
|
+
if (value && value[encodedSymbol]) {
|
|
17047
|
+
return value.value;
|
|
17048
|
+
}
|
|
17049
|
+
return encodeURIComponent(value);
|
|
17050
|
+
};
|
|
17051
|
+
|
|
17036
17052
|
// Replace named parameters (:param and {param})
|
|
17037
17053
|
for (const key of Object.keys(params)) {
|
|
17038
17054
|
const value = params[key];
|
|
17039
|
-
const encodedValue =
|
|
17055
|
+
const encodedValue = encode(value);
|
|
17040
17056
|
relativeUrl = relativeUrl.replace(`:${key}`, encodedValue);
|
|
17041
17057
|
relativeUrl = relativeUrl.replace(`{${key}}`, encodedValue);
|
|
17042
17058
|
}
|
|
@@ -17051,9 +17067,8 @@ const createRoute = (urlPatternInput) => {
|
|
|
17051
17067
|
let wildcardIndex = 0;
|
|
17052
17068
|
relativeUrl = relativeUrl.replace(/\*/g, () => {
|
|
17053
17069
|
const paramKey = wildcardIndex.toString();
|
|
17054
|
-
const
|
|
17055
|
-
|
|
17056
|
-
: "*";
|
|
17070
|
+
const paramValue = params[paramKey];
|
|
17071
|
+
const replacement = paramValue ? encode(paramValue) : "*";
|
|
17057
17072
|
wildcardIndex++;
|
|
17058
17073
|
return replacement;
|
|
17059
17074
|
});
|
|
@@ -27883,4 +27898,4 @@ const useDependenciesDiff = (inputs) => {
|
|
|
27883
27898
|
return diffRef.current;
|
|
27884
27899
|
};
|
|
27885
27900
|
|
|
27886
|
-
export { ActionRenderer, ActiveKeyboardShortcuts, Button, Checkbox, CheckboxList, Col, Colgroup, Details, Editable, ErrorBoundaryContext, FontSizedSvg, Form, IconAndText, Input, Label, Link, LinkWithIcon, Overflow, Radio, RadioList, Route, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, SummaryMarker, Tab, TabList, Table, TableCell, Tbody, TextAndCount, Thead, Tr, UITransition, actionIntegratedVia, addCustomMessage, createAction, createSelectionKeyboardShortcuts, createUniqueValueConstraint, defineRoutes, enableDebugActions, enableDebugOnDocumentLoading, goBack, goForward, goTo, isCellSelected, isColumnSelected, isRowSelected, openCallout, reload, removeCustomMessage, rerunActions, resource, setBaseUrl, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, valueInLocalStorage };
|
|
27901
|
+
export { ActionRenderer, ActiveKeyboardShortcuts, Button, Checkbox, CheckboxList, Col, Colgroup, Details, Editable, ErrorBoundaryContext, FontSizedSvg, Form, IconAndText, Input, Label, Link, LinkWithIcon, Overflow, Radio, RadioList, Route, RowNumberCol, RowNumberTableCell, SINGLE_SPACE_CONSTRAINT, SVGMaskOverlay, Select, SelectionContext, SummaryMarker, Tab, TabList, Table, TableCell, Tbody, TextAndCount, Thead, Tr, UITransition, actionIntegratedVia, addCustomMessage, createAction, createSelectionKeyboardShortcuts, createUniqueValueConstraint, defineRoutes, enableDebugActions, enableDebugOnDocumentLoading, encodedURIComponent, goBack, goForward, goTo, isCellSelected, isColumnSelected, isRowSelected, openCallout, reload, removeCustomMessage, rerunActions, resource, setBaseUrl, stopLoad, stringifyTableSelectionValue, updateActions, useActionData, useActionStatus, useCellsAndColumns, useDependenciesDiff, useDocumentState, useDocumentUrl, useEditionController, useFocusGroup, useKeyboardShortcuts, useNavState, useRouteStatus, useRunOnMount, useSelectableElement, useSelectionController, useSignalSync, useStateArray, valueInLocalStorage };
|
package/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export { useStateArray } from "./src/components/use_state_array.js";
|
|
|
12
12
|
export { resource } from "./src/store/resource_graph.js";
|
|
13
13
|
export { valueInLocalStorage } from "./src/store/value_in_local_storage.js";
|
|
14
14
|
|
|
15
|
-
//
|
|
15
|
+
// routing
|
|
16
16
|
export {
|
|
17
17
|
actionIntegratedVia,
|
|
18
18
|
goBack,
|
|
@@ -24,7 +24,12 @@ export {
|
|
|
24
24
|
} from "./src/browser_integration/browser_integration.js";
|
|
25
25
|
export { useDocumentState } from "./src/browser_integration/document_state_signal.js";
|
|
26
26
|
export { useDocumentUrl } from "./src/browser_integration/document_url_signal.js";
|
|
27
|
-
export {
|
|
27
|
+
export {
|
|
28
|
+
defineRoutes,
|
|
29
|
+
encodedURIComponent,
|
|
30
|
+
setBaseUrl,
|
|
31
|
+
useRouteStatus,
|
|
32
|
+
} from "./src/route/route.js";
|
|
28
33
|
|
|
29
34
|
// Components
|
|
30
35
|
export { ActionRenderer } from "./src/components/action_renderer.jsx";
|
package/package.json
CHANGED
|
@@ -48,6 +48,7 @@ export const openCallout = (
|
|
|
48
48
|
level = "warning",
|
|
49
49
|
onClose,
|
|
50
50
|
closeOnClickOutside = level === "info",
|
|
51
|
+
hideErrorStack,
|
|
51
52
|
debug = false,
|
|
52
53
|
} = {},
|
|
53
54
|
) => {
|
|
@@ -115,8 +116,8 @@ export const openCallout = (
|
|
|
115
116
|
if (Error.isError(newMessage)) {
|
|
116
117
|
const error = newMessage;
|
|
117
118
|
newMessage = error.message;
|
|
118
|
-
if (error.stack) {
|
|
119
|
-
newMessage += `<pre class="navi_callout_error_stack">${escapeHtml(error.stack)}</pre>`;
|
|
119
|
+
if (!hideErrorStack && error.stack) {
|
|
120
|
+
newMessage += `<pre class="navi_callout_error_stack">${escapeHtml(String(error.stack))}</pre>`;
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
|
package/src/route/route.js
CHANGED
|
@@ -13,6 +13,14 @@ export const setBaseUrl = (value) => {
|
|
|
13
13
|
baseUrl = new URL(value, window.location).href;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
+
const encodedSymbol = Symbol("encoded_uri_component");
|
|
17
|
+
export const encodedURIComponent = (value) => {
|
|
18
|
+
return {
|
|
19
|
+
[encodedSymbol]: true,
|
|
20
|
+
value,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
16
24
|
const DEBUG = false;
|
|
17
25
|
const NO_PARAMS = { [SYMBOL_IDENTITY]: Symbol("no_params") };
|
|
18
26
|
// Controls what happens to actions when their route becomes inactive:
|
|
@@ -301,10 +309,17 @@ const createRoute = (urlPatternInput) => {
|
|
|
301
309
|
const buildRelativeUrl = (params = {}) => {
|
|
302
310
|
let relativeUrl = urlPatternInput;
|
|
303
311
|
|
|
312
|
+
const encode = (value) => {
|
|
313
|
+
if (value && value[encodedSymbol]) {
|
|
314
|
+
return value.value;
|
|
315
|
+
}
|
|
316
|
+
return encodeURIComponent(value);
|
|
317
|
+
};
|
|
318
|
+
|
|
304
319
|
// Replace named parameters (:param and {param})
|
|
305
320
|
for (const key of Object.keys(params)) {
|
|
306
321
|
const value = params[key];
|
|
307
|
-
const encodedValue =
|
|
322
|
+
const encodedValue = encode(value);
|
|
308
323
|
relativeUrl = relativeUrl.replace(`:${key}`, encodedValue);
|
|
309
324
|
relativeUrl = relativeUrl.replace(`{${key}}`, encodedValue);
|
|
310
325
|
}
|
|
@@ -319,9 +334,8 @@ const createRoute = (urlPatternInput) => {
|
|
|
319
334
|
let wildcardIndex = 0;
|
|
320
335
|
relativeUrl = relativeUrl.replace(/\*/g, () => {
|
|
321
336
|
const paramKey = wildcardIndex.toString();
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
: "*";
|
|
337
|
+
const paramValue = params[paramKey];
|
|
338
|
+
const replacement = paramValue ? encode(paramValue) : "*";
|
|
325
339
|
wildcardIndex++;
|
|
326
340
|
return replacement;
|
|
327
341
|
});
|