@lytjs/renderer 6.4.0 → 6.6.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/index.d.cts CHANGED
@@ -11,7 +11,7 @@ export { SSRInput } from './ssr.cjs';
11
11
  export { escapeHtml, isBooleanAttr } from '@lytjs/common-string';
12
12
 
13
13
  /** 数据获取状态 */
14
- interface DataFetchState<T extends unknown = unknown> {
14
+ interface DataFetchState<T = unknown> {
15
15
  /** 数据 */
16
16
  data: T | undefined;
17
17
  /** 是否正在加载 */
@@ -24,7 +24,7 @@ interface DataFetchState<T extends unknown = unknown> {
24
24
  timestamp: number | null;
25
25
  }
26
26
  /** 数据获取选项 */
27
- interface DataFetchOptions<T extends unknown = unknown> {
27
+ interface DataFetchOptions<T = unknown> {
28
28
  /** 是否立即执行 */
29
29
  immediate?: boolean;
30
30
  /** 初始数据 */
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ export { SSRInput } from './ssr.js';
11
11
  export { escapeHtml, isBooleanAttr } from '@lytjs/common-string';
12
12
 
13
13
  /** 数据获取状态 */
14
- interface DataFetchState<T extends unknown = unknown> {
14
+ interface DataFetchState<T = unknown> {
15
15
  /** 数据 */
16
16
  data: T | undefined;
17
17
  /** 是否正在加载 */
@@ -24,7 +24,7 @@ interface DataFetchState<T extends unknown = unknown> {
24
24
  timestamp: number | null;
25
25
  }
26
26
  /** 数据获取选项 */
27
- interface DataFetchOptions<T extends unknown = unknown> {
27
+ interface DataFetchOptions<T = unknown> {
28
28
  /** 是否立即执行 */
29
29
  immediate?: boolean;
30
30
  /** 初始数据 */
package/dist/index.mjs CHANGED
@@ -100,9 +100,7 @@ async function hydrateElement(element, stats, _options) {
100
100
  for (const attr of eventAttrs) {
101
101
  element.removeAttribute(attr.name);
102
102
  }
103
- const directives = Array.from(element.attributes).filter(
104
- (attr) => attr.name.startsWith("v-")
105
- );
103
+ const directives = Array.from(element.attributes).filter((attr) => attr.name.startsWith("v-"));
106
104
  for (const attr of directives) {
107
105
  processDirective(element, attr.name, attr.value);
108
106
  }
@@ -1340,10 +1338,7 @@ __export(vapor_ssr_exports, {
1340
1338
  usePrefetchData: () => usePrefetchData
1341
1339
  });
1342
1340
  async function renderVaporToString(component, props = {}, options = {}) {
1343
- const {
1344
- includePrefetchScript = false,
1345
- serialize = defaultSerialize
1346
- } = options;
1341
+ const { includePrefetchScript = false, serialize = defaultSerialize } = options;
1347
1342
  const setupResult = await executeSetup(component, props);
1348
1343
  const compiledTemplate = compileTemplateForSSR(component.template);
1349
1344
  const html = renderTemplateToHTML(compiledTemplate, setupResult);
@@ -1353,9 +1348,7 @@ async function renderVaporToString(component, props = {}, options = {}) {
1353
1348
  }
1354
1349
  const scripts = [];
1355
1350
  if (includePrefetchScript && prefetchData) {
1356
- scripts.push(
1357
- `<script>window.__LYTJS_PREFETCH_DATA__=${serialize(prefetchData)};</script>`
1358
- );
1351
+ scripts.push(`<script>window.__LYTJS_PREFETCH_DATA__=${serialize(prefetchData)};</script>`);
1359
1352
  }
1360
1353
  return {
1361
1354
  html,
@@ -2534,9 +2527,7 @@ async function callServer(componentName, functionName, ...args) {
2534
2527
  body: JSON.stringify({ args })
2535
2528
  });
2536
2529
  if (!response.ok) {
2537
- throw new Error(
2538
- `Server action failed: ${response.status} ${response.statusText}`
2539
- );
2530
+ throw new Error(`Server action failed: ${response.status} ${response.statusText}`);
2540
2531
  }
2541
2532
  const result = await response.json();
2542
2533
  return result;
@@ -2845,13 +2836,7 @@ function useFetch(url, options = {}) {
2845
2836
  };
2846
2837
  }
2847
2838
  function useAsyncData(key, fetcher, options = {}) {
2848
- const {
2849
- immediate = true,
2850
- initialData,
2851
- transform,
2852
- onError,
2853
- onSuccess
2854
- } = options;
2839
+ const { immediate = true, initialData, transform, onError, onSuccess } = options;
2855
2840
  const data = ref(initialData);
2856
2841
  const pending = ref(false);
2857
2842
  const error2 = ref(null);