Skip to content

Commit 4275835

Browse files
feat: expose all components via exports maps (#7690)
https://stackblitz.com/edit/ui5wcr-exports-map?file=package.json,src%2FApp.tsx Closes #7722 --------- Co-authored-by: Marcus Notheis <[email protected]>
1 parent 86bb7e1 commit 4275835

File tree

85 files changed

+1250
-161
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+1250
-161
lines changed

config/paths.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ const PATHS = {
1212
temp: path.join(root, 'temp'),
1313
nodeModules: path.join(root, 'node_modules'),
1414
packages: path.join(root, 'packages'),
15+
ai: path.join(root, 'packages', 'ai'),
16+
base: path.join(root, 'packages', 'base'),
17+
charts: path.join(root, 'packages', 'charts'),
18+
cli: path.join(root, 'packages', 'cli'),
19+
compat: path.join(root, 'packages', 'compat'),
20+
'cypress-commands': path.join(root, 'packages', 'cypress-commands'),
21+
main: path.join(root, 'packages', 'main'),
1522
};
1623

1724
export default PATHS;

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
"postinstall": "husky && yarn setup",
3333
"create-cypress-commands-docs": "documentation build ./packages/cypress-commands/src/commands.ts -f json -o ./packages/cypress-commands/api-commands.json && documentation build ./packages/cypress-commands/src/queries.ts -f json -o ./packages/cypress-commands/api-queries.json",
3434
"sb:prepare-cem": "node packages/cli/dist/bin/index.js resolve-cem --packageName @ui5/webcomponents --out ./.storybook/custom-element-manifests/main.json && node packages/cli/dist/bin/index.js resolve-cem --packageName @ui5/webcomponents-fiori --out ./.storybook/custom-element-manifests/fiori.json && node packages/cli/dist/bin/index.js resolve-cem --packageName @ui5/webcomponents-ai --out ./.storybook/custom-element-manifests/ai.json",
35-
"create-theming-parameters": "node scripts/generate-theming-parameters.js"
35+
"create-theming-parameters": "node scripts/generate-theming-parameters.js",
36+
"create-exports": "node --experimental-strip-types scripts/create-export-paths.ts"
3637
},
3738
"dependencies": {
3839
"@stackblitz/sdk": "1.11.0",

packages/ai/package.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,19 @@
1414
"./package.json": "./package.json",
1515
"./dist": "./dist/index.js",
1616
"./dist/*": "./dist/*",
17-
"./dist/*.js": "./dist/*.js"
17+
"./dist/*.js": "./dist/*.js",
18+
"./Button": {
19+
"types": "./dist/components/Button/index.d.ts",
20+
"default": "./dist/components/Button/index.js"
21+
},
22+
"./ButtonState": {
23+
"types": "./dist/components/ButtonState/index.d.ts",
24+
"default": "./dist/components/ButtonState/index.js"
25+
},
26+
"./PromptInput": {
27+
"types": "./dist/components/PromptInput/index.d.ts",
28+
"default": "./dist/components/PromptInput/index.js"
29+
}
1830
},
1931
"homepage": "https://sap.github.io/ui5-webcomponents-react",
2032
"repository": {

packages/base/package.json

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,43 @@
1515
"./dist": "./dist/index.js",
1616
"./dist/*": "./dist/*",
1717
"./dist/*.js": "./dist/*.js",
18-
"./internal/addCustomCSSWithScoping.js": "./dist/utils/addCustomCSSWithScoping.js"
18+
"./internal/addCustomCSSWithScoping.js": "./dist/utils/addCustomCSSWithScoping.js",
19+
"./Device": {
20+
"types": "./dist/Device/index.d.ts",
21+
"default": "./dist/Device/index.js"
22+
},
23+
"./hooks": {
24+
"types": "./dist/hooks/index.d.ts",
25+
"default": "./dist/hooks/index.js"
26+
},
27+
"./VersionInfo": {
28+
"types": "./dist/generated/VersionInfo.d.ts",
29+
"default": "./dist/generated/VersionInfo.js"
30+
},
31+
"./I18nStore": {
32+
"types": "./dist/stores/I18nStore.d.ts",
33+
"default": "./dist/stores/I18nStore.js"
34+
},
35+
"./StyleStore": {
36+
"types": "./dist/stores/StyleStore.d.ts",
37+
"default": "./dist/stores/StyleStore.js"
38+
},
39+
"./CssSizeVariables": {
40+
"types": "./dist/styling/CssSizeVariables.d.ts",
41+
"default": "./dist/styling/CssSizeVariables.js"
42+
},
43+
"./ThemingParameters": {
44+
"types": "./dist/styling/ThemingParameters.d.ts",
45+
"default": "./dist/styling/ThemingParameters.js"
46+
},
47+
"./withWebComponent": {
48+
"types": "./dist/wrapper/withWebComponent.d.ts",
49+
"default": "./dist/wrapper/withWebComponent.js"
50+
},
51+
"./utils": {
52+
"types": "./dist/utils/index.d.ts",
53+
"default": "./dist/utils/index.js"
54+
}
1955
},
2056
"homepage": "https://sap.github.io/ui5-webcomponents-react",
2157
"repository": {

packages/base/src/types/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ type InternalUI5WCSlotsNode =
1111

1212
export type UI5WCSlotsNode = InternalUI5WCSlotsNode | InternalUI5WCSlotsNode[];
1313

14-
export type Nullable<T> = T | null;
15-
1614
export type { CommonProps } from './CommonProps.js';
1715
export type { Ui5CustomEvent } from './Ui5CustomEvent.js';
1816
export type { Ui5DomRef } from './Ui5DomRef.js';

packages/base/src/utils/debounce.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ interface Cancelable {
77
}
88

99
/**
10+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
11+
*
1012
* When a sequence of calls of the returned function ends, the argument
1113
* function is triggered. The end of a sequence is defined by the `wait`
1214
* parameter.

packages/base/src/utils/index.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { getEffectiveScopingSuffixForTag } from '@ui5/webcomponents-base/dist/CustomElementsScope.js';
22

3+
/**
4+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
5+
*/
36
export const deprecationNotice = (component: string, message: string) => {
47
if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {
58
const value = `*** ui5-webcomponents-react Deprecation Notice - ${component} ***\n`;
@@ -10,11 +13,16 @@ export const deprecationNotice = (component: string, message: string) => {
1013
}
1114
};
1215

13-
// Define EnrichedEventType to extend Event with specific detail structure
16+
/**
17+
* Define EnrichedEventType to extend Event with specific detail structure
18+
*/
1419
type EnrichedEventType<Event, Detail> = Event & {
1520
detail: Detail & { nativeDetail?: number };
1621
};
1722

23+
/**
24+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
25+
*/
1826
export const enrichEventWithDetails = <
1927
Event extends { detail?: number | Record<string, unknown> | null },
2028
Detail extends Record<string, unknown>,
@@ -48,22 +56,39 @@ export const enrichEventWithDetails = <
4856
return event as EnrichedEventType<Event, Detail>;
4957
};
5058

59+
/**
60+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
61+
*/
5162
export function getUi5TagWithSuffix(baseTagName: string) {
5263
const tagNameSuffix: string | undefined = getEffectiveScopingSuffixForTag(baseTagName);
5364
return tagNameSuffix ? `${baseTagName}-${tagNameSuffix}` : baseTagName;
5465
}
5566

5667
export { debounce } from './debounce.js';
5768
export { throttle } from './throttle.js';
58-
69+
/**
70+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
71+
*/
5972
export const capitalizeFirstLetter = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);
73+
/**
74+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
75+
*/
6076
export const lowercaseFirstLetter = (s: string) => s.charAt(0).toLowerCase() + s.slice(1);
77+
/**
78+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
79+
*/
6180
export const camelToKebabCase = (s: string) => s.replace(/([A-Z])/g, (a, b: string) => `-${b.toLowerCase()}`);
81+
/**
82+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
83+
*/
6284
export const kebabToCamelCase = (str: string) => str.replace(/([-_]\w)/g, (g) => g[1].toUpperCase());
6385

