pixuireactcomponents 1.3.24 → 1.3.25

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.
Files changed (57) hide show
  1. package/lib/check/{util.jsx → util.js} +33 -39
  2. package/lib/preact-router/match/src/index.js +16 -7
  3. package/package.json +1 -1
  4. package/src/components/react/app/bulletscreen/BulletItemAnimation.d.ts +2 -2
  5. package/src/components/react/app/bulletscreen/{BulletItemAnimation.jsx → BulletItemAnimation.js} +7 -8
  6. package/src/components/react/app/bulletscreen/BulletScreenAnimation.d.ts +2 -2
  7. package/src/components/react/app/bulletscreen/{BulletScreenAnimation.jsx → BulletScreenAnimation.js} +8 -11
  8. package/src/components/react/app/button/{Button.jsx → Button.js} +6 -8
  9. package/src/components/react/app/carousel/Carousel.d.ts +1 -1
  10. package/src/components/react/app/carousel/{Carousel.jsx → Carousel.js} +28 -53
  11. package/src/components/react/app/checkBox/{CheckBox.jsx → CheckBox.js} +1 -1
  12. package/src/components/react/app/dropdown/{Dropdown.jsx → Dropdown.js} +5 -9
  13. package/src/components/react/app/imageViewer/{imageViewer.jsx → imageViewer.js} +7 -11
  14. package/src/components/react/app/slider/{Slider.jsx → Slider.js} +7 -13
  15. package/src/components/react/app/togglegroup/{ToggleGroup.jsx → ToggleGroup.js} +16 -18
  16. package/src/components/react/base/gradient/{GradientText.jsx → GradientText.js} +1 -1
  17. package/src/components/react/base/outlinetext/{OutlineText.jsx → OutlineText.js} +2 -3
  18. package/src/components/react/base/pixVideo/PixPlaceHolder.d.ts +2 -2
  19. package/src/components/react/base/pixVideo/{PixPlaceHolder.jsx → PixPlaceHolder.js} +3 -5
  20. package/src/sample/Images.d.ts +0 -31
  21. package/src/sample/Images.js +0 -60
  22. package/src/sample/OutlineText/OutlineDemo.d.ts +0 -20
  23. package/src/sample/OutlineText/OutlineDemo.jsx +0 -60
  24. package/src/sample/bulletscreen/BulletDemo.d.ts +0 -12
  25. package/src/sample/bulletscreen/BulletDemo.jsx +0 -83
  26. package/src/sample/button/ButtonDemo.d.ts +0 -4
  27. package/src/sample/button/ButtonDemo.jsx +0 -30
  28. package/src/sample/carousel/carouselDemo.d.ts +0 -1
  29. package/src/sample/carousel/carouselDemo.jsx +0 -107
  30. package/src/sample/checkBox/checkBoxDemo.d.ts +0 -1
  31. package/src/sample/checkBox/checkBoxDemo.jsx +0 -23
  32. package/src/sample/dropdown/DropdownDemo.d.ts +0 -6
  33. package/src/sample/dropdown/DropdownDemo.jsx +0 -65
  34. package/src/sample/dropdown/MoneyDropdownOption.d.ts +0 -6
  35. package/src/sample/dropdown/MoneyDropdownOption.jsx +0 -57
  36. package/src/sample/dropdown/MoneyDropdownSpreadMain.d.ts +0 -5
  37. package/src/sample/dropdown/MoneyDropdownSpreadMain.jsx +0 -50
  38. package/src/sample/dropdown/MoneyDropdownUnspreadMain.d.ts +0 -5
  39. package/src/sample/dropdown/MoneyDropdownUnspreadMain.jsx +0 -50
  40. package/src/sample/gradient/GradientDemo.d.ts +0 -16
  41. package/src/sample/gradient/GradientDemo.jsx +0 -53
  42. package/src/sample/imageViewer/Images.d.ts +0 -4
  43. package/src/sample/imageViewer/Images.jsx +0 -6
  44. package/src/sample/imageViewer/imageViewerDemo.d.ts +0 -10
  45. package/src/sample/imageViewer/imageViewerDemo.jsx +0 -70
  46. package/src/sample/slider/SliderDemo.d.ts +0 -10
  47. package/src/sample/slider/SliderDemo.jsx +0 -117
  48. package/src/sample/togglegroup/ToggleGroupDemo.d.ts +0 -4
  49. package/src/sample/togglegroup/ToggleGroupDemo.jsx +0 -64
  50. package/tsconfig.json +0 -55
  51. /package/lib/check/{main.jsx → main.js} +0 -0
  52. /package/lib/pi_component/tinyList/{tinyList.jsx → tinyList.js} +0 -0
  53. /package/src/components/react/app/dropdown/{DropdownOptionUI.jsx → DropdownOptionUI.js} +0 -0
  54. /package/src/components/react/app/dropdown/{DropdownSpreadMainUI.jsx → DropdownSpreadMainUI.js} +0 -0
  55. /package/src/components/react/app/dropdown/{DropdownUnspreadMainUI.jsx → DropdownUnspreadMainUI.js} +0 -0
  56. /package/src/components/react/base/pixVideo/{PixVideo.jsx → PixVideo.js} +0 -0
  57. /package/src/components/tools/{Logger.jsx → Logger.js} +0 -0
