@jsenv/navi 0.3.4 → 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 +24 -13
- package/index.js +7 -2
- package/package.json +1 -1
- package/src/components/callout/callout.js +4 -5
- package/src/route/route.js +18 -4
package/dist/jsenv_navi.js
CHANGED
|
@@ -8350,10 +8350,9 @@ const getInnerWidth = (element) => {
|
|
|
8350
8350
|
installImportMetaCss(import.meta);
|
|
8351
8351
|
import.meta.css = /* css */ `
|
|
8352
8352
|
.ui_transition_container {
|
|
8353
|
+
position: relative;
|
|
8353
8354
|
display: inline-flex;
|
|
8354
8355
|
flex: 1;
|
|
8355
|
-
position: relative;
|
|
8356
|
-
overflow: hidden;
|
|
8357
8356
|
}
|
|
8358
8357
|
|
|
8359
8358
|
.ui_transition_outer_wrapper {
|
|
@@ -8362,7 +8361,6 @@ import.meta.css = /* css */ `
|
|
|
8362
8361
|
}
|
|
8363
8362
|
|
|
8364
8363
|
.ui_transition_measure_wrapper {
|
|
8365
|
-
overflow: hidden;
|
|
8366
8364
|
display: inline-flex;
|
|
8367
8365
|
flex: 1;
|
|
8368
8366
|
}
|
|
@@ -11737,6 +11735,7 @@ const openCallout = (
|
|
|
11737
11735
|
level = "warning",
|
|
11738
11736
|
onClose,
|
|
11739
11737
|
closeOnClickOutside = level === "info",
|
|
11738
|
+
hideErrorStack,
|
|
11740
11739
|
debug = false,
|
|
11741
11740
|
} = {},
|
|
11742
11741
|
) => {
|
|
@@ -11804,7 +11803,9 @@ const openCallout = (
|
|
|
11804
11803
|
if (Error.isError(newMessage)) {
|
|
11805
11804
|
const error = newMessage;
|
|
11806
11805
|
newMessage = error.message;
|
|
11807
|
-
|
|
11806
|
+
if (!hideErrorStack && error.stack) {
|
|
11807
|
+
newMessage += `<pre class="navi_callout_error_stack">${escapeHtml(String(error.stack))}</pre>`;
|
|
11808
|
+
}
|
|
11808
11809
|
}
|
|
11809
11810
|
|
|
11810
11811
|
// Check if the message is a full HTML document (starts with DOCTYPE)
|
|
@@ -11813,8 +11814,6 @@ const openCallout = (
|
|
|
11813
11814
|
const iframe = document.createElement("iframe");
|
|
11814
11815
|
iframe.style.border = "none";
|
|
11815
11816
|
iframe.style.width = "100%";
|
|
11816
|
-
iframe.style.minHeight = "200px";
|
|
11817
|
-
iframe.style.maxHeight = "400px";
|
|
11818
11817
|
iframe.style.backgroundColor = "white";
|
|
11819
11818
|
iframe.srcdoc = newMessage;
|
|
11820
11819
|
|
|
@@ -12084,8 +12083,6 @@ import.meta.css = /* css */ `
|
|
|
12084
12083
|
.navi_callout_message iframe {
|
|
12085
12084
|
display: block;
|
|
12086
12085
|
margin: 0;
|
|
12087
|
-
border: 1px solid #ddd;
|
|
12088
|
-
border-radius: 4px;
|
|
12089
12086
|
}
|
|
12090
12087
|
.navi_callout_close_button_column {
|
|
12091
12088
|
display: flex;
|
|
@@ -16762,6 +16759,14 @@ let baseUrl = window.location.origin;
|
|
|
16762
16759
|
const setBaseUrl = (value) => {
|
|
16763
16760
|
baseUrl = new URL(value, window.location).href;
|
|
16764
16761
|
};
|
|
16762
|
+
|
|
16763
|
+
const encodedSymbol = Symbol("encoded_uri_component");
|
|
16764
|
+
const encodedURIComponent = (value) => {
|
|
16765
|
+
return {
|
|
16766
|
+
[encodedSymbol]: true,
|
|
16767
|
+
value,
|
|
16768
|
+
};
|
|
16769
|
+
};
|
|
16765
16770
|
const NO_PARAMS = { [SYMBOL_IDENTITY]: Symbol("no_params") };
|
|
16766
16771
|
// Controls what happens to actions when their route becomes inactive:
|
|
16767
16772
|
// 'abort' - Cancel the action immediately when route deactivates
|
|
@@ -17037,10 +17042,17 @@ const createRoute = (urlPatternInput) => {
|
|
|
17037
17042
|
const buildRelativeUrl = (params = {}) => {
|
|
17038
17043
|
let relativeUrl = urlPatternInput;
|
|
17039
17044
|
|
|
17045
|
+
const encode = (value) => {
|
|
17046
|
+
if (value && value[encodedSymbol]) {
|
|
17047
|
+
return value.value;
|
|
17048
|
+
}
|
|
17049
|
+
return encodeURIComponent(value);
|
|
17050
|
+
};
|
|
17051
|
+
|
|
17040
17052
|
// Replace named parameters (:param and {param})
|
|
17041
17053
|
for (const key of Object.keys(params)) {
|
|
17042
17054
|
const value = params[key];
|
|
17043
|
-
const encodedValue =
|
|
17055
|
+
const encodedValue = encode(value);
|
|
17044
17056
|
relativeUrl = relativeUrl.replace(`:${key}`, encodedValue);
|
|
17045
17057
|
relativeUrl = relativeUrl.replace(`{${key}}`, encodedValue);
|
|
17046
17058
|
}
|
|
@@ -17055,9 +17067,8 @@ const createRoute = (urlPatternInput) => {
|
|
|
17055
17067
|
let wildcardIndex = 0;
|
|
17056
17068
|
relativeUrl = relativeUrl.replace(/\*/g, () => {
|
|
17057
17069
|
const paramKey = wildcardIndex.toString();
|
|
17058
|
-
const
|
|
17059
|
-
|
|
17060
|
-
: "*";
|
|
17070
|
+
const paramValue = params[paramKey];
|
|
17071
|
+
const replacement = paramValue ? encode(paramValue) : "*";
|
|
17061
17072
|
wildcardIndex++;
|
|
17062
17073
|
return replacement;
|
|
17063
17074
|
});
|
|
@@ -27887,4 +27898,4 @@ const useDependenciesDiff = (inputs) => {
|
|
|
27887
27898
|
return diffRef.current;
|
|
27888
27899
|
};
|
|
27889
27900
|
|
|
27890
|
-
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,7 +116,9 @@ export const openCallout = (
|
|
|
115
116
|
if (Error.isError(newMessage)) {
|
|
116
117
|
const error = newMessage;
|
|
117
118
|
newMessage = error.message;
|
|
118
|
-
|
|
119
|
+
if (!hideErrorStack && error.stack) {
|
|
120
|
+
newMessage += `<pre class="navi_callout_error_stack">${escapeHtml(String(error.stack))}</pre>`;
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
123
|
|
|
121
124
|
// Check if the message is a full HTML document (starts with DOCTYPE)
|
|
@@ -124,8 +127,6 @@ export const openCallout = (
|
|
|
124
127
|
const iframe = document.createElement("iframe");
|
|
125
128
|
iframe.style.border = "none";
|
|
126
129
|
iframe.style.width = "100%";
|
|
127
|
-
iframe.style.minHeight = "200px";
|
|
128
|
-
iframe.style.maxHeight = "400px";
|
|
129
130
|
iframe.style.backgroundColor = "white";
|
|
130
131
|
iframe.srcdoc = newMessage;
|
|
131
132
|
|
|
@@ -395,8 +396,6 @@ import.meta.css = /* css */ `
|
|
|
395
396
|
.navi_callout_message iframe {
|
|
396
397
|
display: block;
|
|
397
398
|
margin: 0;
|
|
398
|
-
border: 1px solid #ddd;
|
|
399
|
-
border-radius: 4px;
|
|
400
399
|
}
|
|
401
400
|
.navi_callout_close_button_column {
|
|
402
401
|
display: flex;
|
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
|
});
|