Skip to content

Commit 3c1567d

Browse files
committed
[svelte] Wrap
1 parent 39bdcf0 commit 3c1567d

32 files changed

Lines changed: 190 additions & 217 deletions

.prettierrc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@
22
"bracketSpacing": false,
33
"singleQuote": true,
44
"trailingComma": "all",
5-
"plugins": [
6-
"prettier-plugin-organize-imports",
7-
"prettier-plugin-svelte"
8-
]
9-
}
5+
"plugins": ["prettier-plugin-organize-imports", "prettier-plugin-svelte"]
6+
}

coverage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"tests":7741,"assertions":33099,"lines":{"total":2614,"covered":2613,"skipped":0,"pct":99.96},"statements":{"total":2840,"covered":2839,"skipped":0,"pct":99.96},"functions":{"total":1157,"covered":1156,"skipped":0,"pct":99.91},"branches":{"total":1008,"covered":1008,"skipped":0,"pct":100},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}
1+
{"tests":4684,"assertions":25352,"lines":{"total":2614,"covered":2600,"skipped":0,"pct":99.46},"statements":{"total":2840,"covered":2820,"skipped":0,"pct":99.29},"functions":{"total":1157,"covered":1137,"skipped":0,"pct":98.27},"branches":{"total":1010,"covered":1004,"skipped":0,"pct":99.4},"branchesTrue":{"total":0,"covered":0,"skipped":0,"pct":100}}

gulpfile.mjs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,7 @@ const lintCheckFiles = async (dir) => {
341341
: {...prettierConfig, filepath: filePath};
342342
const code = await promises.readFile(filePath, UTF8);
343343
if (!(await prettier.check(code, fileConfig))) {
344-
writeFileSync(
345-
filePath,
346-
await prettier.format(code, fileConfig),
347-
UTF8,
348-
);
344+
writeFileSync(filePath, await prettier.format(code, fileConfig), UTF8);
349345
}
350346
});
351347

src/ui-react/CellView.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {
33
CellView as CellViewDecl,
44
} from '../@types/ui-react/index.d.ts';
55
import {EMPTY_STRING} from '../common/strings.ts';
6-
import {wrap} from './common/wrap.tsx';
6+
import {Wrap} from './common/Wrap.tsx';
77
import {useCell} from './hooks.ts';
88

99
export const CellView: typeof CellViewDecl = ({
@@ -12,10 +12,8 @@ export const CellView: typeof CellViewDecl = ({
1212
cellId,
1313
store,
1414
debugIds,
15-
}: CellProps): any =>
16-
wrap(
17-
EMPTY_STRING + (useCell(tableId, rowId, cellId, store) ?? EMPTY_STRING),
18-
undefined,
19-
debugIds,
20-
cellId,
21-
);
15+
}: CellProps): any => (
16+
<Wrap debugIds={debugIds} id={cellId}>
17+
{EMPTY_STRING + (useCell(tableId, rowId, cellId, store) ?? EMPTY_STRING)}
18+
</Wrap>
19+
);

src/ui-react/CheckpointView.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ import type {
33
CheckpointView as CheckpointViewDecl,
44
} from '../@types/ui-react/index.d.ts';
55
import {EMPTY_STRING} from '../common/strings.ts';
6-
import {wrap} from './common/wrap.tsx';
6+
import {Wrap} from './common/Wrap.tsx';
77
import {useCheckpoint} from './hooks.ts';
88

99
export const CheckpointView: typeof CheckpointViewDecl = ({
1010
checkpoints,
1111
checkpointId,
1212
debugIds,
13-
}: CheckpointProps): any =>
14-
wrap(
15-
useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING,
16-
undefined,
17-
debugIds,
18-
checkpointId,
19-
);
13+
}: CheckpointProps): any => (
14+
<Wrap debugIds={debugIds} id={checkpointId}>
15+
{useCheckpoint(checkpointId, checkpoints) ?? EMPTY_STRING}
16+
</Wrap>
17+
);

src/ui-react/IndexView.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
} from '../@types/ui-react/index.d.ts';
55
import {arrayMap} from '../common/array.ts';
66
import {getProps} from '../common/react.ts';
7-
import {wrap} from './common/wrap.tsx';
7+
import {Wrap} from './common/Wrap.tsx';
88
import {useSliceIds} from './hooks.ts';
99
import {SliceView} from './SliceView.tsx';
1010

@@ -15,9 +15,9 @@ export const IndexView: typeof IndexViewDecl = ({
1515
getSliceComponentProps,
1616
separator,
1717
debugIds,
18-
}: IndexProps): any =>
19-
wrap(
20-
arrayMap(useSliceIds(indexId, indexes), (sliceId) => (
18+
}: IndexProps): any => (
19+
<Wrap separator={separator} debugIds={debugIds} id={indexId}>
20+
{arrayMap(useSliceIds(indexId, indexes), (sliceId) => (
2121
<Slice
2222
key={sliceId}
2323
{...getProps(getSliceComponentProps, sliceId)}
@@ -26,8 +26,6 @@ export const IndexView: typeof IndexViewDecl = ({
2626
indexes={indexes}
2727
debugIds={debugIds}
2828
/>
29-
)),
30-
separator,
31-
debugIds,
32-
indexId,
33-
);
29+
))}
30+
</Wrap>
31+
);

