@redneckz/wildless-cms-uni-blocks 0.14.770 → 0.14.771

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.
@@ -231,30 +231,19 @@
231
231
  return /^[a-f0-9]{8}-[a-f0-9]{4}-4[a-f0-9]{3}-[89aAbB][a-f0-9]{3}-[a-f0-9]{12}(\/revs\/[0-9]{1,20})?$/.test(src);
232
232
  };
233
233
 
234
- const PLACEHOLDER = 'http://_';
235
- const joinPath = (...path) => {
236
- const urls = path.filter(Boolean).map((_) => new URL(_, PLACEHOLDER));
237
- const origin = urls.find((_) => _.origin !== PLACEHOLDER)?.origin;
238
- const pathname = cleanPath(urls.map((_) => _.pathname));
239
- const query = joinSearchParams(...urls.map((_) => _.searchParams)).toString();
240
- const hash = urls.find((_) => _.hash)?.hash;
241
- return [origin, pathname, query ? `?${query}` : '', hash].filter(Boolean).join('');
242
- };
243
- const joinSearchParams = (...list) => {
244
- const result = new URLSearchParams();
245
- for (const searchParams of list) {
246
- for (const [k, v] of searchParams) {
247
- result.set(k, v);
248
- }
249
- }
250
- return result;
251
- };
252
- const cleanPath = (pathParts) => pathParts.join('/').replace(/\/+/g, '/');
253
-
254
234
  const isURL = (href) => Boolean(href?.includes(':'));
255
235
  const isLocalURL = (href, target) => Boolean(href && !isURL(href) && (!target || target === '_self'));
256
236
  const isHash = (href) => Boolean(href?.startsWith('#'));
257
237
  const withoutQuery = (href) => (href ?? '').replace(/\?.*/, '').replace(/\/$/, '');
238
+ const joinPath = (...path) => path
239
+ .filter(Boolean)
240
+ .join('/')
241
+ .replace(/\/+/g, '/')
242
+ .replace(/^(.+):\//, '$1://') // TODO Череда очень странных преобрвзований
243
+ .replace(/^file:/, 'file:/')
244
+ .replace(/\/(\?|&|#[^!])/g, '$1')
245
+ .replace(/\?/g, '&')
246
+ .replace('&', '?');
258
247
  const hasPrefix = (href) => (prefix) => Boolean(href &&
259
248
  prefix &&
260
249
  href.startsWith(prefix) &&
@@ -266,8 +255,8 @@
266
255
  isLocalURL: isLocalURL,
267
256
  isHash: isHash,
268
257
  withoutQuery: withoutQuery,
269
- hasPrefix: hasPrefix,
270
- joinPath: joinPath
258
+ joinPath: joinPath,
259
+ hasPrefix: hasPrefix
271
260
  });
272
261
 
273
262
  const API_PREFIX = '/api/';
@@ -7009,7 +6998,7 @@
7009
6998
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
7010
6999
  });
7011
7000
 
7012
- const packageVersion = "0.14.769";
7001
+ const packageVersion = "0.14.770";
7013
7002
 
7014
7003
  exports.Blocks = Blocks;
7015
7004
  exports.ContentPage = ContentPage;