@@ -69,16 +69,16 @@ var Counter = /** @class */ (function (_super) {
69
69
  return _this;
70
70
  }
71
71
  Counter.prototype.render = function (props, state) {
72
- return (<div style={{
72
+ return (h("div", { style: {
73
73
  display: 'flex',
74
74
  flexDirection: 'row',
75
75
  // color: '#f93f00',
76
76
  backgroundColor: state.value % 2 ? '#992288' : '#33ff54',
77
- }}>
78
- Counter: {state.value}
79
- <div style={{ width: '20px' }}/>
80
- <div onClick={this.increment}>Increment</div>
81
- </div>);
77
+ } },
78
+ "Counter: ",
79
+ state.value,
80
+ h("div", { style: { width: '20px' } }),
81
+ h("div", { onClick: this.increment }, "Increment")));
82
82
  };
83
83
  return Counter;
84
84
  }(Component));
@@ -93,14 +93,14 @@ var Title = /** @class */ (function (_super) {
93
93
  return _this;
94
94
  }
95
95
  Title.prototype.render = function (props, state) {
96
- return (<div style={{
96
+ return (h("div", { style: {
97
97
  display: 'flex',
98
98
  flexDirection: 'column',
99
99
  backgroundColor: '#f98833',
100
- }}>
101
- title: {state.title}
102
- <Link href={wp('')}>back home</Link>
103
- </div>);
100
+ } },
101
+ "title: ",
102
+ state.title,
103
+ h(Link, { href: wp('') }, "back home")));
104
104
  };
105
105
  return Title;
106
106
  }(Component));
@@ -116,32 +116,26 @@ var makeError3 = function () { return __awaiter(void 0, void 0, void 0, function
116
116
  });
117
117
  }); };
118
118
  export var getView = function () {
119
- return (<div style={{ width: '99%' }}>
120
- {/* <Counter /> */}
121
- <Router>
122
- <Counter loggedIn={true} path={wp('')}/>
123
- <Title path={wp('hi')}/>
124
- </Router>
125
- <Link href={wp('hi')}>Profile</Link>
126
- <div className={css.flexrow}>
127
- <img src={preact} onClick={function () {
128
- console.log('click preact...');
129
- makeError2();
130
- }}></img>
131
- <img src={pix}></img>
132
- <div style={{ width: '200px', height: '100px', borderImage: "url(".concat(border, ") 2 2 2 2 fill stretch") }}/>
133
- </div>
134
- <div style={{ border: '1px solid black', width: 200, height: 200 }}>
135
- <video autoPlay src={'https://www.runoob.com/try/demo_source/mov_bbb.mp4'} style={{ loop: 'loop', width: 200, height: 200 }}/>
136
- </div>
137
- <div onClick={function (e) { return console.log('click', e); }}>Pixui is a embeddable browser engine</div>
138
- <div>Preact is a react-like framework</div>
139
- <div>with webpack and typescript workflow</div>
140
- <div className={css.flexrow}>
141
- <div>easy! </div>
142
- <div>beautiful!</div>
143
- <div>crossplatform!</div>
144
- </div>
145
- <div>let's start and go further!</div>
146
- </div>);
119
+ return (h("div", { style: { width: '99%' } },
120
+ h(Router, null,
121
+ h(Counter, { loggedIn: true, path: wp('') }),
122
+ h(Title, { path: wp('hi') })),
123
+ h(Link, { href: wp('hi') }, "Profile"),
124
+ h("div", { className: css.flexrow },
125
+ h("img", { src: preact, onClick: function () {
126
+ console.log('click preact...');
127
+ makeError2();
128
+ } }),
129
+ h("img", { src: pix }),
130
+ h("div", { style: { width: '200px', height: '100px', borderImage: "url(".concat(border, ") 2 2 2 2 fill stretch") } })),
131
+ h("div", { style: { border: '1px solid black', width: 200, height: 200 } },
132
+ h("video", { autoPlay: true, src: 'https://www.runoob.com/try/demo_source/mov_bbb.mp4', style: { loop: 'loop', width: 200, height: 200 } })),
133
+ h("div", { onClick: function (e) { return console.log('click', e); } }, "Pixui is a embeddable browser engine"),
134
+ h("div", null, "Preact is a react-like framework"),
135
+ h("div", null, "with webpack and typescript workflow"),
136
+ h("div", { className: css.flexrow },
137
+ h("div", null, "easy! "),
138
+ h("div", null, "beautiful!"),
139
+ h("div", null, "crossplatform!")),
140
+ h("div", null, "let's start and go further!")));
147
141
  };
