@pie-lib/render-ui 0.1.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/_virtual/_rolldown/runtime.js +11 -0
- package/dist/assets/enableAudioAutoplayImage.d.ts +11 -0
- package/dist/assets/enableAudioAutoplayImage.d.ts.map +1 -0
- package/dist/assets/enableAudioAutoplayImage.js +4 -0
- package/dist/collapsible/index.d.ts +32 -0
- package/dist/collapsible/index.d.ts.map +1 -0
- package/dist/collapsible/index.js +53 -0
- package/dist/color.d.ts +115 -0
- package/dist/color.d.ts.map +1 -0
- package/dist/color.js +118 -0
- package/dist/feedback.d.ts +21 -0
- package/dist/feedback.d.ts.map +1 -0
- package/dist/feedback.js +65 -0
- package/dist/has-media.d.ts +10 -0
- package/dist/has-media.d.ts.map +1 -0
- package/dist/has-media.js +10 -0
- package/dist/has-text.d.ts +10 -0
- package/dist/has-text.d.ts.map +1 -0
- package/dist/has-text.js +10 -0
- package/dist/html-and-math.d.ts +23 -0
- package/dist/html-and-math.d.ts.map +1 -0
- package/dist/html-and-math.js +25 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/inline-menu.d.ts +34 -0
- package/dist/inline-menu.d.ts.map +1 -0
- package/dist/inline-menu.js +29 -0
- package/dist/input-container.d.ts +23 -0
- package/dist/input-container.d.ts.map +1 -0
- package/dist/input-container.js +39 -0
- package/dist/preview-layout.d.ts +25 -0
- package/dist/preview-layout.d.ts.map +1 -0
- package/dist/preview-layout.js +37 -0
- package/dist/preview-prompt.d.ts +39 -0
- package/dist/preview-prompt.d.ts.map +1 -0
- package/dist/preview-prompt.js +153 -0
- package/dist/purpose.d.ts +18 -0
- package/dist/purpose.d.ts.map +1 -0
- package/dist/purpose.js +11 -0
- package/dist/readable.d.ts +18 -0
- package/dist/readable.d.ts.map +1 -0
- package/dist/readable.js +11 -0
- package/dist/response-indicators.d.ts +37 -0
- package/dist/response-indicators.d.ts.map +1 -0
- package/dist/response-indicators.js +62 -0
- package/dist/ui-layout.d.ts +32 -0
- package/dist/ui-layout.d.ts.map +1 -0
- package/dist/ui-layout.js +55 -0
- package/dist/withUndoReset.d.ts +26 -0
- package/dist/withUndoReset.d.ts.map +1 -0
- package/dist/withUndoReset.js +84 -0
- package/package.json +39 -0
- package/src/assets/enableAudioAutoplayImage.ts +11 -0
- package/src/collapsible/index.tsx +74 -0
- package/src/color.ts +147 -0
- package/src/feedback.tsx +94 -0
- package/src/has-media.ts +26 -0
- package/src/has-text.ts +28 -0
- package/src/html-and-math.tsx +31 -0
- package/src/index.ts +45 -0
- package/src/inline-menu.tsx +62 -0
- package/src/input-container.tsx +57 -0
- package/src/preview-layout.tsx +51 -0
- package/src/preview-prompt.tsx +286 -0
- package/src/purpose.tsx +27 -0
- package/src/readable.tsx +29 -0
- package/src/response-indicators.tsx +92 -0
- package/src/ui-layout.tsx +106 -0
- package/src/withUndoReset.tsx +124 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/render-ui/src/has-media.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export declare const hasMedia: (s: any) => boolean;
|
|
10
|
+
//# sourceMappingURL=has-media.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-media.d.ts","sourceRoot":"","sources":["../src/has-media.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAWH,eAAO,MAAM,QAAQ,GAAI,MAAC,YAMzB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/has-media.ts
|
|
2
|
+
var e;
|
|
3
|
+
typeof window < "u" && (e = new DOMParser());
|
|
4
|
+
var t = (t) => {
|
|
5
|
+
if (!t) return !1;
|
|
6
|
+
let n = e.parseFromString(t, "text/html");
|
|
7
|
+
return !!n.body.querySelector("img") || !!n.body.querySelector("video") || !!n.body.querySelector("audio");
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as hasMedia };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/render-ui/src/has-text.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export declare const hasText: (s: any) => boolean;
|
|
10
|
+
//# sourceMappingURL=has-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-text.d.ts","sourceRoot":"","sources":["../src/has-text.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAaH,eAAO,MAAM,OAAO,GAAI,MAAC,YAMxB,CAAC"}
|
package/dist/has-text.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/has-text.ts
|
|
2
|
+
var e;
|
|
3
|
+
typeof window < "u" && (e = new DOMParser());
|
|
4
|
+
var t = (t) => e.parseFromString(t, "text/html").body.textContent, n = (e) => {
|
|
5
|
+
if (!e) return !1;
|
|
6
|
+
let n = t(e);
|
|
7
|
+
return !!(n && n.trim());
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as hasText };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/render-ui/src/html-and-math.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export default class HtmlAndMath extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
tag: PropTypes.Requireable<string>;
|
|
14
|
+
className: PropTypes.Requireable<string>;
|
|
15
|
+
html: PropTypes.Requireable<string>;
|
|
16
|
+
};
|
|
17
|
+
static defaultProps: {
|
|
18
|
+
tag: string;
|
|
19
|
+
html: string;
|
|
20
|
+
};
|
|
21
|
+
render(): JSX.Element;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=html-and-math.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-and-math.d.ts","sourceRoot":"","sources":["../src/html-and-math.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,KAAK,CAAC,SAAS;IACtD,MAAM,CAAC,SAAS;;;;MAId;IAEF,MAAM,CAAC,YAAY;;;MAGjB;IAEF,MAAM;CAKP"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/html-and-math.tsx
|
|
5
|
+
var r = class extends e.Component {
|
|
6
|
+
static propTypes = {
|
|
7
|
+
tag: t.string,
|
|
8
|
+
className: t.string,
|
|
9
|
+
html: t.string
|
|
10
|
+
};
|
|
11
|
+
static defaultProps = {
|
|
12
|
+
tag: "div",
|
|
13
|
+
html: ""
|
|
14
|
+
};
|
|
15
|
+
render() {
|
|
16
|
+
let { tag: e, className: t, html: r } = this.props;
|
|
17
|
+
return /* @__PURE__ */ n(e || "div", {
|
|
18
|
+
ref: (e) => this.node = e,
|
|
19
|
+
className: t,
|
|
20
|
+
dangerouslySetInnerHTML: { __html: r }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { r as default };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/render-ui/src/index.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import * as indicators from './response-indicators.js';
|
|
10
|
+
import Feedback from './feedback.js';
|
|
11
|
+
import Collapsible from './collapsible/index.js';
|
|
12
|
+
import withUndoReset from './withUndoReset.js';
|
|
13
|
+
import PreviewLayout from './preview-layout.js';
|
|
14
|
+
import UiLayout from './ui-layout.js';
|
|
15
|
+
import HtmlAndMath from './html-and-math.js';
|
|
16
|
+
import InputContainer from './input-container.js';
|
|
17
|
+
import PreviewPrompt from './preview-prompt.js';
|
|
18
|
+
import Readable from './readable.js';
|
|
19
|
+
import Purpose from './purpose.js';
|
|
20
|
+
import * as color from './color.js';
|
|
21
|
+
import { hasText } from './has-text.js';
|
|
22
|
+
import { hasMedia } from './has-media.js';
|
|
23
|
+
import EnableAudioAutoplayImage from './assets/enableAudioAutoplayImage.js';
|
|
24
|
+
export { HtmlAndMath, indicators, withUndoReset, Feedback, UiLayout, PreviewLayout, Collapsible, InputContainer, PreviewPrompt, color, Readable, Purpose, hasText, hasMedia, EnableAudioAutoplayImage, };
|
|
25
|
+
export { InlineMenu } from './inline-menu.js';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,UAAU,MAAM,0BAA0B,CAAC;AACvD,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,WAAW,MAAM,wBAAwB,CAAC;AACjD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AACtC,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,cAAc,MAAM,sBAAsB,CAAC;AAClD,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,wBAAwB,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,WAAW,EACX,cAAc,EACd,aAAa,EACb,KAAK,EACL,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,EACR,wBAAwB,GACzB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { color_exports as e } from "./color.js";
|
|
2
|
+
import t from "./feedback.js";
|
|
3
|
+
import { response_indicators_exports as n } from "./response-indicators.js";
|
|
4
|
+
import r from "./collapsible/index.js";
|
|
5
|
+
import i from "./withUndoReset.js";
|
|
6
|
+
import a from "./ui-layout.js";
|
|
7
|
+
import o from "./preview-layout.js";
|
|
8
|
+
import s from "./html-and-math.js";
|
|
9
|
+
import c from "./input-container.js";
|
|
10
|
+
import l from "./preview-prompt.js";
|
|
11
|
+
import u from "./readable.js";
|
|
12
|
+
import d from "./purpose.js";
|
|
13
|
+
import { hasText as f } from "./has-text.js";
|
|
14
|
+
import { hasMedia as p } from "./has-media.js";
|
|
15
|
+
import m from "./assets/enableAudioAutoplayImage.js";
|
|
16
|
+
import { InlineMenu as h } from "./inline-menu.js";
|
|
17
|
+
export { r as Collapsible, m as EnableAudioAutoplayImage, t as Feedback, s as HtmlAndMath, h as InlineMenu, c as InputContainer, o as PreviewLayout, l as PreviewPrompt, d as Purpose, u as Readable, a as UiLayout, e as color, p as hasMedia, f as hasText, n as indicators, i as withUndoReset };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* InlineMenu - A wrapper around MUI's Menu component for inline contexts
|
|
3
|
+
*
|
|
4
|
+
* This component fixes the issue where MUI's Menu creates a modal overlay
|
|
5
|
+
* that covers the entire screen with a white background. It's designed for
|
|
6
|
+
* use in inline contexts like dropdowns within text or other UI elements.
|
|
7
|
+
*
|
|
8
|
+
* Key differences from standard MUI Menu:
|
|
9
|
+
* - No backdrop (hideBackdrop)
|
|
10
|
+
* - Transparent modal root (doesn't block UI)
|
|
11
|
+
* - No scroll locking (disableScrollLock)
|
|
12
|
+
* - Menu itself remains interactive
|
|
13
|
+
*
|
|
14
|
+
* This file is NOT synced from upstream - it's specific to pie-elements-ng.
|
|
15
|
+
*/
|
|
16
|
+
import React from 'react';
|
|
17
|
+
import { MenuProps } from '@mui/material/Menu';
|
|
18
|
+
/**
|
|
19
|
+
* InlineMenu component that wraps MUI Menu without the blocking backdrop
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```tsx
|
|
23
|
+
* <InlineMenu
|
|
24
|
+
* anchorEl={anchorEl}
|
|
25
|
+
* open={Boolean(anchorEl)}
|
|
26
|
+
* onClose={handleClose}
|
|
27
|
+
* >
|
|
28
|
+
* <MenuItem onClick={handleOption1}>Option 1</MenuItem>
|
|
29
|
+
* <MenuItem onClick={handleOption2}>Option 2</MenuItem>
|
|
30
|
+
* </InlineMenu>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare const InlineMenu: React.FC<MenuProps>;
|
|
34
|
+
//# sourceMappingURL=inline-menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline-menu.d.ts","sourceRoot":"","sources":["../src/inline-menu.tsx"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA0B1C,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
3
|
+
import t from "@mui/material/Menu";
|
|
4
|
+
//#region src/inline-menu.tsx
|
|
5
|
+
var n = ({ slotProps: n, ...r }) => /* @__PURE__ */ e(t, {
|
|
6
|
+
...r,
|
|
7
|
+
disableScrollLock: !0,
|
|
8
|
+
hideBackdrop: !0,
|
|
9
|
+
slotProps: {
|
|
10
|
+
...n,
|
|
11
|
+
root: {
|
|
12
|
+
...n?.root,
|
|
13
|
+
style: {
|
|
14
|
+
backgroundColor: "transparent",
|
|
15
|
+
pointerEvents: "none",
|
|
16
|
+
...n?.root?.style
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
paper: {
|
|
20
|
+
...n?.paper,
|
|
21
|
+
style: {
|
|
22
|
+
pointerEvents: "auto",
|
|
23
|
+
...n?.paper?.style
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
//#endregion
|
|
29
|
+
export { n as InlineMenu };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/render-ui/src/input-container.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
declare const InputContainer: {
|
|
11
|
+
({ label, className, children }: {
|
|
12
|
+
label: any;
|
|
13
|
+
className: any;
|
|
14
|
+
children: any;
|
|
15
|
+
}): JSX.Element;
|
|
16
|
+
propTypes: {
|
|
17
|
+
label: PropTypes.Validator<NonNullable<NonNullable<string | object | null | undefined>>>;
|
|
18
|
+
className: PropTypes.Requireable<string>;
|
|
19
|
+
children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default InputContainer;
|
|
23
|
+
//# sourceMappingURL=input-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-container.d.ts","sourceRoot":"","sources":["../src/input-container.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAGH,OAAO,SAAS,MAAM,YAAY,CAAC;AAgCnC,QAAA,MAAM,cAAc;;;;;;;;;;;CAKnB,CAAC;AAQF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import "react";
|
|
2
|
+
import e from "prop-types";
|
|
3
|
+
import { styled as t } from "@mui/material/styles";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import i from "@mui/material/InputLabel";
|
|
6
|
+
import a from "@mui/material/FormControl";
|
|
7
|
+
//#region src/input-container.tsx
|
|
8
|
+
var o = t(a)(({ theme: e }) => ({
|
|
9
|
+
margin: 0,
|
|
10
|
+
padding: 0,
|
|
11
|
+
flex: "1 0 auto",
|
|
12
|
+
minWidth: e.spacing(4)
|
|
13
|
+
})), s = t(i)(() => ({
|
|
14
|
+
fontSize: "inherit",
|
|
15
|
+
whiteSpace: "nowrap",
|
|
16
|
+
margin: 0,
|
|
17
|
+
padding: 0,
|
|
18
|
+
alignSelf: "flex-start",
|
|
19
|
+
position: "absolute",
|
|
20
|
+
top: 0,
|
|
21
|
+
left: 0,
|
|
22
|
+
transformOrigin: "top left",
|
|
23
|
+
pointerEvents: "none",
|
|
24
|
+
"&.MuiInputLabel-shrink": { transform: "scale(0.75) translate(0, -0.75em)" },
|
|
25
|
+
"&:not(.MuiInputLabel-shrink)": { transform: "translate(0, 0)" }
|
|
26
|
+
})), c = ({ label: e, className: t, children: i }) => /* @__PURE__ */ r(o, {
|
|
27
|
+
className: t,
|
|
28
|
+
children: [/* @__PURE__ */ n(s, {
|
|
29
|
+
shrink: !0,
|
|
30
|
+
children: e
|
|
31
|
+
}), i]
|
|
32
|
+
});
|
|
33
|
+
c.propTypes = {
|
|
34
|
+
label: e.oneOfType([e.string, e.object]).isRequired,
|
|
35
|
+
className: e.string,
|
|
36
|
+
children: e.oneOfType([e.arrayOf(e.node), e.node]).isRequired
|
|
37
|
+
};
|
|
38
|
+
//#endregion
|
|
39
|
+
export { c as default };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/render-ui/src/preview-layout.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
declare class PreviewLayout extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
ariaLabel: PropTypes.Requireable<string>;
|
|
14
|
+
children: PropTypes.Validator<NonNullable<NonNullable<PropTypes.ReactNodeLike>>>;
|
|
15
|
+
role: PropTypes.Requireable<string>;
|
|
16
|
+
extraCSSRules: PropTypes.Requireable<PropTypes.InferProps<{
|
|
17
|
+
names: PropTypes.Requireable<(string | null | undefined)[]>;
|
|
18
|
+
rules: PropTypes.Requireable<string>;
|
|
19
|
+
}>>;
|
|
20
|
+
fontSizeFactor: PropTypes.Requireable<number>;
|
|
21
|
+
};
|
|
22
|
+
render(): JSX.Element;
|
|
23
|
+
}
|
|
24
|
+
export default PreviewLayout;
|
|
25
|
+
//# sourceMappingURL=preview-layout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-layout.d.ts","sourceRoot":"","sources":["../src/preview-layout.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,SAAS,MAAM,YAAY,CAAC;AASnC,cAAM,aAAc,SAAQ,KAAK,CAAC,SAAS;IACzC,MAAM,CAAC,SAAS;;;;;;;;;MASd;IAEF,MAAM;CAeP;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import e from "./ui-layout.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { styled as r } from "@mui/material/styles";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
//#region src/preview-layout.tsx
|
|
7
|
+
var a = r(e)({
|
|
8
|
+
display: "flex",
|
|
9
|
+
flexDirection: "column",
|
|
10
|
+
position: "relative"
|
|
11
|
+
}), o = class extends t.Component {
|
|
12
|
+
static propTypes = {
|
|
13
|
+
ariaLabel: n.string,
|
|
14
|
+
children: n.oneOfType([n.arrayOf(n.node), n.node]).isRequired,
|
|
15
|
+
role: n.string,
|
|
16
|
+
extraCSSRules: n.shape({
|
|
17
|
+
names: n.arrayOf(n.string),
|
|
18
|
+
rules: n.string
|
|
19
|
+
}),
|
|
20
|
+
fontSizeFactor: n.number
|
|
21
|
+
};
|
|
22
|
+
render() {
|
|
23
|
+
let { children: e, ariaLabel: t, role: n, extraCSSRules: r, fontSizeFactor: o, classes: s } = this.props;
|
|
24
|
+
return /* @__PURE__ */ i(a, {
|
|
25
|
+
...t ? {
|
|
26
|
+
"aria-label": t,
|
|
27
|
+
role: n
|
|
28
|
+
} : {},
|
|
29
|
+
extraCSSRules: r,
|
|
30
|
+
fontSizeFactor: o,
|
|
31
|
+
classes: s,
|
|
32
|
+
children: e
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { o as default };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/render-ui/src/preview-prompt.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import { Component } from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class PreviewPrompt extends Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
prompt: PropTypes.Requireable<string>;
|
|
14
|
+
tagName: PropTypes.Requireable<string>;
|
|
15
|
+
className: PropTypes.Requireable<string>;
|
|
16
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
defaultClassName: PropTypes.Requireable<string>;
|
|
18
|
+
autoplayAudioEnabled: PropTypes.Requireable<boolean>;
|
|
19
|
+
customAudioButton: PropTypes.Requireable<PropTypes.InferProps<{
|
|
20
|
+
playImage: PropTypes.Requireable<string>;
|
|
21
|
+
pauseImage: PropTypes.Requireable<string>;
|
|
22
|
+
}>>;
|
|
23
|
+
};
|
|
24
|
+
static defaultProps: {
|
|
25
|
+
onClick: () => void;
|
|
26
|
+
};
|
|
27
|
+
parsedText: any;
|
|
28
|
+
addCustomAudioButtonControls(): void;
|
|
29
|
+
removeCustomAudioButtonListeners(): void;
|
|
30
|
+
componentDidMount(): void;
|
|
31
|
+
componentDidUpdate(prevProps: any): void;
|
|
32
|
+
componentWillUnmount(): void;
|
|
33
|
+
setupMathRendering(): void;
|
|
34
|
+
renderMathContent(): void;
|
|
35
|
+
alignImages(): void;
|
|
36
|
+
render(): JSX.Element;
|
|
37
|
+
}
|
|
38
|
+
export default PreviewPrompt;
|
|
39
|
+
//# sourceMappingURL=preview-prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-prompt.d.ts","sourceRoot":"","sources":["../src/preview-prompt.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,SAAS,MAAM,YAAY,CAAC;AA2DnC,qBAAa,aAAc,SAAQ,SAAS;IAC1C,MAAM,CAAC,SAAS;;;;;;;;;;;MAWd;IAEF,MAAM,CAAC,YAAY;;MAEjB;IAEF,UAAU,EAAE,GAAG,CAuCb;IAEF,4BAA4B;IA0D5B,gCAAgC;IAahC,iBAAiB;IAMjB,kBAAkB,CAAC,SAAS,KAAA;IAQ5B,oBAAoB;IAIpB,kBAAkB;IAIlB,iBAAiB;IAOjB,WAAW;IAkCX,MAAM;CAmBP;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { text as e } from "./color.js";
|
|
2
|
+
import { Component as t } from "react";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { styled as r } from "@mui/material/styles";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import { renderMath as a } from "@pie-element/shared-math-rendering-mathjax";
|
|
7
|
+
//#region src/preview-prompt.tsx
|
|
8
|
+
var o = r("div")(({ theme: t, tagName: n }) => ({
|
|
9
|
+
"&:not(.MathJax) > table": { borderCollapse: "collapse" },
|
|
10
|
+
"&:not(.MathJax) > table:has(tbody tr > th:first-child):not(:has(tbody tr > td:first-child)) tbody td:nth-child(even)": {
|
|
11
|
+
backgroundColor: "#f6f8fa",
|
|
12
|
+
color: t.palette.common.black
|
|
13
|
+
},
|
|
14
|
+
"&:not(.MathJax) > table:has(tbody tr > td:first-child) tbody tr:nth-child(even) td": {
|
|
15
|
+
backgroundColor: "#f6f8fa",
|
|
16
|
+
color: t.palette.common.black
|
|
17
|
+
},
|
|
18
|
+
"&:not(.MathJax) table td, &:not(.MathJax) table th": {
|
|
19
|
+
padding: ".6em 1em",
|
|
20
|
+
textAlign: "left"
|
|
21
|
+
},
|
|
22
|
+
"&:not(.MathJax) > table td > p.kds-indent": { textAlign: "initial" },
|
|
23
|
+
"&.prompt": {
|
|
24
|
+
verticalAlign: "middle",
|
|
25
|
+
color: e()
|
|
26
|
+
},
|
|
27
|
+
"&.legend": {
|
|
28
|
+
width: "100%",
|
|
29
|
+
fontSize: "inherit !important"
|
|
30
|
+
},
|
|
31
|
+
"&.rationale": {
|
|
32
|
+
paddingLeft: t.spacing(4),
|
|
33
|
+
paddingBottom: t.spacing(1)
|
|
34
|
+
},
|
|
35
|
+
"&.prompt-label": {
|
|
36
|
+
color: `${e()} !important`,
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexDirection: "column",
|
|
39
|
+
verticalAlign: "middle",
|
|
40
|
+
cursor: "pointer",
|
|
41
|
+
"& > p": { margin: "0 0 0 0 !important" }
|
|
42
|
+
}
|
|
43
|
+
})), s = /\\embed\{newLine\}\[\]/g, c = "\\newline ", l = class extends t {
|
|
44
|
+
static propTypes = {
|
|
45
|
+
prompt: n.string,
|
|
46
|
+
tagName: n.string,
|
|
47
|
+
className: n.string,
|
|
48
|
+
onClick: n.func,
|
|
49
|
+
defaultClassName: n.string,
|
|
50
|
+
autoplayAudioEnabled: n.bool,
|
|
51
|
+
customAudioButton: n.shape({
|
|
52
|
+
playImage: n.string,
|
|
53
|
+
pauseImage: n.string
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
static defaultProps = { onClick: () => {} };
|
|
57
|
+
parsedText = (e) => {
|
|
58
|
+
let { customAudioButton: t } = this.props, n = document.createElement("div");
|
|
59
|
+
n.innerHTML = e;
|
|
60
|
+
let r = n.querySelector("audio");
|
|
61
|
+
if (r) {
|
|
62
|
+
let e = document.createElement("source");
|
|
63
|
+
if (e.setAttribute("type", "audio/mp3"), e.setAttribute("src", r.getAttribute("src")), r.removeAttribute("src"), r.setAttribute("id", "pie-prompt-audio-player"), r.appendChild(e), t) {
|
|
64
|
+
r.style.display = "none";
|
|
65
|
+
let e = document.createElement("div");
|
|
66
|
+
e.id = "play-audio-button", Object.assign(e.style, {
|
|
67
|
+
cursor: "pointer",
|
|
68
|
+
display: "block",
|
|
69
|
+
width: "128px",
|
|
70
|
+
height: "128px",
|
|
71
|
+
backgroundImage: `url(${t.pauseImage})`,
|
|
72
|
+
backgroundSize: "cover",
|
|
73
|
+
borderRadius: "50%",
|
|
74
|
+
border: "1px solid #326295"
|
|
75
|
+
}), r.parentNode.insertBefore(e, r);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return n.innerHTML;
|
|
79
|
+
};
|
|
80
|
+
addCustomAudioButtonControls() {
|
|
81
|
+
let { autoplayAudioEnabled: e, customAudioButton: t } = this.props, n = document.getElementById("play-audio-button"), r = document.getElementById("pie-prompt-audio-player");
|
|
82
|
+
if (e && r && r.play().then(() => {
|
|
83
|
+
n && t && r.addEventListener("ended", a);
|
|
84
|
+
}).catch((e) => {
|
|
85
|
+
console.error("Error playing audio", e);
|
|
86
|
+
}), !n || !r || !t) return;
|
|
87
|
+
let i = () => {
|
|
88
|
+
r.paused && (n.style.backgroundImage.includes(t.pauseImage) || r.play());
|
|
89
|
+
}, a = () => {
|
|
90
|
+
n.style.backgroundImage = `url(${t.playImage})`;
|
|
91
|
+
}, o = () => {
|
|
92
|
+
Object.assign(n.style, {
|
|
93
|
+
backgroundImage: `url(${t.pauseImage})`,
|
|
94
|
+
border: "1px solid #ccc"
|
|
95
|
+
});
|
|
96
|
+
}, s = () => {
|
|
97
|
+
Object.assign(n.style, {
|
|
98
|
+
backgroundImage: `url(${t.playImage})`,
|
|
99
|
+
border: "1px solid #326295"
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
n.addEventListener("click", i), r.addEventListener("play", o), r.addEventListener("pause", s), r.addEventListener("ended", a), this._handlePlayClick = i, this._handleAudioPlay = o, this._handleAudioPause = s, this._handleAudioEnded = a;
|
|
103
|
+
}
|
|
104
|
+
removeCustomAudioButtonListeners() {
|
|
105
|
+
let e = document.getElementById("play-audio-button"), t = document.querySelector("audio");
|
|
106
|
+
!e || !t || (e.removeEventListener("click", this._handlePlayClick), t.removeEventListener("play", this._handleAudioPlay), t.removeEventListener("pause", this._handleAudioPause), t.removeEventListener("ended", this._handleAudioEnded));
|
|
107
|
+
}
|
|
108
|
+
componentDidMount() {
|
|
109
|
+
this.alignImages(), this.addCustomAudioButtonControls(), this.setupMathRendering();
|
|
110
|
+
}
|
|
111
|
+
componentDidUpdate(e) {
|
|
112
|
+
this.alignImages(), e.prompt !== this.props.prompt && this.renderMathContent();
|
|
113
|
+
}
|
|
114
|
+
componentWillUnmount() {
|
|
115
|
+
this.removeCustomAudioButtonListeners();
|
|
116
|
+
}
|
|
117
|
+
setupMathRendering() {
|
|
118
|
+
this.renderMathContent();
|
|
119
|
+
}
|
|
120
|
+
renderMathContent() {
|
|
121
|
+
let e = document.getElementById("preview-prompt");
|
|
122
|
+
e && typeof a == "function" && a(e);
|
|
123
|
+
}
|
|
124
|
+
alignImages() {
|
|
125
|
+
document.querySelectorAll("#preview-prompt").forEach((e) => {
|
|
126
|
+
let t = e.getElementsByTagName("img");
|
|
127
|
+
if (t && t.length) {
|
|
128
|
+
for (let e of t) if (e.attributes && e.attributes.alignment && e.attributes.alignment.value) {
|
|
129
|
+
let t = e.parentElement;
|
|
130
|
+
if (!(t.tagName === "DIV" && t.style.display === "flex" && t.style.width === "100%")) {
|
|
131
|
+
let n = document.createElement("div");
|
|
132
|
+
n.style.display = "flex", n.style.width = "100%";
|
|
133
|
+
let r = e.cloneNode(!0);
|
|
134
|
+
n.appendChild(r), t.replaceChild(n, e);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
render() {
|
|
141
|
+
let { prompt: e, tagName: t, className: n, onClick: r, defaultClassName: a } = this.props, l = `${n || ""} ${a || ""} ${t === "legend" ? "legend" : ""}`.trim();
|
|
142
|
+
return /* @__PURE__ */ i(o, {
|
|
143
|
+
as: t || "div",
|
|
144
|
+
id: "preview-prompt",
|
|
145
|
+
onClick: r,
|
|
146
|
+
className: l,
|
|
147
|
+
tagName: t,
|
|
148
|
+
dangerouslySetInnerHTML: { __html: this.parsedText(e || "").replace(s, c) }
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
//#endregion
|
|
153
|
+
export { l as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/render-ui/src/purpose.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
declare const Purpose: {
|
|
11
|
+
(props: any): JSX.Element;
|
|
12
|
+
propTypes: {
|
|
13
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
14
|
+
purpose: PropTypes.Requireable<string>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default Purpose;
|
|
18
|
+
//# sourceMappingURL=purpose.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"purpose.d.ts","sourceRoot":"","sources":["../src/purpose.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,QAAA,MAAM,OAAO;;;;;;CAMZ,CAAC;AAOF,eAAe,OAAO,CAAC"}
|
package/dist/purpose.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { Fragment as n, jsx as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/purpose.tsx
|
|
5
|
+
var i = (t) => /* @__PURE__ */ r(n, { children: e.Children.map(t.children, (n) => e.cloneElement(n, { "data-pie-purpose": t.purpose })) });
|
|
6
|
+
i.propTypes = {
|
|
7
|
+
children: t.node,
|
|
8
|
+
purpose: t.string
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { i as default };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/render-ui/src/readable.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import PropTypes from 'prop-types';
|
|
10
|
+
declare const Readable: {
|
|
11
|
+
(props: any): JSX.Element;
|
|
12
|
+
propTypes: {
|
|
13
|
+
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
|
|
14
|
+
false: PropTypes.Requireable<boolean>;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export default Readable;
|
|
18
|
+
//# sourceMappingURL=readable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readable.d.ts","sourceRoot":"","sources":["../src/readable.tsx"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,SAAS,MAAM,YAAY,CAAC;AAGnC,QAAA,MAAM,QAAQ;;;;;;CAQb,CAAC;AAOF,eAAe,QAAQ,CAAC"}
|
package/dist/readable.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { Fragment as n, jsx as r } from "react/jsx-runtime";
|
|
4
|
+
//#region src/readable.tsx
|
|
5
|
+
var i = (t) => /* @__PURE__ */ r(n, { children: e.Children.map(t.children, (n) => e.cloneElement(n, { "data-pie-readable": t.false === void 0 })) });
|
|
6
|
+
i.propTypes = {
|
|
7
|
+
children: t.node,
|
|
8
|
+
false: t.bool
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { i as default };
|