@ms-cloudpack/overlay 0.18.2 → 0.19.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/README.md +2 -0
- package/dist/browser-esm/240.chunk.js +1 -1
- package/dist/browser-esm/240.chunk.js.map +1 -1
- package/dist/browser-esm/31.chunk.js +2 -0
- package/dist/browser-esm/31.chunk.js.map +1 -0
- package/dist/browser-esm/570.chunk.js +2 -0
- package/dist/browser-esm/570.chunk.js.map +1 -0
- package/dist/browser-esm/582.chunk.js +2 -0
- package/dist/browser-esm/{318.chunk.js.map → 582.chunk.js.map} +1 -1
- package/dist/browser-esm/lib/index.js +1 -1
- package/dist/browser-esm/lib/index.js.LICENSE.txt +0 -30
- package/dist/browser-esm/lib/index.js.map +1 -1
- package/lib/components/Button/Button.d.ts +26 -4
- package/lib/components/Button/Button.d.ts.map +1 -1
- package/lib/components/Button/Button.js +27 -4
- package/lib/components/Button/Button.js.map +1 -1
- package/lib/components/CloudpackProvider/CloudpackProvider.d.ts +4 -3
- package/lib/components/CloudpackProvider/CloudpackProvider.d.ts.map +1 -1
- package/lib/components/CloudpackProvider/CloudpackProvider.js +4 -2
- package/lib/components/CloudpackProvider/CloudpackProvider.js.map +1 -1
- package/lib/components/CloudpackProvider/useStatus.js +1 -1
- package/lib/components/CloudpackProvider/useStatus.js.map +1 -1
- package/lib/components/CloudpackProvider/useStatusDetails.js +1 -1
- package/lib/components/CloudpackProvider/useStatusDetails.js.map +1 -1
- package/lib/components/Dialog/Dialog.d.ts +4 -4
- package/lib/components/Dialog/Dialog.d.ts.map +1 -1
- package/lib/components/Dialog/Dialog.js +9 -13
- package/lib/components/Dialog/Dialog.js.map +1 -1
- package/lib/components/ErrorDialog/ErrorDialog.d.ts +2 -2
- package/lib/components/ErrorDialog/ErrorDialog.d.ts.map +1 -1
- package/lib/components/ErrorDialog/ErrorDialog.js +4 -5
- package/lib/components/ErrorDialog/ErrorDialog.js.map +1 -1
- package/lib/components/ErrorDialog/PathError.d.ts +6 -2
- package/lib/components/ErrorDialog/PathError.d.ts.map +1 -1
- package/lib/components/ErrorDialog/PathError.js +14 -36
- package/lib/components/ErrorDialog/PathError.js.map +1 -1
- package/lib/components/ErrorDialog/useErrorEvents.d.ts +9 -0
- package/lib/components/ErrorDialog/useErrorEvents.d.ts.map +1 -1
- package/lib/components/ErrorDialog/useErrorEvents.js +30 -5
- package/lib/components/ErrorDialog/useErrorEvents.js.map +1 -1
- package/lib/components/Overlay/Overlay.d.ts +3 -0
- package/lib/components/Overlay/Overlay.d.ts.map +1 -0
- package/lib/components/{StatusOverlay/StatusOverlay.js → Overlay/Overlay.js} +10 -8
- package/lib/components/Overlay/Overlay.js.map +1 -0
- package/lib/components/ResultsAccordion/ResultsAccordion.d.ts +40 -0
- package/lib/components/ResultsAccordion/ResultsAccordion.d.ts.map +1 -0
- package/lib/components/ResultsAccordion/ResultsAccordion.js +43 -0
- package/lib/components/ResultsAccordion/ResultsAccordion.js.map +1 -0
- package/lib/components/StatusBadge/StatusBadge.d.ts +3 -5
- package/lib/components/StatusBadge/StatusBadge.d.ts.map +1 -1
- package/lib/components/StatusBadge/StatusBadge.js +49 -60
- package/lib/components/StatusBadge/StatusBadge.js.map +1 -1
- package/lib/components/StatusDialog/Searchbox.d.ts +4 -4
- package/lib/components/StatusDialog/Searchbox.d.ts.map +1 -1
- package/lib/components/StatusDialog/Searchbox.js +4 -3
- package/lib/components/StatusDialog/Searchbox.js.map +1 -1
- package/lib/components/StatusDialog/StatusDialog.d.ts +2 -2
- package/lib/components/StatusDialog/StatusDialog.d.ts.map +1 -1
- package/lib/components/StatusDialog/StatusDialog.js +5 -9
- package/lib/components/StatusDialog/StatusDialog.js.map +1 -1
- package/lib/components/StatusDialog/TaskList.d.ts +2 -2
- package/lib/components/StatusDialog/TaskList.d.ts.map +1 -1
- package/lib/components/StatusDialog/TaskList.js +2 -2
- package/lib/components/StatusDialog/TaskList.js.map +1 -1
- package/lib/components/StatusDialog/TaskResultItem.d.ts +8 -3
- package/lib/components/StatusDialog/TaskResultItem.d.ts.map +1 -1
- package/lib/components/StatusDialog/TaskResultItem.js +52 -29
- package/lib/components/StatusDialog/TaskResultItem.js.map +1 -1
- package/lib/components/StatusDialog/TaskStatus.d.ts +7 -3
- package/lib/components/StatusDialog/TaskStatus.d.ts.map +1 -1
- package/lib/components/StatusDialog/TaskStatus.js +17 -56
- package/lib/components/StatusDialog/TaskStatus.js.map +1 -1
- package/lib/components/ThemeProvider/ThemeProvider.d.ts +4 -2
- package/lib/components/ThemeProvider/ThemeProvider.d.ts.map +1 -1
- package/lib/components/ThemeProvider/ThemeProvider.js +2 -2
- package/lib/components/ThemeProvider/ThemeProvider.js.map +1 -1
- package/lib/hooks/useDraggable.d.ts +1 -1
- package/lib/hooks/useDraggable.d.ts.map +1 -1
- package/lib/hooks/useDraggable.js +1 -1
- package/lib/hooks/useDraggable.js.map +1 -1
- package/lib/hooks/usePageLoadTimeReporter.js +3 -3
- package/lib/hooks/usePageLoadTimeReporter.js.map +1 -1
- package/lib/index.js +4 -7
- package/lib/index.js.map +1 -1
- package/package.json +5 -8
- package/dist/browser-esm/119.chunk.js +0 -2
- package/dist/browser-esm/119.chunk.js.map +0 -1
- package/dist/browser-esm/318.chunk.js +0 -2
- package/dist/browser-esm/464.chunk.js +0 -2
- package/dist/browser-esm/464.chunk.js.map +0 -1
- package/lib/components/StatusOverlay/StatusOverlay.d.ts +0 -3
- package/lib/components/StatusOverlay/StatusOverlay.d.ts.map +0 -1
- package/lib/components/StatusOverlay/StatusOverlay.js.map +0 -1
- package/lib/hooks/preferDarkTheme.d.ts +0 -5
- package/lib/hooks/preferDarkTheme.d.ts.map +0 -1
- package/lib/hooks/preferDarkTheme.js +0 -7
- package/lib/hooks/preferDarkTheme.js.map +0 -1
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { FunctionComponent } from 'preact';
|
|
2
|
+
import type { ButtonHTMLAttributes } from 'preact/compat';
|
|
3
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Button style variant:
|
|
6
|
+
* - `default`: white background, black text, dark gray border
|
|
7
|
+
* - `primary`: blue background, white text
|
|
8
|
+
* - `link`: looks like a link (underline, no background or padding). Note that to set the font
|
|
9
|
+
* size or weight, you need to set them on a parent element or use higher specificty than one class.
|
|
10
|
+
* - `iconOnly`: 32px width/height, light gray background on hover only
|
|
11
|
+
* - `custom`: only get rid of the browser default styles
|
|
12
|
+
* @default 'default'
|
|
13
|
+
*/
|
|
14
|
+
variant?: 'default' | 'primary' | 'link' | 'iconOnly' | 'custom';
|
|
15
|
+
/** Include this icon (add more as needed) */
|
|
16
|
+
iconName?: 'close' | 'refresh';
|
|
17
|
+
/** Alt text for the icon. Defaults to an empty string (presentational). */
|
|
18
|
+
iconAlt?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Render a styled button.
|
|
22
|
+
*
|
|
23
|
+
* To customize colors, you can either use the CSS variables (see `Button.module.css`)
|
|
24
|
+
* or increase specificity (like `button.customClass`).
|
|
25
|
+
*/
|
|
26
|
+
export declare const Button: FunctionComponent<ButtonProps>;
|
|
5
27
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAO1D,MAAM,WAAW,WAAY,SAAQ,oBAAoB,CAAC,iBAAiB,CAAC;IAC1E;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;IACjE,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,2EAA2E;IAC3E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAKD;;;;;GAKG;AACH,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CA8BjD,CAAC"}
|
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import cx from 'classnames';
|
|
2
3
|
import styles from './Button.module.css';
|
|
4
|
+
// In fluentui-system-icons, this is "ArrowClockwiseFilled"
|
|
5
|
+
import RefreshIcon from '../../images/refresh-20.inline.svg';
|
|
6
|
+
import RefreshWhiteIcon from '../../images/refresh-white-20.inline.svg';
|
|
7
|
+
import CloseIcon from '../../images/dismiss-16-filled.inline.svg';
|
|
8
|
+
/** button variants that get the `.standard` class */
|
|
9
|
+
const standardButtonVariants = ['default', 'primary', 'iconOnly'];
|
|
10
|
+
/**
|
|
11
|
+
* Render a styled button.
|
|
12
|
+
*
|
|
13
|
+
* To customize colors, you can either use the CSS variables (see `Button.module.css`)
|
|
14
|
+
* or increase specificity (like `button.customClass`).
|
|
15
|
+
*/
|
|
3
16
|
export const Button = (props) => {
|
|
4
|
-
const {
|
|
5
|
-
const className =
|
|
6
|
-
|
|
17
|
+
const { variant = 'default', iconName, iconAlt, children, class: propsClassName, ...other } = props;
|
|
18
|
+
const className = cx(styles.root, standardButtonVariants.includes(variant) && styles.standard, styles[variant], (variant === 'primary' || variant === 'default') && styles.defaultPrimary, propsClassName);
|
|
19
|
+
const iconContent = iconName === 'close'
|
|
20
|
+
? CloseIcon
|
|
21
|
+
: // The approach of importing SVG content as data-urls doesn't allow the icon color to
|
|
22
|
+
// follow the text color, so for now, we use two versions of the refresh icon depending on
|
|
23
|
+
// whether the button background is dark or light.
|
|
24
|
+
iconName === 'refresh'
|
|
25
|
+
? variant === 'primary'
|
|
26
|
+
? RefreshWhiteIcon
|
|
27
|
+
: RefreshIcon
|
|
28
|
+
: undefined;
|
|
29
|
+
return (_jsxs("button", { type: "button", ...other, class: className, children: [iconContent && _jsx("img", { src: iconContent, alt: iconAlt || '' }), !!iconName && variant !== 'iconOnly' && ' ', children] }));
|
|
7
30
|
};
|
|
8
31
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../src/components/Button/Button.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAG5B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,2DAA2D;AAC3D,OAAO,WAAW,MAAM,oCAAoC,CAAC;AAC7D,OAAO,gBAAgB,MAAM,0CAA0C,CAAC;AACxE,OAAO,SAAS,MAAM,2CAA2C,CAAC;AAoBlE,qDAAqD;AACrD,MAAM,sBAAsB,GAA6B,CAAC,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAE5F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAmC,CAAC,KAAK,EAAE,EAAE;IAC9D,MAAM,EAAE,OAAO,GAAG,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,KAAK,EAAE,GAAG,KAAK,CAAC;IAEpG,MAAM,SAAS,GAAG,EAAE,CAClB,MAAM,CAAC,IAAI,EACX,sBAAsB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,QAAQ,EAC3D,MAAM,CAAC,OAAO,CAAC,EACf,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,CAAC,IAAI,MAAM,CAAC,cAAc,EACzE,cAAc,CACf,CAAC;IAEF,MAAM,WAAW,GACf,QAAQ,KAAK,OAAO;QAClB,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,qFAAqF;YACrF,0FAA0F;YAC1F,kDAAkD;YAClD,QAAQ,KAAK,SAAS;gBACtB,CAAC,CAAC,OAAO,KAAK,SAAS;oBACrB,CAAC,CAAC,gBAAgB;oBAClB,CAAC,CAAC,WAAW;gBACf,CAAC,CAAC,SAAS,CAAC;IAElB,OAAO,CACL,kBAAQ,IAAI,EAAC,QAAQ,KAAK,KAAK,EAAE,KAAK,EAAE,SAAS,aAC9C,WAAW,IAAI,cAAK,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,IAAI,EAAE,GAAI,EAC5D,CAAC,CAAC,QAAQ,IAAI,OAAO,KAAK,UAAU,IAAI,GAAG,EAC3C,QAAQ,IACF,CACV,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import cx from 'classnames';\nimport type { FunctionComponent } from 'preact';\nimport type { ButtonHTMLAttributes } from 'preact/compat';\nimport styles from './Button.module.css';\n// In fluentui-system-icons, this is \"ArrowClockwiseFilled\"\nimport RefreshIcon from '../../images/refresh-20.inline.svg';\nimport RefreshWhiteIcon from '../../images/refresh-white-20.inline.svg';\nimport CloseIcon from '../../images/dismiss-16-filled.inline.svg';\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n /**\n * Button style variant:\n * - `default`: white background, black text, dark gray border\n * - `primary`: blue background, white text\n * - `link`: looks like a link (underline, no background or padding). Note that to set the font\n * size or weight, you need to set them on a parent element or use higher specificty than one class.\n * - `iconOnly`: 32px width/height, light gray background on hover only\n * - `custom`: only get rid of the browser default styles\n * @default 'default'\n */\n variant?: 'default' | 'primary' | 'link' | 'iconOnly' | 'custom';\n /** Include this icon (add more as needed) */\n iconName?: 'close' | 'refresh';\n /** Alt text for the icon. Defaults to an empty string (presentational). */\n iconAlt?: string;\n}\n\n/** button variants that get the `.standard` class */\nconst standardButtonVariants: ButtonProps['variant'][] = ['default', 'primary', 'iconOnly'];\n\n/**\n * Render a styled button.\n *\n * To customize colors, you can either use the CSS variables (see `Button.module.css`)\n * or increase specificity (like `button.customClass`).\n */\nexport const Button: FunctionComponent<ButtonProps> = (props) => {\n const { variant = 'default', iconName, iconAlt, children, class: propsClassName, ...other } = props;\n\n const className = cx(\n styles.root,\n standardButtonVariants.includes(variant) && styles.standard,\n styles[variant],\n (variant === 'primary' || variant === 'default') && styles.defaultPrimary,\n propsClassName,\n );\n\n const iconContent =\n iconName === 'close'\n ? CloseIcon\n : // The approach of importing SVG content as data-urls doesn't allow the icon color to\n // follow the text color, so for now, we use two versions of the refresh icon depending on\n // whether the button background is dark or light.\n iconName === 'refresh'\n ? variant === 'primary'\n ? RefreshWhiteIcon\n : RefreshIcon\n : undefined;\n\n return (\n <button type=\"button\" {...other} class={className}>\n {iconContent && <img src={iconContent} alt={iconAlt || ''} />}\n {!!iconName && variant !== 'iconOnly' && ' '}\n {children}\n </button>\n );\n};\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { CloudpackClient } from '@ms-cloudpack/api-server/browser';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { type FunctionComponent } from 'preact';
|
|
3
|
+
import type { PropsWithChildren } from 'preact/compat';
|
|
4
|
+
export declare const CloudpackContext: import("preact").Context<CloudpackClient>;
|
|
5
|
+
export declare const CloudpackProvider: FunctionComponent<PropsWithChildren<{
|
|
5
6
|
client: CloudpackClient;
|
|
6
7
|
}>>;
|
|
7
8
|
export declare const useCloudpack: () => CloudpackClient;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudpackProvider.d.ts","sourceRoot":"","sources":["../../../src/components/CloudpackProvider/CloudpackProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CloudpackProvider.d.ts","sourceRoot":"","sources":["../../../src/components/CloudpackProvider/CloudpackProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,eAAO,MAAM,gBAAgB,2CAAqE,CAAC;AAEnG,eAAO,MAAM,iBAAiB,EAAE,iBAAiB,CAAC,iBAAiB,CAAC;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC,CAG/F,CAAC;AAEF,eAAO,MAAM,YAAY,QAAO,eAA+C,CAAC"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { createContext } from 'preact';
|
|
3
|
+
import { useContext } from 'preact/hooks';
|
|
2
4
|
export const CloudpackContext = createContext(null);
|
|
3
5
|
export const CloudpackProvider = (props) => {
|
|
4
6
|
const { client, children } = props;
|
|
5
|
-
return
|
|
7
|
+
return _jsx(CloudpackContext.Provider, { value: client, children: children });
|
|
6
8
|
};
|
|
7
9
|
export const useCloudpack = () => useContext(CloudpackContext);
|
|
8
10
|
//# sourceMappingURL=CloudpackProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CloudpackProvider.js","sourceRoot":"","sources":["../../../src/components/CloudpackProvider/CloudpackProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CloudpackProvider.js","sourceRoot":"","sources":["../../../src/components/CloudpackProvider/CloudpackProvider.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,aAAa,EAA0B,MAAM,QAAQ,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,aAAa,CAAkB,IAAkC,CAAC,CAAC;AAEnG,MAAM,CAAC,MAAM,iBAAiB,GAAsE,CAAC,KAAK,EAAE,EAAE;IAC5G,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACnC,OAAO,KAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YAAG,QAAQ,GAA6B,CAAC;AAC1F,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAoB,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC","sourcesContent":["import type { CloudpackClient } from '@ms-cloudpack/api-server/browser';\nimport { createContext, type FunctionComponent } from 'preact';\nimport type { PropsWithChildren } from 'preact/compat';\nimport { useContext } from 'preact/hooks';\n\nexport const CloudpackContext = createContext<CloudpackClient>(null as unknown as CloudpackClient);\n\nexport const CloudpackProvider: FunctionComponent<PropsWithChildren<{ client: CloudpackClient }>> = (props) => {\n const { client, children } = props;\n return <CloudpackContext.Provider value={client}>{children}</CloudpackContext.Provider>;\n};\n\nexport const useCloudpack = (): CloudpackClient => useContext(CloudpackContext);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStatus.js","sourceRoot":"","sources":["../../../src/components/CloudpackProvider/useStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useStatus.js","sourceRoot":"","sources":["../../../src/components/CloudpackProvider/useStatus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAkB,MAAM,kCAAkC,CAAC;AAInF,MAAM,aAAa,GAAoB;IACrC,MAAM,EAAE,SAAS;IACjB,cAAc,EAAE,CAAC;IACjB,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAoB,EAAE;IAC7C,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAkB,aAAa,CAAC,CAAC;IAErE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,eAAe,EAAE;YACvE,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACf,SAAS,CAAC,IAAuB,CAAC,CAAC;YACrC,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport { useCloudpack } from './CloudpackProvider.js';\nimport { taskStatsSource, type TaskStats } from '@ms-cloudpack/api-server/browser';\n\nexport type CloudpackStatus = TaskStats;\n\nconst defaultStatus: CloudpackStatus = {\n status: 'unknown',\n remainingTasks: 0,\n totalTasks: 0,\n totalErrors: 0,\n totalWarnings: 0,\n};\n\nexport const useStatus = (): CloudpackStatus => {\n const cloudpack = useCloudpack();\n const [status, setStatus] = useState<CloudpackStatus>(defaultStatus);\n\n useEffect(() => {\n const subscription = cloudpack?.onDataChanged.subscribe(taskStatsSource, {\n onData: (data) => {\n setStatus(data as CloudpackStatus);\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [cloudpack]);\n\n return status;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStatusDetails.js","sourceRoot":"","sources":["../../../src/components/CloudpackProvider/useStatusDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useStatusDetails.js","sourceRoot":"","sources":["../../../src/components/CloudpackProvider/useStatusDetails.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,cAAc,EAAiB,MAAM,kCAAkC,CAAC;AAEjF,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAa,EAAE;IAC7C,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAW,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAEhE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,SAAS,EAAE,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE;YACtE,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;gBACf,UAAU,CAAC,IAAgB,CAAC,CAAC;YAC/B,CAAC;SACF,CAAC,CAAC;QAEH,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC","sourcesContent":["import { useEffect, useState } from 'preact/hooks';\nimport { useCloudpack } from './CloudpackProvider.js';\nimport { taskListSource, type TaskList } from '@ms-cloudpack/api-server/browser';\n\nexport const useStatusDetails = (): TaskList => {\n const cloudpack = useCloudpack();\n const [details, setDetails] = useState<TaskList>({ tasks: [] });\n\n useEffect(() => {\n const subscription = cloudpack?.onDataChanged.subscribe(taskListSource, {\n onData: (data) => {\n setDetails(data as TaskList);\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [cloudpack]);\n\n return details;\n};\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ComponentChildren, FunctionComponent } from 'preact';
|
|
2
2
|
export interface DialogProps {
|
|
3
3
|
title: string;
|
|
4
4
|
id: string;
|
|
5
5
|
style?: 'default' | 'error';
|
|
6
6
|
draggable?: boolean;
|
|
7
7
|
onClose?: () => void;
|
|
8
|
-
commands?:
|
|
9
|
-
children:
|
|
8
|
+
commands?: ComponentChildren;
|
|
9
|
+
children: ComponentChildren;
|
|
10
10
|
}
|
|
11
|
-
export declare const Dialog:
|
|
11
|
+
export declare const Dialog: FunctionComponent<DialogProps>;
|
|
12
12
|
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAMnE,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,eAAO,MAAM,MAAM,EAAE,iBAAiB,CAAC,WAAW,CA4BjD,CAAC"}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
import { useRef } from 'preact/hooks';
|
|
2
4
|
import styles from './Dialog.module.css';
|
|
3
5
|
import { useDraggable } from '../../hooks/useDraggable.js';
|
|
4
|
-
import
|
|
5
|
-
export const Dialog = (
|
|
6
|
+
import { Button } from '../Button/Button.js';
|
|
7
|
+
export const Dialog = (props) => {
|
|
8
|
+
const { title, id, style, draggable, onClose, commands, children } = props;
|
|
6
9
|
const draggableRef = useRef(null);
|
|
7
10
|
const draggableTargetRef = useRef(null);
|
|
8
|
-
const colorAccent = style === 'error' ? 'rgb(164, 38, 44)' : undefined;
|
|
9
|
-
const cursorDraggable = draggable ? 'move' : undefined;
|
|
10
11
|
useDraggable({
|
|
11
12
|
enabled: !!draggable,
|
|
12
13
|
containerElementRef: draggableRef,
|
|
13
14
|
dragElementRef: draggableTargetRef,
|
|
14
15
|
});
|
|
15
|
-
return (
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
React.createElement("div", { ref: draggableTargetRef, className: styles.title, style: { color: colorAccent, cursor: cursorDraggable } }, title),
|
|
19
|
-
onClose && (React.createElement("button", { className: styles.closeButton, onClick: onClose, "aria-label": "Minimize overlay" },
|
|
20
|
-
React.createElement("img", { src: CloseIcon, alt: "" })))),
|
|
21
|
-
commands && React.createElement("div", { className: styles.commands }, ...commands),
|
|
22
|
-
children)));
|
|
16
|
+
return (_jsx("div", { id: id, class: styles.overlay, children: _jsxs("div", { ref: draggableRef, class: cx(styles.dialog, style === 'error' && styles.error), children: [_jsxs("div", { class: styles.titleArea, children: [_jsx("h2", { ref: draggableTargetRef, class: cx(styles.title, draggable && styles.draggable), children: title }), onClose && (
|
|
17
|
+
// a close icon is common/universal enough that it doesn't need hover text
|
|
18
|
+
_jsx(Button, { variant: "iconOnly", iconName: "close", onClick: onClose, "aria-label": "Close" }))] }), commands && _jsx("div", { class: styles.commands, children: commands }), children] }) }));
|
|
23
19
|
};
|
|
24
20
|
//# sourceMappingURL=Dialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{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EAAE,OAAO,gBAAa,OAAO,GAAG,CACpF,IACG,EACL,QAAQ,IAAI,cAAK,KAAK,EAAE,MAAM,CAAC,QAAQ,YAAG,QAAQ,GAAO,EACzD,QAAQ,IACL,GACF,CACP,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import cx from 'classnames';\nimport type { ComponentChildren, FunctionComponent } from 'preact';\nimport { useRef } from 'preact/hooks';\nimport styles from './Dialog.module.css';\nimport { useDraggable } from '../../hooks/useDraggable.js';\nimport { Button } from '../Button/Button.js';\n\nexport interface DialogProps {\n title: string;\n id: string;\n style?: 'default' | 'error';\n draggable?: boolean;\n onClose?: () => void;\n commands?: ComponentChildren;\n children: ComponentChildren;\n}\n\nexport const Dialog: FunctionComponent<DialogProps> = (props) => {\n const { title, id, style, draggable, onClose, commands, children } = props;\n const draggableRef = useRef<HTMLDivElement>(null);\n const draggableTargetRef = useRef<HTMLDivElement>(null);\n\n useDraggable({\n enabled: !!draggable,\n containerElementRef: draggableRef,\n dragElementRef: draggableTargetRef,\n });\n\n return (\n <div id={id} class={styles.overlay}>\n <div ref={draggableRef} class={cx(styles.dialog, style === 'error' && styles.error)}>\n <div class={styles.titleArea}>\n <h2 ref={draggableTargetRef} class={cx(styles.title, draggable && styles.draggable)}>\n {title}\n </h2>\n {onClose && (\n // a close icon is common/universal enough that it doesn't need hover text\n <Button variant=\"iconOnly\" iconName=\"close\" onClick={onClose} aria-label=\"Close\" />\n )}\n </div>\n {commands && <div class={styles.commands}>{commands}</div>}\n {children}\n </div>\n </div>\n );\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FunctionComponent } from 'preact';
|
|
2
2
|
import type { UnsupportedErrorEvent } from './useErrorEvents.js';
|
|
3
3
|
export interface ErrorDialogProps {
|
|
4
4
|
unsupported: UnsupportedErrorEvent[];
|
|
5
5
|
}
|
|
6
|
-
export declare const ErrorDialog:
|
|
6
|
+
export declare const ErrorDialog: FunctionComponent<ErrorDialogProps>;
|
|
7
7
|
export default ErrorDialog;
|
|
8
8
|
//# sourceMappingURL=ErrorDialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorDialog.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/ErrorDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"ErrorDialog.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/ErrorDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAKhD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAIjE,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,qBAAqB,EAAE,CAAC;CACtC;AAED,eAAO,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CA2B3D,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-runtime";
|
|
2
|
+
import { createElement as _createElement } from "preact";
|
|
2
3
|
import { Button } from '../Button/Button.js';
|
|
3
4
|
import { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';
|
|
4
5
|
import { PathError } from './PathError.js';
|
|
@@ -8,10 +9,8 @@ import { elementIds } from '../../constants.js';
|
|
|
8
9
|
export const ErrorDialog = ({ unsupported }) => {
|
|
9
10
|
const cloudpack = useCloudpack();
|
|
10
11
|
const reload = () => void cloudpack.restartAllTasks.mutate();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
] },
|
|
14
|
-
React.createElement("div", { className: styles.root }, unsupported.map((data, index) => (React.createElement(PathError, { ...data, key: index }))))));
|
|
12
|
+
const editConfig = () => void cloudpack.openConfigEditor.mutate();
|
|
13
|
+
return (_jsx(Dialog, { title: "Cloudpack: Unsupported paths found in project", id: elementIds.errorDialogRoot, style: "error", commands: _jsxs(_Fragment, { children: [_jsx(Button, { variant: "primary", iconName: "refresh", onClick: reload, children: "Retry bundling" }), _jsx(Button, { onClick: editConfig, children: "Edit Cloudpack config" })] }), children: _jsx("div", { class: styles.root, children: unsupported.map((data, index) => (_createElement(PathError, { ...data, index: index, key: index }))) }) }));
|
|
15
14
|
};
|
|
16
15
|
export default ErrorDialog;
|
|
17
16
|
//# sourceMappingURL=ErrorDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorDialog.js","sourceRoot":"","sources":["../../../src/components/ErrorDialog/ErrorDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorDialog.js","sourceRoot":"","sources":["../../../src/components/ErrorDialog/ErrorDialog.tsx"],"names":[],"mappings":";;AACA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,MAAM,MAAM,qCAAqC,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAMhD,MAAM,CAAC,MAAM,WAAW,GAAwC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;IAClF,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IAEjC,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;IAC7D,MAAM,UAAU,GAAG,GAAG,EAAE,CAAC,KAAK,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;IAElE,OAAO,CACL,KAAC,MAAM,IACL,KAAK,EAAC,+CAA+C,EACrD,EAAE,EAAE,UAAU,CAAC,eAAe,EAC9B,KAAK,EAAC,OAAO,EACb,QAAQ,EACN,8BACE,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,QAAQ,EAAC,SAAS,EAAC,OAAO,EAAE,MAAM,+BAEnD,EACT,KAAC,MAAM,IAAC,OAAO,EAAE,UAAU,sCAAgC,IAC1D,YAGL,cAAK,KAAK,EAAE,MAAM,CAAC,IAAI,YACpB,WAAW,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAChC,eAAC,SAAS,OAAK,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAI,CAClD,CAAC,GACE,GACC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import type { FunctionComponent } from 'preact';\nimport { Button } from '../Button/Button.js';\nimport { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';\nimport { PathError } from './PathError.js';\nimport styles from '../StatusDialog/TaskList.module.css';\nimport type { UnsupportedErrorEvent } from './useErrorEvents.js';\nimport { Dialog } from '../Dialog/Dialog.js';\nimport { elementIds } from '../../constants.js';\n\nexport interface ErrorDialogProps {\n unsupported: UnsupportedErrorEvent[];\n}\n\nexport const ErrorDialog: FunctionComponent<ErrorDialogProps> = ({ unsupported }) => {\n const cloudpack = useCloudpack();\n\n const reload = () => void cloudpack.restartAllTasks.mutate();\n const editConfig = () => void cloudpack.openConfigEditor.mutate();\n\n return (\n <Dialog\n title=\"Cloudpack: Unsupported paths found in project\"\n id={elementIds.errorDialogRoot}\n style=\"error\"\n commands={\n <>\n <Button variant=\"primary\" iconName=\"refresh\" onClick={reload}>\n Retry bundling\n </Button>\n <Button onClick={editConfig}>Edit Cloudpack config</Button>\n </>\n }\n >\n <div class={styles.root}>\n {unsupported.map((data, index) => (\n <PathError {...data} index={index} key={index} />\n ))}\n </div>\n </Dialog>\n );\n};\n\nexport default ErrorDialog;\n"]}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { FunctionComponent } from 'preact';
|
|
2
2
|
import type { UnsupportedErrorEvent } from './useErrorEvents.js';
|
|
3
|
-
|
|
3
|
+
import { type ResultsAccordionProps } from '../ResultsAccordion/ResultsAccordion.js';
|
|
4
|
+
/**
|
|
5
|
+
* Item (collapsible section) in the list of path errors in the ErrorDialog.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PathError: FunctionComponent<UnsupportedErrorEvent & Pick<ResultsAccordionProps, 'index'>>;
|
|
4
8
|
//# sourceMappingURL=PathError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathError.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/PathError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"PathError.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/PathError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAGjE,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,yCAAyC,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,SAAS,EAAE,iBAAiB,CAAC,qBAAqB,GAAG,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,CA+HrG,CAAC"}
|
|
@@ -1,45 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styles from '../StatusDialog/TaskStatus.module.css';
|
|
3
|
-
import ErrorIcon from '../../images/error-24.inline.svg';
|
|
4
|
-
import { default as cx } from 'classnames';
|
|
5
|
-
import ChevronDownIcon from '../../images/chevrondown-20.inline.svg';
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "preact/jsx-runtime";
|
|
6
2
|
import { Button } from '../Button/Button.js';
|
|
7
3
|
import { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';
|
|
4
|
+
import { ResultsAccordion, ResultsAccordionContent, } from '../ResultsAccordion/ResultsAccordion.js';
|
|
5
|
+
/**
|
|
6
|
+
* Item (collapsible section) in the list of path errors in the ErrorDialog.
|
|
7
|
+
*/
|
|
8
8
|
export const PathError = (props) => {
|
|
9
|
-
const
|
|
10
|
-
const { packageName, importPath, issuerUrl, fixable } = props;
|
|
9
|
+
const { packageName, importPath, issuerUrl, fixable, isValidPackage } = props;
|
|
11
10
|
const cloudpack = useCloudpack();
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const
|
|
11
|
+
const prettyImport = (_jsxs("code", { children: [packageName, importPath === '.' ? '' : `/${importPath.replace(/^\.\//, '')}`] }));
|
|
12
|
+
const prettyPackage = _jsx("code", { children: packageName });
|
|
13
|
+
const isTrailingSlash = importPath.endsWith('/');
|
|
15
14
|
const addOverride = () => {
|
|
16
15
|
void cloudpack.addPackageOverride.mutate({ packageName, importPath, issuerUrl, initiatedBy: 'user' });
|
|
17
16
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
React.createElement("div", { className: styles.title }, `${prettyImportString}`)),
|
|
24
|
-
showContent && (React.createElement(React.Fragment, null,
|
|
25
|
-
React.createElement("div", { className: styles.commands },
|
|
26
|
-
fixable && React.createElement(Button, { onClick: addOverride }, "Add override"),
|
|
27
|
-
React.createElement(Button, { onClick: editConfig }, "Edit config file")),
|
|
28
|
-
React.createElement("div", { className: styles.content },
|
|
29
|
-
React.createElement("div", { className: styles.title }, "Details"),
|
|
30
|
-
React.createElement("div", { className: styles.nameValueArea },
|
|
31
|
-
React.createElement("div", { className: styles.name }, "Problem"),
|
|
32
|
-
React.createElement("div", { className: styles.value }, importPath === '.'
|
|
33
|
-
? `An unrecognized package "${packageName}" was imported.`
|
|
34
|
-
: `Path "${importPath}" was imported from package "${packageName}" but was not recognized as an exported path.`)),
|
|
35
|
-
React.createElement("div", { className: styles.nameValueArea },
|
|
36
|
-
React.createElement("div", { className: styles.name }, "Solution"),
|
|
37
|
-
React.createElement("div", { className: styles.value }, fixable
|
|
38
|
-
? `Remove the path from the import in your source. (Import from "${packageName}" rather than "${prettyImportString}")`
|
|
39
|
-
: importPath === '.'
|
|
40
|
-
? `Make sure the package name is valid.`
|
|
41
|
-
: importPath.endsWith('/')
|
|
42
|
-
? `Remove the trailing slash from the import path.`
|
|
43
|
-
: `Import not found on package. Make sure the import path is valid.`)))))));
|
|
17
|
+
const getContent = () => {
|
|
18
|
+
return (_jsxs(_Fragment, { children: [_jsx(ResultsAccordionContent, { itemName: "Problem", itemValue: _jsxs(_Fragment, { children: [isValidPackage ? (_jsxs(_Fragment, { children: [prettyImport, " was imported, but ", _jsx("code", { children: importPath }), " is not listed in ", prettyPackage, "'s exports map", fixable ? '' : ' and does not appear to exist on disk', "."] })) : (_jsxs(_Fragment, { children: ["An unrecognized package ", prettyPackage, " was imported."] })), issuerUrl && (_jsxs(_Fragment, { children: [_jsx("br", {}), "The bad import request came from:", ' ', _jsx("a", { href: issuerUrl, target: "_blank", rel: "noopener noreferrer", children: issuerUrl })] }))] }) }), _jsx(ResultsAccordionContent, { itemName: "Possible solutions", itemValue: fixable ? (_jsxs(_Fragment, { children: [_jsxs("p", { children: ["Click ", _jsx("strong", { children: "Add override" }), " above to add an exports map entry for this path in your ", "app's ", _jsx("code", { children: "cloudpack.generated.json" }), "."] }), _jsxs("p", { children: ["To automatically make updates like this in the future, add the following to your ", "app's ", _jsx("code", { children: "cloudpack.config.json" }), ":", _jsx("br", {}), _jsx("code", { children: '{ "features": { "autoUpdateEntries": true } }' })] })] })) : (_jsxs(_Fragment, { children: [_jsx("strong", { children: issuerUrl ? 'Check the requesting URL above' : 'Search for this import in your repo' }), ` to determine whether the problematic import comes from your own code, or a dependency's code.`, !issuerUrl &&
|
|
19
|
+
" (You can also try opening this page in Firefox and checking the console to see which package's bundle imported the bad path.)", _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "If from your repo:" }), ' ', isTrailingSlash ? ('Remove the trailing slash from the import path.') : isValidPackage ? (_jsxs(_Fragment, { children: ["Import from the package root or a valid sub-path. (If you think the path is valid, verify that the correct version of ", prettyPackage, " is listed as a dependency.)"] })) : ('Make sure the package name is correct and listed as a dependency of the importing package.')] }), _jsxs("li", { children: [_jsx("strong", { children: "If from a dependency:" }), isTrailingSlash ? ('Ask the owners to remove the trailing slash, or create a temporary patch in your repo.') : (_jsxs("ul", { children: [_jsxs("li", { children: ["Verify that your local installation is up to date (run ", _jsx("code", { children: "yarn" }), " or your repo's package manager)."] }), _jsxs("li", { children: ["Verify whether ", prettyPackage, " is listed in the importing package's dependencies. If not, ask the owners to add it (or temporarily add the dependency in one of your own packages and run ", _jsx("code", { children: "cloudpack init" }), ")."] }), _jsxs("li", { children: ["If the dependency is listed, check whether any ", _jsx("code", { children: "resolutions" }), " exist for", ' ', prettyPackage, " which might be forcing it to an incompatible version. If so, talk to your eng sys team about removing or scoping the resolution."] }), _jsxs("li", { children: ["If ", prettyPackage, " is in ", _jsx("code", { children: "peerDependencies" }), " of the importing package, the peer may be incorrectly satisfied in your dependency tree. Talk to your eng sys team for help."] })] }))] })] })] })) })] }));
|
|
20
|
+
};
|
|
21
|
+
return (_jsx(ResultsAccordion, { name: prettyImport, index: props.index, result: "error", headerCommands: fixable && _jsx(Button, { onClick: addOverride, children: "Add override" }), getContent: getContent }));
|
|
44
22
|
};
|
|
45
23
|
//# sourceMappingURL=PathError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PathError.js","sourceRoot":"","sources":["../../../src/components/ErrorDialog/PathError.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PathError.js","sourceRoot":"","sources":["../../../src/components/ErrorDialog/PathError.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO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ent } from 'preact';\nimport type { UnsupportedErrorEvent } from './useErrorEvents.js';\nimport { Button } from '../Button/Button.js';\nimport { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';\nimport {\n ResultsAccordion,\n ResultsAccordionContent,\n type ResultsAccordionProps,\n} from '../ResultsAccordion/ResultsAccordion.js';\n\n/**\n * Item (collapsible section) in the list of path errors in the ErrorDialog.\n */\nexport const PathError: FunctionComponent<UnsupportedErrorEvent & Pick<ResultsAccordionProps, 'index'>> = (props) => {\n const { packageName, importPath, issuerUrl, fixable, isValidPackage } = props;\n const cloudpack = useCloudpack();\n const prettyImport = (\n <code>\n {packageName}\n {importPath === '.' ? '' : `/${importPath.replace(/^\\.\\//, '')}`}\n </code>\n );\n const prettyPackage = <code>{packageName}</code>;\n const isTrailingSlash = importPath.endsWith('/');\n\n const addOverride = () => {\n void cloudpack.addPackageOverride.mutate({ packageName, importPath, issuerUrl, initiatedBy: 'user' });\n };\n\n const getContent = () => {\n return (\n <>\n <ResultsAccordionContent\n itemName=\"Problem\"\n itemValue={\n <>\n {isValidPackage ? (\n <>\n {prettyImport} was imported, but <code>{importPath}</code> is not listed in {prettyPackage}'s\n exports map{fixable ? '' : ' and does not appear to exist on disk'}.\n </>\n ) : (\n <>An unrecognized package {prettyPackage} was imported.</>\n )}\n {issuerUrl && (\n <>\n <br />\n The bad import request came from:{' '}\n <a href={issuerUrl} target=\"_blank\" rel=\"noopener noreferrer\">\n {issuerUrl}\n </a>\n </>\n )}\n </>\n }\n />\n <ResultsAccordionContent\n itemName=\"Possible solutions\"\n itemValue={\n fixable ? (\n <>\n <p>\n Click <strong>Add override</strong> above to add an exports map entry for this path in your {\"app's \"}\n <code>cloudpack.generated.json</code>.\n </p>\n <p>\n To automatically make updates like this in the future, add the following to your {\"app's \"}\n <code>cloudpack.config.json</code>:\n <br />\n <code>{'{ \"features\": { \"autoUpdateEntries\": true } }'}</code>\n </p>\n </>\n ) : (\n <>\n <strong>{issuerUrl ? 'Check the requesting URL above' : 'Search for this import in your repo'}</strong>\n {` to determine whether the problematic import comes from your own code, or a dependency's code.`}\n {!issuerUrl &&\n \" (You can also try opening this page in Firefox and checking the console to see which package's bundle imported the bad path.)\"}\n <ul>\n <li>\n <strong>If from your repo:</strong>{' '}\n {isTrailingSlash ? (\n 'Remove the trailing slash from the import path.'\n ) : isValidPackage ? (\n <>\n Import from the package root or a valid sub-path. (If you think the path is valid, verify that\n the correct version of {prettyPackage} is listed as a dependency.)\n </>\n ) : (\n 'Make sure the package name is correct and listed as a dependency of the importing package.'\n )}\n </li>\n <li>\n <strong>If from a dependency:</strong>\n {isTrailingSlash ? (\n 'Ask the owners to remove the trailing slash, or create a temporary patch in your repo.'\n ) : (\n <ul>\n <li>\n Verify that your local installation is up to date (run <code>yarn</code> or your repo's\n package manager).\n </li>\n {/* If isValidPackage is false, obviously a dependency is missing. But also show this message\n if the package is found in the repo, because there could be an implicit dependency resulting in\n the wrong version being picked up. */}\n <li>\n Verify whether {prettyPackage} is listed in the importing package's dependencies. If not,\n ask the owners to add it (or temporarily add the dependency in one of your own packages and\n run <code>cloudpack init</code>).\n </li>\n <li>\n If the dependency is listed, check whether any <code>resolutions</code> exist for{' '}\n {prettyPackage} which might be forcing it to an incompatible version. If so, talk to your eng\n sys team about removing or scoping the resolution.\n </li>\n <li>\n If {prettyPackage} is in <code>peerDependencies</code> of the importing package, the peer may\n be incorrectly satisfied in your dependency tree. Talk to your eng sys team for help.\n </li>\n </ul>\n )}\n </li>\n </ul>\n </>\n )\n }\n />\n </>\n );\n };\n\n return (\n <ResultsAccordion\n name={prettyImport}\n index={props.index}\n result=\"error\"\n headerCommands={fixable && <Button onClick={addOverride}>Add override</Button>}\n getContent={getContent}\n />\n );\n};\n"]}
|
|
@@ -2,10 +2,19 @@ export type ErrorEvents = {
|
|
|
2
2
|
unsupported: UnsupportedErrorEvent[];
|
|
3
3
|
};
|
|
4
4
|
export type UnsupportedErrorEvent = {
|
|
5
|
+
/** Package name being imported */
|
|
5
6
|
packageName: string;
|
|
7
|
+
/** Path within the package being imported (`'.'` for root) */
|
|
6
8
|
importPath: string;
|
|
9
|
+
/**
|
|
10
|
+
* URL that issued the bad request. This will be undefined if the browser didn't set it, or if it
|
|
11
|
+
* was incorrectly set to the current page URL (most browsers except Firefox do this).
|
|
12
|
+
*/
|
|
7
13
|
issuerUrl?: string;
|
|
14
|
+
/** True if this is a valid import that can be handled by `addPackageOverride` */
|
|
8
15
|
fixable?: boolean;
|
|
16
|
+
/** True if the package exists in the resolve map (even if the import path wasn't valid) */
|
|
17
|
+
isValidPackage?: boolean;
|
|
9
18
|
};
|
|
10
19
|
export declare const useErrorEvents: () => ErrorEvents;
|
|
11
20
|
//# sourceMappingURL=useErrorEvents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useErrorEvents.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/useErrorEvents.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,qBAAqB,EAAE,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useErrorEvents.d.ts","sourceRoot":"","sources":["../../../src/components/ErrorDialog/useErrorEvents.ts"],"names":[],"mappings":"AAyBA,MAAM,MAAM,WAAW,GAAG;IACxB,WAAW,EAAE,qBAAqB,EAAE,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,kCAAkC;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,8DAA8D;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2FAA2F;IAC3F,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,WA+FjC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useEffect, useState } from '
|
|
1
|
+
import { useEffect, useState } from 'preact/hooks';
|
|
2
2
|
import { parseImportString } from '@ms-cloudpack/path-string-parsing';
|
|
3
3
|
import { useCloudpack } from '../CloudpackProvider/CloudpackProvider.js';
|
|
4
4
|
import { errorEntrySource } from '@ms-cloudpack/api-server/browser';
|
|
@@ -13,7 +13,13 @@ const hasMessage = (event) => {
|
|
|
13
13
|
export const useErrorEvents = () => {
|
|
14
14
|
const [errorEvents, setErrorEvents] = useState({ unsupported: [] });
|
|
15
15
|
const cloudpack = useCloudpack();
|
|
16
|
+
// This should always be set by an inline script
|
|
17
|
+
const pageErrors = window.__pageErrors;
|
|
16
18
|
useEffect(() => {
|
|
19
|
+
if (!pageErrors) {
|
|
20
|
+
console.error('[Cloudpack] window.__pageErrors not found (unable to handle unsupported imports)');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
17
23
|
const handleUnsupportedError = (message, issuerUrl) => {
|
|
18
24
|
const errorRegex = /[Mm]odule specifier,? ['"](.*?)['"]/;
|
|
19
25
|
const match = message.match(errorRegex);
|
|
@@ -23,10 +29,30 @@ export const useErrorEvents = () => {
|
|
|
23
29
|
const importString = parseImportString(match[1]);
|
|
24
30
|
const { packageName, importPath } = importString;
|
|
25
31
|
(async () => {
|
|
26
|
-
|
|
32
|
+
if (issuerUrl && issuerUrl === location.href) {
|
|
33
|
+
// Issuer URL is often incorrectly set to the current page URL, so just remove it
|
|
34
|
+
issuerUrl = undefined;
|
|
35
|
+
}
|
|
36
|
+
// Check whether importPath is valid for this package.
|
|
37
|
+
// Unfortunately, due to the lack of issuerUrl support in most browsers, this might not be
|
|
38
|
+
// accurate if there are multiple versions of the same package (it will fall back to
|
|
39
|
+
// whichever version is at the top level of the resolve map, which may not be the version
|
|
40
|
+
// that's actually being imported in context).
|
|
41
|
+
const { fixable } = await cloudpack.validatePackageOverride.query({
|
|
42
|
+
packageName,
|
|
43
|
+
importPath,
|
|
44
|
+
issuerUrl,
|
|
45
|
+
});
|
|
46
|
+
// If importPath doesn't appear to be valid, attempt to check whether the package exists
|
|
47
|
+
// elsewhere in the resolve map (to refine the error message). This check isn't perfect
|
|
48
|
+
// since it assumes the path '.' exists for that package, and it's also possible that the
|
|
49
|
+
// package is installed somewhere in the repo but hasn't ended up in the resolve map yet.
|
|
50
|
+
const isValidPackage = fixable ||
|
|
51
|
+
(importPath !== '.' &&
|
|
52
|
+
(await cloudpack.validatePackageOverride.query({ packageName, importPath: '.', issuerUrl })).fixable);
|
|
27
53
|
setErrorEvents((prev) => ({
|
|
28
54
|
...prev,
|
|
29
|
-
unsupported: [...prev.unsupported, { packageName, importPath, issuerUrl
|
|
55
|
+
unsupported: [...prev.unsupported, { packageName, importPath, issuerUrl, fixable, isValidPackage }],
|
|
30
56
|
}));
|
|
31
57
|
})().catch(() => {
|
|
32
58
|
// no-op
|
|
@@ -40,7 +66,6 @@ export const useErrorEvents = () => {
|
|
|
40
66
|
}
|
|
41
67
|
},
|
|
42
68
|
});
|
|
43
|
-
const pageErrors = window.__pageErrors;
|
|
44
69
|
pageErrors.unregister();
|
|
45
70
|
// Append unsupported paths to the list.
|
|
46
71
|
window.addEventListener('error', (event) => {
|
|
@@ -61,7 +86,7 @@ export const useErrorEvents = () => {
|
|
|
61
86
|
return () => {
|
|
62
87
|
subscription.unsubscribe();
|
|
63
88
|
};
|
|
64
|
-
}, [cloudpack]);
|
|
89
|
+
}, [cloudpack, pageErrors]);
|
|
65
90
|
return errorEvents;
|
|
66
91
|
};
|
|
67
92
|
//# sourceMappingURL=useErrorEvents.js.map
|