@jsenv/navi 0.12.39 → 0.12.41

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.
@@ -7741,6 +7741,7 @@ const createRoute = (urlPatternInput) => {
7741
7741
  hasRawUrlPartWithInvalidChars,
7742
7742
  };
7743
7743
  };
7744
+ route.buildRelativeUrl = buildRelativeUrl;
7744
7745
 
7745
7746
  /**
7746
7747
  * Builds a complete URL for this route with the given parameters.
@@ -8120,6 +8121,37 @@ const updateDocumentUrl = (value) => {
8120
8121
  documentUrlSignal.value = value;
8121
8122
  };
8122
8123
 
8124
+ computed(() => {
8125
+ const documentUrl = documentUrlSignal.value;
8126
+ const documentResource = urlToResource(documentUrl);
8127
+ return documentResource;
8128
+ });
8129
+ const urlToResource = (url) => {
8130
+ const scheme = urlToScheme(url);
8131
+ if (scheme === "file") {
8132
+ const urlAsStringWithoutFileProtocol = String(url).slice("file://".length);
8133
+ return urlAsStringWithoutFileProtocol;
8134
+ }
8135
+ if (scheme === "https" || scheme === "http") {
8136
+ // remove origin
8137
+ const afterProtocol = String(url).slice(scheme.length + "://".length);
8138
+ const pathnameSlashIndex = afterProtocol.indexOf("/", "://".length);
8139
+ const urlAsStringWithoutOrigin = afterProtocol.slice(pathnameSlashIndex);
8140
+ return urlAsStringWithoutOrigin;
8141
+ }
8142
+ const urlAsStringWithoutProtocol = String(url).slice(scheme.length + 1);
8143
+ return urlAsStringWithoutProtocol;
8144
+ };
8145
+ const urlToScheme = (url) => {
8146
+ const urlString = String(url);
8147
+ const colonIndex = urlString.indexOf(":");
8148
+ if (colonIndex === -1) {
8149
+ return "";
8150
+ }
8151
+ const scheme = urlString.slice(0, colonIndex);
8152
+ return scheme;
8153
+ };
8154
+
8123
8155
  const getHrefTargetInfo = (href) => {
8124
8156
  href = String(href);
8125
8157
 
@@ -8340,7 +8372,8 @@ const setupBrowserIntegrationViaHistory = ({
8340
8372
  });
8341
8373
  });
8342
8374
 
8343
- const goTo = async (url, { state = null, replace } = {}) => {
8375
+ const goTo = async (target, { state = null, replace } = {}) => {
8376
+ const url = new URL(target, window.location.href).href;
8344
8377
  const currentUrl = documentUrlSignal.peek();
8345
8378
  if (url === currentUrl) {
8346
8379
  return;
@@ -8566,11 +8599,11 @@ const useNavStateBasic = (id, initialValue, { debug } = {}) => {
8566
8599
  const useNavState = useNavStateBasic;
8567
8600
 
8568
8601
  const NEVER_SET = {};
8569
- const useUrlSearchParam = (paramName) => {
8602
+ const useUrlSearchParam = (paramName, defaultValue) => {
8570
8603
  const documentUrl = documentUrlSignal.value;
8571
8604
  const searchParam = new URL(documentUrl).searchParams.get(paramName);
8572
8605
  const valueRef = useRef(NEVER_SET);
8573
- const [value, setValue] = useState();
8606
+ const [value, setValue] = useState(defaultValue);
8574
8607
  if (valueRef.current !== searchParam) {
8575
8608
  valueRef.current = searchParam;
8576
8609
  setValue(searchParam);
@@ -16176,7 +16209,7 @@ const InputCheckboxBasic = props => {
16176
16209
  ...rest
16177
16210
  } = props;
16178
16211
  const defaultRef = useRef();
16179
- const ref = props.ref || defaultRef;
16212
+ const ref = rest.ref || defaultRef;
16180
16213
  const innerName = name || contextFieldName;
16181
16214
  const innerDisabled = disabled || contextDisabled;
16182
16215
  const innerRequired = required || contextRequired;
@@ -16233,7 +16266,7 @@ const InputCheckboxBasic = props => {
16233
16266
  return jsxs(Box, {
16234
16267
  as: "span",
16235
16268
  ...rest,
16236
- ref: ref,
16269
+ ref: undefined,
16237
16270
  baseClassName: "navi_checkbox",
16238
16271
  pseudoStateSelector: ".navi_native_field",
16239
16272
  styleCSSVars: CheckboxStyleCSSVars,
@@ -16582,7 +16615,7 @@ const InputRadioBasic = props => {
16582
16615
  ...rest
16583
16616
  } = props;
16584
16617
  const defaultRef = useRef();
16585
- const ref = props.ref || defaultRef;
16618
+ const ref = rest.ref || defaultRef;
16586
16619
  const innerName = name || contextName;
16587
16620
  const innerDisabled = disabled || contextDisabled;
16588
16621
  const innerRequired = required || contextRequired;
@@ -16666,7 +16699,7 @@ const InputRadioBasic = props => {
16666
16699
  return jsxs(Box, {
16667
16700
  as: "span",
16668
16701
  ...rest,
16669
- ref: ref,
16702
+ ref: undefined,
16670
16703
  baseClassName: "navi_radio",
16671
16704
  pseudoStateSelector: ".navi_native_field",
16672
16705
  styleCSSVars: RadioStyleCSSVars,
@@ -16907,7 +16940,7 @@ const InputTextualBasic = props => {
16907
16940
  ...rest
16908
16941
  } = props;
16909
16942
  const defaultRef = useRef();
16910
- const ref = props.ref || defaultRef;
16943
+ const ref = rest.ref || defaultRef;
16911
16944
  const innerValue = type === "datetime-local" ? convertToLocalTimezone(uiState) : uiState;
16912
16945
  const innerLoading = loading || contextLoading && contextLoadingElement === ref.current;
16913
16946
  const innerReadOnly = readOnly || contextReadOnly || innerLoading || uiStateController.readOnly;
@@ -16968,6 +17001,7 @@ const InputTextualBasic = props => {
16968
17001
  pseudoElements: InputPseudoElements,
16969
17002
  hasChildFunction: true,
16970
17003
  ...rest,
17004
+ ref: undefined,
16971
17005
  children: [jsx(LoaderBackground, {
16972
17006
  loading: innerLoading,
16973
17007
  color: "var(--loader-color)",