6486
const SEMVER_REGEX =
6587
/^(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
6688

89+
/**
90+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
91+
*/
6792
export function parseSemVer(version: string) {
6893
const parsed = SEMVER_REGEX.exec(version).groups;
6994
return {

packages/base/src/utils/throttle.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ interface Options {
1212
}
1313

1414
/**
15+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
16+
*
1517
* Returns a function, that, when invoked, will only be triggered at most once
1618
* during a given window of time. Normally, the throttled function will run
1719
* as much as it can, without ever going more than once per `wait` duration;

packages/base/src/wrapper/withWebComponent.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ export interface WithWebComponentPropTypes {
2626
}
2727

2828
const definedWebComponents = new Set<ComponentType>([]);
29-
29+
/**
30+
* ⚠️ __INTERNAL__ use only! This function is not part of the public API.
31+
*/
3032
export const withWebComponent = <Props extends Record<string, any>, RefType = Ui5DomRef>(
3133
tagName: string,
3234
regularProperties: string[],

packages/charts/package.json

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,99 @@
1515
"./dist": "./dist/index.js",
1616
"./dist/*": "./dist/*",
1717
"./dist/*.js": "./dist/*.js",
18-
"./styles.css": "./dist/css/index.css"
18+
"./styles.css": "./dist/css/index.css",
19+
"./VersionInfo": {
20+
"types": "./dist/generated/VersionInfo.d.ts",
21+
"default": "./dist/generated/VersionInfo.js"
22+
},
23+
"./ComposedChart": {
24+
"types": "./dist/components/ComposedChart/index.d.ts",
25+
"default": "./dist/components/ComposedChart/index.js"
26+
},
27+
"./BarChart": {
28+
"types": "./dist/components/BarChart/index.d.ts",
29+
"default": "./dist/components/BarChart/index.js"
30+
},
31+
"./BulletChart": {
32+
"types": "./dist/components/BulletChart/index.d.ts",
33+
"default": "./dist/components/BulletChart/index.js"
34+
},
35+
"./ColumnChart": {
36+
"types": "./dist/components/ColumnChart/index.d.ts",
37+
"default": "./dist/components/ColumnChart/index.js"
38+
},
39+
"./ColumnChartWithTrend": {
40+
"types": "./dist/components/ColumnChartWithTrend/index.d.ts",
41+
"default": "./dist/components/ColumnChartWithTrend/index.js"
42+
},
43+
"./DonutChart": {
44+
"types": "./dist/components/DonutChart/index.d.ts",
45+
"default": "./dist/components/DonutChart/index.js"
46+
},
47+
"./LineChart": {
48+
"types": "./dist/components/LineChart/index.d.ts",
49+
"default": "./dist/components/LineChart/index.js"
50+
},
51+
"./PieChart": {
52+
"types": "./dist/components/PieChart/index.d.ts",
53+
"default": "./dist/components/PieChart/index.js"
54+
},
55+
"./RadarChart": {
56+
"types": "./dist/components/RadarChart/index.d.ts",
57+
"default": "./dist/components/RadarChart/index.js"
58+
},
59+
"./RadialChart": {
60+
"types": "./dist/components/RadialChart/index.d.ts",
61+
"default": "./dist/components/RadialChart/index.js"
62+
},
63+
"./ScatterChart": {
64+
"types": "./dist/components/ScatterChart/index.d.ts",
65+
"default": "./dist/components/ScatterChart/index.js"
66+
},
67+
"./TimelineChart": {
68+
"types": "./dist/components/TimelineChart/index.d.ts",
69+
"default": "./dist/components/TimelineChart/index.js"
70+
},
71+
"./TimelineChartAnnotation": {
72+
"types": "./dist/components/TimelineChart/TimelineChartAnnotation.d.ts",
73+
"default": "./dist/components/TimelineChart/TimelineChartAnnotation.js"
74+
},
75+
"./BarChartPlaceholder": {
76+
"types": "./dist/components/BarChart/Placeholder.d.ts",
77+
"default": "./dist/components/BarChart/Placeholder.js"
78+
},
79+
"./BulletChartPlaceholder": {
80+
"types": "./dist/components/BulletChart/Placeholder.d.ts",
81+
"default": "./dist/components/BulletChart/Placeholder.js"
82+
},
83+
"./ColumnChartPlaceholder": {
84+
"types": "./dist/components/ColumnChart/Placeholder.d.ts",
85+
"default": "./dist/components/ColumnChart/Placeholder.js"
86+
},
87+
"./ColumnChartWithTrendPlaceholder": {
88+
"types": "./dist/components/ColumnChartWithTrend/Placeholder.d.ts",
89+
"default": "./dist/components/ColumnChartWithTrend/Placeholder.js"
90+
},
91+
"./ComposedChartPlaceholder": {
92+
"types": "./dist/components/ComposedChart/Placeholder.d.ts",
93+
"default": "./dist/components/ComposedChart/Placeholder.js"
94+
},
95+
"./LineChartPlaceholder": {
96+
"types": "./dist/components/LineChart/Placeholder.d.ts",
97+
"default": "./dist/components/LineChart/Placeholder.js"
98+
},
99+
"./PieChartPlaceholder": {
100+
"types": "./dist/components/PieChart/Placeholder.d.ts",
101+
"default": "./dist/components/PieChart/Placeholder.js"
102+
},
103+
"./ScatterChartPlaceholder": {
104+
"types": "./dist/components/ScatterChart/Placeholder.d.ts",
105+
"default": "./dist/components/ScatterChart/Placeholder.js"
106+
},
107+
"./TimelineChartPlaceholder": {
108+
"types": "./dist/components/TimelineChart/Placeholder.d.ts",
109+
"default": "./dist/components/TimelineChart/Placeholder.js"
110+
}
19111
},
20112
"homepage": "https://sap.github.io/ui5-webcomponents-react",
21113
"repository": {

0 commit comments

Comments
 (0)