@@ -13,6 +13,17 @@ var __extends = (this && this.__extends) || (function () {
13
13
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
14
14
  };
15
15
  })();
16
+ var __assign = (this && this.__assign) || function () {
17
+ __assign = Object.assign || function(t) {
18
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
19
+ s = arguments[i];
20
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
21
+ t[p] = s[p];
22
+ }
23
+ return t;
24
+ };
25
+ return __assign.apply(this, arguments);
26
+ };
16
27
  var __rest = (this && this.__rest) || function (s, e) {
17
28
  var t = {};
18
29
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -56,12 +67,10 @@ var Match = /** @class */ (function (_super) {
56
67
  export { Match };
57
68
  export var Link = function (_a) {
58
69
  var activeClassName = _a.activeClassName, path = _a.path, props = __rest(_a, ["activeClassName", "path"]);
59
- return (<Match path={path || props.href}>
60
- {function (_a) {
61
- var matches = _a.matches;
62
- var cls = [props.class || props.className, matches && activeClassName].filter(Boolean).join(' ');
63
- return <StaticLink {...props} className={cls}/>;
64
- }}
65
- </Match>);
70
+ return (h(Match, { path: path || props.href }, function (_a) {
71
+ var matches = _a.matches;
72
+ var cls = [props.class || props.className, matches && activeClassName].filter(Boolean).join(' ');
73
+ return h(StaticLink, __assign({}, props, { className: cls }));
74
+ }));
66
75
  };
67
76
  export default Match;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.3.24",
3
+ "version": "1.3.25",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,4 +1,4 @@
1
- import { Component } from 'preact';
1
+ import { Component, h } from 'preact';
2
2
  export declare class BulletInfo {
3
3
  key: number;
4
4
  text: string;
@@ -27,5 +27,5 @@ export declare class BulletItemAnimation extends Component<{
27
27
  onAnimationEnd: () => void;
28
28
  setFreeChannelTimer: () => void;
29
29
  freeChannel: () => void;
30
- render(): any;
30
+ render(): h.JSX.Element;
31
31
  }
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
14
14
  };
15
15
  })();
16
16
  import { createRef } from 'lib/preact/src/create-element';
17
- import { Component } from 'preact';
17
+ import { Component, h } from 'preact';
18
18
  // 弹幕相关个性化信息
19
19
  var BulletInfo = /** @class */ (function () {
20
20
  function BulletInfo(key, text, channel, color, fontSize) {
@@ -48,15 +48,15 @@ var BulletItemAnimation = /** @class */ (function (_super) {
48
48
  var _this = _super.call(this, props) || this;
49
49
  _this.freeChannelTimer = undefined;
50
50
  _this.refText = createRef();
51
- _this.onAnimationStart = function () {
52
- };
51
+ _this.onAnimationStart = function () { };
53
52
  _this.onAnimationEnd = function () {
54
53
  _this.props.onItemFree();
55
54
  };
56
55
  _this.setFreeChannelTimer = function () {
57
56
  var realWidthStr = window.getComputedStyle(_this.refText.current, null).getPropertyValue('width');
58
57
  var widthNum = parseInt(realWidthStr.substring(0, realWidthStr.length - 2));
59
- _this.freeChannelTimer = setTimeout(_this.freeChannel, (widthNum + BULLET_DISTANCE) / (_this.props.bulletConfig.screenWidth + BULLET_MAX_LEN) * _this.props.bulletConfig.totalTime);
58
+ _this.freeChannelTimer = setTimeout(_this.freeChannel, ((widthNum + BULLET_DISTANCE) / (_this.props.bulletConfig.screenWidth + BULLET_MAX_LEN)) *
59
+ _this.props.bulletConfig.totalTime);
60
60
  };
61
61
  _this.freeChannel = function () {
62
62
  _this.props.onChannelFree(_this.props.bulletInfo.channel);
@@ -72,7 +72,7 @@ var BulletItemAnimation = /** @class */ (function (_super) {
72
72
  BulletItemAnimation.prototype.render = function () {
73
73
  var isMe = false;
74
74
  var bulletStyle = {
75
- marginTop: (this.props.bulletInfo.channel * this.props.bulletConfig.channelHeight) + 'px',
75
+ marginTop: this.props.bulletInfo.channel * this.props.bulletConfig.channelHeight + 'px',
76
76
  height: this.props.bulletConfig.channelHeight + 'px',
77
77
  left: this.props.bulletConfig.screenWidth + 'px',
78
78
  animation: 'bulletKeyframe 10s linear 1',
@@ -85,9 +85,8 @@ var BulletItemAnimation = /** @class */ (function (_super) {
85
85
  fontSize: this.props.bulletInfo.fontSize + 'px',
86
86
  color: this.props.bulletInfo.color,
87
87
  };
88
- return (<div ref={this.refText} style={bulletStyle}>
89
- <text>{this.props.bulletInfo.text}</text>
90
- </div>);
88
+ return (h("div", { ref: this.refText, style: bulletStyle },
89
+ h("text", null, this.props.bulletInfo.text)));
91
90
  };
92
91
  return BulletItemAnimation;
93
92
  }(Component));
@@ -1,4 +1,4 @@
1
- import { Component } from 'preact';
1
+ import { Component, h } from 'preact';
2
2
  import { BulletInfo } from './BulletItemAnimation';
3
3
  export declare class BulletScreenAnimationData {
4
4
  generateCycle: number;
@@ -47,5 +47,5 @@ export declare class BulletScreenAnimation extends Component<{
47
47
  getAvailableChannelByPosition: () => any;
48
48
  onItemFree: () => void;
49
49
  onChannelFree: (channel: any) => void;
50
- render(): any;
50
+ render(): h.JSX.Element;
51
51
  }
@@ -14,7 +14,7 @@ var __extends = (this && this.__extends) || (function () {
14
14
  };
15
15
  })();
16
16
  /* eslint-disable linebreak-style */
17
- import { Component } from 'preact';
17
+ import { Component, h } from 'preact';
18
18
  import { BulletInfo, BulletConfig, BulletItemAnimation } from './BulletItemAnimation';
19
19
  import { Logger } from '../../../tools/Logger';
20
20
  // item数据类型
@@ -69,7 +69,7 @@ var BulletScreenAnimation = /** @class */ (function (_super) {
69
69
  _this.initChannels();
70
70
  var newIndex = _this.state.refreshIndex + 1;
71
71
  _this.setState({
72
- refreshIndex: newIndex
72
+ refreshIndex: newIndex,
73
73
  });
74
74
  };
75
75
  _this.SetScreenSizeChanging = function () {
@@ -82,8 +82,7 @@ var BulletScreenAnimation = /** @class */ (function (_super) {
82
82
  _this.generateDynamicAnimation('bulletKeyframe', "from{\n left: ".concat(currentProps.screenWidth, "px\n }\n to{\n left: -400px;\n }"));
83
83
  };
84
84
  _this.isScreenSizeSame = function (oldProps, newProps) {
85
- if (oldProps.screenWidth == newProps.screenWidth &&
86
- oldProps.screenHeight == newProps.screenHeight) {
85
+ if (oldProps.screenWidth == newProps.screenWidth && oldProps.screenHeight == newProps.screenHeight) {
87
86
  return true;
88
87
  }
89
88
  return false;
@@ -160,7 +159,7 @@ var BulletScreenAnimation = /** @class */ (function (_super) {
160
159
  _this.hasPosition[channel] = true;
161
160
  };
162
161
  _this.setState({
163
- refreshIndex: 0
162
+ refreshIndex: 0,
164
163
  });
165
164
  _this.initChannels();
166
165
  _this.consumeBulletTimer = setInterval(function () {
@@ -179,7 +178,7 @@ var BulletScreenAnimation = /** @class */ (function (_super) {
179
178
  _this.hasPosition[curChannel] = false;
180
179
  var newIndex = _this.state.refreshIndex + 1;
181
180
  _this.setState({
182
- refreshIndex: newIndex
181
+ refreshIndex: newIndex,
183
182
  });
184
183
  }
185
184
  }, _this.props.screenData.generateCycle);
@@ -222,11 +221,9 @@ var BulletScreenAnimation = /** @class */ (function (_super) {
222
221
  };
223
222
  var screenData = this.props.screenData;
224
223
  var commonInfo = new BulletConfig(this.props.screenWidth, screenData.channelHeight, screenData.totalTime);
225
- return (<div style={container}>
226
- {bulletDataList.map(function (value, index) {
227
- return (<BulletItemAnimation key={value.key} bulletInfo={value} bulletConfig={commonInfo} onItemFree={_this.onItemFree} onChannelFree={_this.onChannelFree}/>);
228
- })}
229
- </div>);
224
+ return (h("div", { style: container }, bulletDataList.map(function (value, index) {
225
+ return (h(BulletItemAnimation, { key: value.key, bulletInfo: value, bulletConfig: commonInfo, onItemFree: _this.onItemFree, onChannelFree: _this.onChannelFree }));
226
+ })));
230
227
  };
231
228
  return BulletScreenAnimation;
232
229
  }(Component));
@@ -9,20 +9,18 @@ var ButtonState;
9
9
  export var Button = function (props) {
10
10
  var _a;
11
11
  var buttonState = (_a = useState(ButtonState.normal), _a[0]), setButtonState = _a[1];
12
- return (<div style={buttonState == ButtonState.normal
12
+ return (h("div", { style: buttonState == ButtonState.normal
13
13
  ? props.normalStyle
14
14
  : buttonState == ButtonState.hover
15
15
  ? props.hoverStyle
16
- : props.pressStyle} onMouseDown={function () {
16
+ : props.pressStyle, onMouseDown: function () {
17
17
  setButtonState(ButtonState.press);
18
- }} onMouseUp={function () {
18
+ }, onMouseUp: function () {
19
19
  setButtonState(ButtonState.hover);
20
20
  props.clickEvent();
21
- }} onMouseOver={function () {
21
+ }, onMouseOver: function () {
22
22
  setButtonState(ButtonState.hover);
23
- }} onMouseOut={function () {
23
+ }, onMouseOut: function () {
24
24
  setButtonState(ButtonState.normal);
25
- }}>
26
- {props.text}
27
- </div>);
25
+ } }, props.text));
28
26
  };
@@ -16,7 +16,7 @@ import { h } from 'preact';
16
16
  */
17
17
  export declare function Carousel(props: {
18
18
  cRef?: any;
19
- children?: HTMLElement[];
19
+ children?: preact.JSX.Element[] | HTMLElement[];
20
20
  defaultIndex?: number;
21
21
  compWidth?: number;
22
22
  compHeight?: number;
@@ -232,59 +232,34 @@ export function Carousel(props) {
232
232
  onclickEvent(showIndex - 1);
233
233
  }
234
234
  };
235
- return (<div style={{ flexDirection: 'column' }}>
236
- <div style={__assign(__assign({ position: 'relative' }, itemBoxStyle), { overflow: 'hidden', flexShrink: 0 })}>
237
- <div style={{
238
- display: 'flex',
239
- width: isVertical ? compWidth : compWidth * carouselItems.length + 'px',
240
- height: isVertical ? compHeight * carouselItems.length : compHeight + 'px',
241
- transition: "transform ".concat(showTransition ? '0.5s' : '0s', " ease 0s"),
242
- transform: isVertical
243
- ? "translate(0px, ".concat(offset + gesteroffset[1], "px)")
244
- : "translate(".concat(offset + gesteroffset[0], "px, 0px)"),
245
- flexDirection: isVertical ? 'column' : 'row',
246
- flexShrink: 0,
247
- }} class="wrapper" onTransitionEnd={handleTransitionEnd}>
248
- {carouselItems.map(function (child) { return child; })}
249
- </div>
250
- </div>
251
-
252
- {/* 手势 */}
253
- <div draggable={true} style={__assign(__assign({}, itemBoxStyle), { position: 'absolute' })} onClick={function () {
254
- gestureClick(props);
255
- }} class={'GestureComp'} onDragStart={function (e) {
256
- if (children.length > 1) {
257
- gestureDown(e);
258
- }
259
- }} onDrag={function (e) {
260
- if (children.length > 1) {
261
- gestureMove(e);
262
- }
263
- }} onDragEnd={function () {
264
- if (children.length > 1) {
265
- gestureUp();
266
- }
267
- }}/>
268
-
269
- {/* 调试信息 */}
270
- {/* {logTex}
271
- {gesteroffset[0]}
272
- {gesteroffset[1]} */}
273
-
274
- {/* 页码图标 */}
275
- {/* <div style={{ flexDirection: isVertical ? 'column' : 'row' }}>
276
- {children.map((v, i) => {
277
- return (
278
- <div
279
- style={showIndex == i + 1 ? indicatorSelectedStyle : indicatorStyle}
280
- onClick={() => {
281
- setShowIndex(i + 1);
282
- }}
283
- />
284
- );
285
- })}
286
- </div> */}
287
- </div>);
235
+ return (h("div", { style: { flexDirection: 'column' } },
236
+ h("div", { style: __assign(__assign({ position: 'relative' }, itemBoxStyle), { overflow: 'hidden', flexShrink: 0 }) },
237
+ h("div", { style: {
238
+ display: 'flex',
239
+ width: isVertical ? compWidth : compWidth * carouselItems.length + 'px',
240
+ height: isVertical ? compHeight * carouselItems.length : compHeight + 'px',
241
+ transition: "transform ".concat(showTransition ? '0.5s' : '0s', " ease 0s"),
242
+ transform: isVertical
243
+ ? "translate(0px, ".concat(offset + gesteroffset[1], "px)")
244
+ : "translate(".concat(offset + gesteroffset[0], "px, 0px)"),
245
+ flexDirection: isVertical ? 'column' : 'row',
246
+ flexShrink: 0,
247
+ }, class: "wrapper", onTransitionEnd: handleTransitionEnd }, carouselItems.map(function (child) { return child; }))),
248
+ h("div", { draggable: true, style: __assign(__assign({}, itemBoxStyle), { position: 'absolute' }), onClick: function () {
249
+ gestureClick(props);
250
+ }, class: 'GestureComp', onDragStart: function (e) {
251
+ if (children.length > 1) {
252
+ gestureDown(e);
253
+ }
254
+ }, onDrag: function (e) {
255
+ if (children.length > 1) {
256
+ gestureMove(e);
257
+ }
258
+ }, onDragEnd: function () {
259
+ if (children.length > 1) {
260
+ gestureUp();
261
+ }
262
+ } })));
288
263
  }
289
264
  // Carousel.Item = (props) => {
290
265
  // return (
@@ -9,5 +9,5 @@ export function Checkbox(props) {
9
9
  }
10
10
  setSelected(!selected);
11
11
  };
12
- return <div onClick={cli}>{selected ? selectedNode : notSelectedNode}</div>;
12
+ return h("div", { onClick: cli }, selected ? selectedNode : notSelectedNode);
13
13
  }
@@ -74,9 +74,7 @@ var Dropdown = /** @class */ (function (_super) {
74
74
  if (!this.state.isSpread) {
75
75
  this.props.unspreadMainUI.props.info = this.props.config.datas[this.state.selectedIndex];
76
76
  this.props.unspreadMainUI.props.openList = this.openList;
77
- return (<div>
78
- {this.props.unspreadMainUI}
79
- </div>);
77
+ return (h("div", null, this.props.unspreadMainUI));
80
78
  }
81
79
  this.props.spreadMainUI.props.info = this.props.config.datas[this.state.selectedIndex];
82
80
  this.props.spreadMainUI.props.closeList = this.closeList;
@@ -84,12 +82,10 @@ var Dropdown = /** @class */ (function (_super) {
84
82
  var _optionsUI = this.props.optionsUI.filter(function (v) { return v.props.index != _this.state.selectedIndex; });
85
83
  if (_optionsUI.length > 0)
86
84
  _optionsUI[_optionsUI.length - 1].props['isLast'] = true;
87
- return (<div>
88
- <div style={this.props.config.spreadStyle}>
89
- {this.props.spreadMainUI}
90
- <div style={optionsDivStyle}>{_optionsUI}</div>
91
- </div>
92
- </div>);
85
+ return (h("div", null,
86
+ h("div", { style: this.props.config.spreadStyle },
87
+ this.props.spreadMainUI,
88
+ h("div", { style: optionsDivStyle }, _optionsUI))));
93
89
  };
94
90
  return Dropdown;
95
91
  }(Component));
@@ -90,17 +90,13 @@ var ImageViewer = /** @class */ (function (_super) {
90
90
  // forceupdate: false,
91
91
  // })
92
92
  // }
93
- return (<div style={this.props.backgroundStyle} onClick={this.onClose}>
94
- <div style={this.props.imageBoxStyle}>
95
- <div id="imageArea" style={this.props.imageAreaStyle}>
96
- {this.state.reCalSize &&
97
- <img style={this.props.imageStyle} src={this.props.src} width={this.state.imageWidth} height={this.state.imageHeight} onClick={this.onBlock}/>}
98
-
99
- {/* 用于获取原图片大小 */!this.state.reCalSize &&
100
- <img onLoad={this.handleImageLoad} style={{ display: 'hidden' }} src={this.props.src}/>}
101
- </div>
102
- </div>
103
- </div>);
93
+ return (h("div", { style: this.props.backgroundStyle, onClick: this.onClose },
94
+ h("div", { style: this.props.imageBoxStyle },
95
+ h("div", { id: "imageArea", style: this.props.imageAreaStyle },
96
+ this.state.reCalSize &&
97
+ h("img", { style: this.props.imageStyle, src: this.props.src, width: this.state.imageWidth, height: this.state.imageHeight, onClick: this.onBlock }),
98
+ !this.state.reCalSize &&
99
+ h("img", { onLoad: this.handleImageLoad, style: { display: 'hidden' }, src: this.props.src })))));
104
100
  };
105
101
  return ImageViewer;
106
102
  }(Component));
@@ -276,19 +276,13 @@ var Slider = /** @class */ (function (_super) {
276
276
  this.computeDecButtonStyle();
277
277
  this.computeWithButtonStyle();
278
278
  var hasDot = this.props.hasDot === undefined || this.props.hasDot === true;
279
- return (<div style={this.props.hasIncDecButton ? withButtonStyle : {}}>
280
- {this.props.hasIncDecButton && <img src={this.props.decButtonBg} style={decButtonStyle} onClick={this.onDecClick}/>}
281
- <div ref={this.refWrapper} style={wrapperStyle}>
282
- <div style={outerStyle}>
283
- <div style={innerStyle}>
284
- <div style={dotWrapperStyle} draggable={true} onDragStart={this.onDragStart} onDrag={this.onDrag} onDragEnd={this.onDragEnd}>
285
- {hasDot && <img src={this.props.dotBg} style={dotStyle}/>}
286
- </div>
287
- </div>
288
- </div>
289
- </div>
290
- {this.props.hasIncDecButton && <img src={this.props.incButtonBg} style={incButtonStyle} onClick={this.onIncClick}/>}
291
- </div>);
279
+ return (h("div", { style: this.props.hasIncDecButton ? withButtonStyle : {} },
280
+ this.props.hasIncDecButton && h("img", { src: this.props.decButtonBg, style: decButtonStyle, onClick: this.onDecClick }),
281
+ h("div", { ref: this.refWrapper, style: wrapperStyle },
282
+ h("div", { style: outerStyle },
283
+ h("div", { style: innerStyle },
284
+ h("div", { style: dotWrapperStyle, draggable: true, onDragStart: this.onDragStart, onDrag: this.onDrag, onDragEnd: this.onDragEnd }, hasDot && h("img", { src: this.props.dotBg, style: dotStyle }))))),
285
+ this.props.hasIncDecButton && h("img", { src: this.props.incButtonBg, style: incButtonStyle, onClick: this.onIncClick })));
292
286
  };
293
287
  return Slider;
294
288
  }(Component));
@@ -25,7 +25,7 @@ var ToggleGroup = /** @class */ (function (_super) {
25
25
  _this.items = [];
26
26
  _this.refreshAll = true;
27
27
  _this.GenerateToggleItem = function (toggleItem, togglePic, index, refreshAll) {
28
- return (<Toggle toggleItem={toggleItem} togglePic={togglePic} index={index} checkSelected={_this.checkSelected} refreshAll={refreshAll}/>);
28
+ return (h(Toggle, { toggleItem: toggleItem, togglePic: togglePic, index: index, checkSelected: _this.checkSelected, refreshAll: refreshAll }));
29
29
  };
30
30
  _this.checkSelected = function (index) {
31
31
  if (_this.isMultiOption)
@@ -65,7 +65,7 @@ var ToggleGroup = /** @class */ (function (_super) {
65
65
  for (var i = 0; i < this.toggleArray.length; i++) {
66
66
  this.items.push(this.GenerateToggleItem(this.toggleArray[i], this.togglePic, i, this.refreshAll));
67
67
  }
68
- return <div style={{ flexDirection: 'row' }}>{this.items}</div>;
68
+ return h("div", { style: { flexDirection: 'row' } }, this.items);
69
69
  };
70
70
  return ToggleGroup;
71
71
  }(Component));
@@ -94,22 +94,20 @@ var Toggle = /** @class */ (function (_super) {
94
94
  return;
95
95
  }
96
96
  this.refreshAll = props.refreshAll;
97
- return (<div style={{ alignItems: 'flex-end', flexDirection: 'row' }}>
98
- <div style={{
99
- width: '36px',
100
- height: '36px',
101
- backgroundSize: 'contain',
102
- backgroundImage: "url(".concat(this.state.isSelected ? this.selectedPic : this.notSelectedPic, ")"),
103
- }} onClick={function () {
104
- _this.state.isSelected ? _this.notSelectedFun() : _this.selectedFun();
105
- _this.setState({ isSelected: !_this.state.isSelected });
106
- _this.checkSelected(_this.index);
107
- }}></div>
108
- <div>
109
- <text>{"".concat(this.toggleText)}</text>
110
- </div>
111
- <div style={{ width: '50px' }}></div>
112
- </div>);
97
+ return (h("div", { style: { alignItems: 'flex-end', flexDirection: 'row' } },
98
+ h("div", { style: {
99
+ width: '36px',
100
+ height: '36px',
101
+ backgroundSize: 'contain',
102
+ backgroundImage: "url(".concat(this.state.isSelected ? this.selectedPic : this.notSelectedPic, ")"),
103
+ }, onClick: function () {
104
+ _this.state.isSelected ? _this.notSelectedFun() : _this.selectedFun();
105
+ _this.setState({ isSelected: !_this.state.isSelected });
106
+ _this.checkSelected(_this.index);
107
+ } }),
108
+ h("div", null,
109
+ h("text", null, "".concat(this.toggleText))),
110
+ h("div", { style: { width: '50px' } })));
113
111
  };
114
112
  return Toggle;
115
113
  }(Component));
@@ -293,7 +293,7 @@ var GradientText = /** @class */ (function (_super) {
293
293
  GradientText.prototype.render = function (props) {
294
294
  var style = !props.style ? { width: '200px', height: '200px', backgroundColor: '#FF00FFFF' } : props.style;
295
295
  this.printLog('OnRender');
296
- return (<pixslot style={style} src='pixui://method:placeholder' onLoad={this.onLoad.bind(this)}/>);
296
+ return (h("pixslot", { style: style, src: 'pixui://method:placeholder', onLoad: this.onLoad.bind(this) }));
297
297
  };
298
298
  return GradientText;
299
299
  }(Component));
@@ -130,9 +130,8 @@ export var OutlineText = /** @class */ (function (_super) {
130
130
  this.outline.effectDistance = new CS.UnityEngine.Vector2(this.props.outlineDistance.x, this.props.outlineDistance.y);
131
131
  };
132
132
  OutlineText.prototype.render = function () {
133
- return (<div style={this.props.style}>
134
- <pixslot style={{ width: '100%', height: '100%' }} src={'pixui://method:placeholder'} onLoad={this.OnLoad.bind(this)}/>
135
- </div>);
133
+ return (h("div", { style: this.props.style },
134
+ h("pixslot", { style: { width: '100%', height: '100%' }, src: 'pixui://method:placeholder', onLoad: this.OnLoad.bind(this) })));
136
135
  };
137
136
  OutlineText.defaultProps = {
138
137
  style: defaultStyle,
@@ -1,4 +1,4 @@
1
- import { Component } from 'preact';
1
+ import { Component, h } from 'preact';
2
2
  export interface PixPlaceHolderProps {
3
3
  /** 每次 src 属性被修改时会派发onload事件 */
4
4
  onload?: (e: any) => any;
@@ -27,5 +27,5 @@ export declare class PixPlaceHolder<T extends PixPlaceHolderProps> extends Compo
27
27
  onAttach(attachment: any, windowId: any, handle: any): void;
28
28
  onLoad(e: PixPlaceHolderLoadEvent, ...rest: any[]): void;
29
29
  onError(...args: any[]): void;
30
- render(): any;
30
+ render(): h.JSX.Element;
31
31
  }
@@ -22,7 +22,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
22
22
  }
23
23
  return to.concat(ar || Array.prototype.slice.call(from));
24
24
  };
25
- import { Component } from 'preact';
25
+ import { Component, h } from 'preact';
26
26
  var PixPlaceHolder = /** @class */ (function (_super) {
27
27
  __extends(PixPlaceHolder, _super);
28
28
  function PixPlaceHolder() {
@@ -90,11 +90,9 @@ var PixPlaceHolder = /** @class */ (function (_super) {
90
90
  var _this = this;
91
91
  var className = ['pixui-placeholder', this.props.className].filter(function (c) { return !!c; }).join(' ');
92
92
  var style = this.props.style ? this.props.style : {};
93
- return (<pixslot className={className} onLoad={this.onLoad.bind(this)} src="pixui://method:placeholder" ref={function (ref) {
93
+ return (h("pixslot", { className: className, onLoad: this.onLoad.bind(this), src: "pixui://method:placeholder", ref: function (ref) {
94
94
  _this.dom = ref;
95
- }} onerror={this.onError} style={style}>
96
- {this.props.children}
97
- </pixslot>);
95
+ }, onerror: this.onError, style: style }, this.props.children));
98
96
  };
99
97
  return PixPlaceHolder;
100
98
  }(Component));