src/ui-react/MetricView.tsx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,15 @@ import type {
33
MetricView as MetricViewDecl,
44
} from '../@types/ui-react/index.d.ts';
55
import {EMPTY_STRING} from '../common/strings.ts';
6-
import {wrap} from './common/wrap.tsx';
6+
import {Wrap} from './common/Wrap.tsx';
77
import {useMetric} from './hooks.ts';
88

99
export const MetricView: typeof MetricViewDecl = ({
1010
metricId,
1111
metrics,
1212
debugIds,
13-
}: MetricProps): any =>
14-
wrap(
15-
useMetric(metricId, metrics) ?? EMPTY_STRING,
16-
undefined,
17-
debugIds,
18-
metricId,
19-
);
13+
}: MetricProps): any => (
14+
<Wrap debugIds={debugIds} id={metricId}>
15+
{useMetric(metricId, metrics) ?? EMPTY_STRING}
16+
</Wrap>
17+
);

src/ui-react/RemoteRowView.tsx

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type {
55
} from '../@types/ui-react/index.d.ts';
66
import {isUndefined} from '../common/other.ts';
77
import {getProps, getRelationshipsStoreTableIds} from '../common/react.ts';
8-
import {wrap} from './common/wrap.tsx';
8+
import {Wrap} from './common/Wrap.tsx';
99
import {useRelationshipsOrRelationshipsById, useRemoteRowId} from './hooks.ts';
1010
import {RowView} from './RowView.tsx';
1111

@@ -27,19 +27,18 @@ export const RemoteRowView: typeof RemoteRowViewDecl = ({
2727
localRowId,
2828
resolvedRelationships,
2929
);
30-
return wrap(
31-
isUndefined(remoteTableId) || isUndefined(rowId) ? null : (
32-
<Row
33-
key={rowId}
34-
{...getProps(getRowComponentProps, rowId as Id)}
35-
tableId={remoteTableId}
36-
rowId={rowId}
37-
store={store}
38-
debugIds={debugIds}
39-
/>
40-
),
41-
undefined,
42-
debugIds,
43-
localRowId,
30+
return (
31+
<Wrap debugIds={debugIds} id={localRowId}>
32+
{isUndefined(remoteTableId) || isUndefined(rowId) ? null : (
33+
<Row
34+
key={rowId}
35+
{...getProps(getRowComponentProps, rowId as Id)}
36+
tableId={remoteTableId}
37+
rowId={rowId}
38+
store={store}
39+
debugIds={debugIds}
40+
/>
41+
)}
42+
</Wrap>
4443
);
4544
};

src/ui-react/ResultCellView.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type {
33
ResultCellView as ResultCellViewDecl,
44
} from '../@types/ui-react/index.d.ts';
55
import {EMPTY_STRING} from '../common/strings.ts';
6-
import {wrap} from './common/wrap.tsx';
6+
import {Wrap} from './common/Wrap.tsx';
77
import {useResultCell} from './hooks.ts';
88

99
export const ResultCellView: typeof ResultCellViewDecl = ({
@@ -12,11 +12,9 @@ export const ResultCellView: typeof ResultCellViewDecl = ({
1212
cellId,
1313
queries,
1414
debugIds,
15-
}: ResultCellProps): any =>
16-
wrap(
17-
EMPTY_STRING +
18-
(useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING),
19-
undefined,
20-
debugIds,
21-
cellId,
22-
);
15+
}: ResultCellProps): any => (
16+
<Wrap debugIds={debugIds} id={cellId}>
17+
{EMPTY_STRING +
18+
(useResultCell(queryId, rowId, cellId, queries) ?? EMPTY_STRING)}
19+
</Wrap>
20+
);

src/ui-react/ResultRowView.tsx

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
} from '../@types/ui-react/index.d.ts';
55
import {arrayMap} from '../common/array.ts';
66
import {getProps} from '../common/react.ts';
7-
import {wrap} from './common/wrap.tsx';
7+
import {Wrap} from './common/Wrap.tsx';
88
import {useResultCellIds} from './hooks.ts';
99
import {ResultCellView} from './ResultCellView.tsx';
1010

@@ -16,9 +16,9 @@ export const ResultRowView: typeof ResultRowViewDecl = ({
1616
getResultCellComponentProps,
1717
separator,
1818
debugIds,
19-
}: ResultRowProps): any =>
20-
wrap(
21-
arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) => (
19+
}: ResultRowProps): any => (
20+
<Wrap separator={separator} debugIds={debugIds} id={rowId}>
21+
{arrayMap(useResultCellIds(queryId, rowId, queries), (cellId) => (
2222
<ResultCell
2323
key={cellId}
2424
{...getProps(getResultCellComponentProps, cellId)}
@@ -28,8 +28,6 @@ export const ResultRowView: typeof ResultRowViewDecl = ({
2828
queries={queries}
2929
debugIds={debugIds}
3030
/>
31-
)),
32-
separator,
33-
debugIds,
34-
rowId,
35-
);
31+
))}
32+
</Wrap>
33+
);

0 commit comments

Comments
 (0)