handoff-app 1.2.2-4 → 1.2.2-6
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/Changelog.md +5 -0
- package/dist/transformers/preview/component.d.ts +1 -1
- package/dist/transformers/preview/component.js +1 -1
- package/package.json +1 -1
- package/src/app/components/Component/ComponentLists.tsx +1 -1
- package/src/app/components/Component/Preview.tsx +3 -1
- package/src/app/components/context/PreviewContext.tsx +1 -1
- package/src/transformers/preview/component.ts +2 -2
package/Changelog.md
CHANGED
|
@@ -12,6 +12,11 @@ This patch release clears ESLint failures in the Next.js app pages and aligns
|
|
|
12
12
|
several code paths with the compiler target so production builds succeed without
|
|
13
13
|
enabling `--downlevelIteration`.
|
|
14
14
|
|
|
15
|
+
### Change
|
|
16
|
+
|
|
17
|
+
* Altered the avaliable types to the SlotMetadata so the default can handle
|
|
18
|
+
a wide variaty of types - `default?: string | number | boolean | object | any[] | null;`
|
|
19
|
+
|
|
15
20
|
### Lint and code quality
|
|
16
21
|
|
|
17
22
|
* Resolved `no-else-return`, `no-unused-vars`, `camelcase`, `prefer-const`,
|
|
@@ -16,10 +16,10 @@ exports.getComponentOutputPath = exports.SlotType = void 0;
|
|
|
16
16
|
exports.componentTransformer = componentTransformer;
|
|
17
17
|
const path_1 = __importDefault(require("path"));
|
|
18
18
|
const api_1 = require("./component/api");
|
|
19
|
-
const summary_1 = __importDefault(require("./component/summary"));
|
|
20
19
|
const builder_1 = __importDefault(require("./component/builder"));
|
|
21
20
|
const css_1 = require("./component/css");
|
|
22
21
|
const javascript_1 = require("./component/javascript");
|
|
22
|
+
const summary_1 = __importDefault(require("./component/summary"));
|
|
23
23
|
var SlotType;
|
|
24
24
|
(function (SlotType) {
|
|
25
25
|
SlotType["TEXT"] = "text";
|
package/package.json
CHANGED
|
@@ -42,7 +42,7 @@ export const ComponentList = ({
|
|
|
42
42
|
const [groupedList, setGroupedList] = React.useState<Record<string, PreviewObject[]>>({});
|
|
43
43
|
|
|
44
44
|
const categories = React.useMemo(() => {
|
|
45
|
-
const categories = new Set(components.map((component) => component.group).flat());
|
|
45
|
+
const categories = new Set(components.map((component) => component.group).flat().filter((g): g is string => !!g));
|
|
46
46
|
return Array.from(categories);
|
|
47
47
|
}, [components]);
|
|
48
48
|
|
|
@@ -78,10 +78,12 @@ export const ComponentDisplay: React.FC<{
|
|
|
78
78
|
const variantMap: Record<string, Set<string>> = {};
|
|
79
79
|
Object.values(component.previews).forEach((preview: any) => {
|
|
80
80
|
Object.entries(preview.values).forEach(([key, value]) => {
|
|
81
|
+
const strValue = String(value);
|
|
82
|
+
if (!strValue) return;
|
|
81
83
|
if (!variantMap[key]) {
|
|
82
84
|
variantMap[key] = new Set();
|
|
83
85
|
}
|
|
84
|
-
variantMap[key].add(
|
|
86
|
+
variantMap[key].add(strValue);
|
|
85
87
|
});
|
|
86
88
|
});
|
|
87
89
|
|
|
@@ -33,13 +33,13 @@ function groupVariantProperties(items: Record<string, string>[]): Record<string,
|
|
|
33
33
|
|
|
34
34
|
for (const item of items) {
|
|
35
35
|
for (const [key, value] of Object.entries(item)) {
|
|
36
|
+
if (typeof value !== 'string' || value === '') continue;
|
|
36
37
|
(grouped[key] ||= new Set()).add(value);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
return Object.fromEntries(
|
|
41
42
|
Object.entries(grouped).map(([key, set]) => [key, Array.from(set)])
|
|
42
|
-
// .filter((i) => i[1].length > 1)
|
|
43
43
|
);
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -2,10 +2,10 @@ import type { DocAnnotation, TypeNode } from 'handoff-docgen';
|
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import Handoff from '../../index';
|
|
4
4
|
import { getAPIPath } from './component/api';
|
|
5
|
-
import writeComponentSummaryAPI from './component/summary';
|
|
6
5
|
import processComponents from './component/builder';
|
|
7
6
|
import { buildMainCss } from './component/css';
|
|
8
7
|
import { buildMainJS } from './component/javascript';
|
|
8
|
+
import writeComponentSummaryAPI from './component/summary';
|
|
9
9
|
|
|
10
10
|
export interface ComponentMetadata {
|
|
11
11
|
title: string;
|
|
@@ -33,7 +33,7 @@ export interface SlotMetadata {
|
|
|
33
33
|
name: string;
|
|
34
34
|
description: string;
|
|
35
35
|
generic: string;
|
|
36
|
-
default?: string;
|
|
36
|
+
default?: string | number | boolean | object | any[] | null;
|
|
37
37
|
type: SlotType;
|
|
38
38
|
// used if type is array
|
|
39
39
|
items?: {
|