@difizen/libro-search 0.1.33 → 0.1.35

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.
@@ -1 +1 @@
1
- {"version":3,"file":"libro-search-view.d.ts","sourceRoot":"","sources":["../src/libro-search-view.tsx"],"names":[],"mappings":";AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,OAAO,EAAE,QAAQ,EAAsB,MAAM,mBAAmB,CAAC;AAIjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAI9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAM3D,eAAO,MAAM,aAAa,+CAYzB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAgB/B,CAAC;AAEF,eAAO,MAAM,eAAe,0CAAoB,CAAC;AAEjD,eAAO,MAAM,aAAa,+CAyIzB,CAAC;AAEF,eAAO,MAAM,eAAe,0FAiB1B,CAAC;AAEH,qBAEa,eAAgB,SAAQ,QAAQ;IAC3C,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACvB,UAAU,EAAE,eAAe,CAAC;IAC3B,KAAK,EAAE,gBAAgB,CAAC;IACd,qBAAqB,EAAE,0BAA0B,CAAC;IACtF,KAAK,CAAC,EAAE,SAAS,CAAC;IACV,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,aAAa,UAAS;IAC9B,IAAI,cAAc,IAAI,OAAO,CAE5B;IACO,cAAc,UAAS;IACvB,OAA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;IAEF,aAAa,aAGX;IAEF,mBAAmB,aAGjB;IAEF,cAAc,aAGZ;IAEF,IAAI,aAEF;IAEF,QAAQ,aAEN;IAEF,sBAAsB,MAAO,mBAAmB,UAI9C;IAEF,OAAO,aAEL;IACF,UAAU,aAER;IACF,YAAY,aAMV;IACF,eAAe,eAUb;IAEF,SAAS,YAAmB,OAAO,mBAMjC;IAEF,aAAa,MAAO,aAAa,UAqB/B;IAEF,gBAAgB,MAAO,MAAM,WAAW,CAAC,gBAAgB,CAAC,UAKxD;IAEF,mBAAmB,MAAO,MAAM,WAAW,CAAC,gBAAgB,CAAC,UAE3D;CACH"}
@@ -20,11 +20,11 @@ function _applyDecoratedDescriptor(target, property, decorators, descriptor, con
20
20
  function _initializerWarningHelper(descriptor, context) { throw new Error('Decorating class property failed. Please ensure that ' + 'transform-class-properties is enabled and runs after the decorators transform.'); }
21
21
  import { ArrowDownOutlined, ArrowUpOutlined, CloseOutlined, createFromIconfontCN, EllipsisOutlined, RightOutlined } from '@ant-design/icons';
22
22
  import { LibroContextKey } from '@difizen/libro-core';
23
- import { prop, useInject, useObserve, watch } from '@difizen/mana-app';
23
+ import { prop, ThemeService, useInject, useObserve, watch } from '@difizen/mana-app';
24
24
  import { BaseView, view, ViewInstance } from '@difizen/mana-app';
25
25
  import { inject, transient } from '@difizen/mana-app';
26
26
  import { l10n } from '@difizen/mana-l10n';
27
- import { Button, Checkbox, Input, Tag } from 'antd';
27
+ import { Button, Checkbox, ConfigProvider, Input, Tag, theme } from 'antd';
28
28
  import classnames from 'classnames';
29
29
  import { forwardRef, memo, useEffect, useRef } from 'react';
30
30
  import { LibroSearchProviderFactory } from "./libro-search-provider.js";
@@ -67,6 +67,7 @@ export var SearchContent = function SearchContent() {
67
67
  var _instance$searchProvi;
68
68
  var instance = useInject(ViewInstance);
69
69
  var findInputRef = useRef(null);
70
+ var themeService = useInject(ThemeService);
70
71
  useEffect(function () {
71
72
  var _instance$container;
72
73
  if (findInputRef.current) {
@@ -82,117 +83,122 @@ export var SearchContent = function SearchContent() {
82
83
  }
83
84
  return;
84
85
  }, [instance]);
85
- return /*#__PURE__*/_jsxs("div", {
86
- className: "libro-search-content",
87
- style: {
88
- height: "".concat(instance.contentHeight, "px")
86
+ return /*#__PURE__*/_jsx(ConfigProvider, {
87
+ theme: {
88
+ algorithm: themeService.getCurrentTheme().type === 'dark' ? theme.darkAlgorithm : theme.defaultAlgorithm
89
89
  },
90
- children: [/*#__PURE__*/_jsx(ReplaceToggle, {}), /*#__PURE__*/_jsxs("table", {
91
- className: "libro-search-input-area",
92
- children: [/*#__PURE__*/_jsxs("tr", {
93
- className: "libro-search-row",
94
- children: [/*#__PURE__*/_jsx("td", {
95
- className: "libro-search-input",
96
- children: /*#__PURE__*/_jsx(Input, {
97
- ref: findInputRef,
98
- value: instance.findStr,
99
- onChange: instance.handleFindChange,
100
- size: "small",
101
- placeholder: "\u641C\u7D22",
102
- onFocus: function onFocus() {
103
- instance.hasFocus = true;
104
- },
105
- onBlur: function onBlur() {
106
- instance.hasFocus = false;
107
- },
108
- suffix: /*#__PURE__*/_jsxs("span", {
109
- className: "libro-search-input-suffix",
110
- children: [/*#__PURE__*/_jsx(IconFont, {
111
- className: classnames({
112
- 'libro-search-input-suffix-active': instance.caseSensitive
90
+ children: /*#__PURE__*/_jsxs("div", {
91
+ className: "libro-search-content",
92
+ style: {
93
+ height: "".concat(instance.contentHeight, "px")
94
+ },
95
+ children: [/*#__PURE__*/_jsx(ReplaceToggle, {}), /*#__PURE__*/_jsxs("table", {
96
+ className: "libro-search-input-area",
97
+ children: [/*#__PURE__*/_jsxs("tr", {
98
+ className: "libro-search-row",
99
+ children: [/*#__PURE__*/_jsx("td", {
100
+ className: "libro-search-input",
101
+ children: /*#__PURE__*/_jsx(Input, {
102
+ ref: findInputRef,
103
+ value: instance.findStr,
104
+ onChange: instance.handleFindChange,
105
+ size: "small",
106
+ placeholder: "\u641C\u7D22",
107
+ onFocus: function onFocus() {
108
+ instance.hasFocus = true;
109
+ },
110
+ onBlur: function onBlur() {
111
+ instance.hasFocus = false;
112
+ },
113
+ suffix: /*#__PURE__*/_jsxs("span", {
114
+ className: "libro-search-input-suffix",
115
+ children: [/*#__PURE__*/_jsx(IconFont, {
116
+ className: classnames({
117
+ 'libro-search-input-suffix-active': instance.caseSensitive
118
+ }),
119
+ onClick: instance.toggleCaseSensitive,
120
+ type: "icon-Aa",
121
+ title: "Match Case"
122
+ }), /*#__PURE__*/_jsx(IconFont, {
123
+ className: classnames({
124
+ 'libro-search-input-suffix-active': instance.useRegex
125
+ }),
126
+ onClick: instance.toggleUseRegex,
127
+ type: "icon-zhengzeshi",
128
+ title: "Use Regular Expression"
129
+ })]
130
+ })
131
+ })
132
+ }), /*#__PURE__*/_jsxs("td", {
133
+ className: "libro-search-action",
134
+ children: [/*#__PURE__*/_jsx(SearchIndexMemo, {}), /*#__PURE__*/_jsxs("div", {
135
+ children: [/*#__PURE__*/_jsx(Button, {
136
+ title: "Previous Match",
137
+ onClick: instance.previous,
138
+ icon: /*#__PURE__*/_jsx(ArrowUpOutlined, {}),
139
+ size: "small"
140
+ }), /*#__PURE__*/_jsx(Button, {
141
+ title: "Next Match",
142
+ onClick: instance.next,
143
+ icon: /*#__PURE__*/_jsx(ArrowDownOutlined, {}),
144
+ size: "small"
145
+ }), /*#__PURE__*/_jsx(Button, {
146
+ onClick: instance.toggleSetting,
147
+ icon: /*#__PURE__*/_jsx(EllipsisOutlined, {}),
148
+ size: "small"
149
+ }), /*#__PURE__*/_jsx(Button, {
150
+ onClick: function onClick() {
151
+ return instance.hide();
152
+ },
153
+ icon: /*#__PURE__*/_jsx(CloseOutlined, {}),
154
+ size: "small"
155
+ })]
156
+ })]
157
+ })]
158
+ }), instance.replaceVisible && /*#__PURE__*/_jsxs("tr", {
159
+ className: "libro-search-row",
160
+ children: [/*#__PURE__*/_jsx("td", {
161
+ className: "libro-search-input",
162
+ children: /*#__PURE__*/_jsx(Input, {
163
+ value: instance.replaceStr,
164
+ onChange: instance.handleReplaceChange,
165
+ size: "small",
166
+ placeholder: "\u66FF\u6362"
167
+ })
168
+ }), /*#__PURE__*/_jsx("td", {
169
+ className: "libro-search-action",
170
+ children: /*#__PURE__*/_jsxs("div", {
171
+ children: [/*#__PURE__*/_jsx(Button, {
172
+ onClick: instance.replace,
173
+ icon: /*#__PURE__*/_jsx(IconFont, {
174
+ type: "icon-zifuchuantihuan_2"
113
175
  }),
114
- onClick: instance.toggleCaseSensitive,
115
- type: "icon-Aa",
116
- title: "Match Case"
117
- }), /*#__PURE__*/_jsx(IconFont, {
118
- className: classnames({
119
- 'libro-search-input-suffix-active': instance.useRegex
176
+ size: "small",
177
+ title: "Replace"
178
+ }), /*#__PURE__*/_jsx(Button, {
179
+ onClick: instance.replaceAll,
180
+ icon: /*#__PURE__*/_jsx(IconFont, {
181
+ type: "icon-tihuantupian"
120
182
  }),
121
- onClick: instance.toggleUseRegex,
122
- type: "icon-zhengzeshi",
123
- title: "Use Regular Expression"
183
+ size: "small",
184
+ title: "Replace All"
124
185
  })]
125
186
  })
126
- })
127
- }), /*#__PURE__*/_jsxs("td", {
128
- className: "libro-search-action",
129
- children: [/*#__PURE__*/_jsx(SearchIndexMemo, {}), /*#__PURE__*/_jsxs("div", {
130
- children: [/*#__PURE__*/_jsx(Button, {
131
- title: "Previous Match",
132
- onClick: instance.previous,
133
- icon: /*#__PURE__*/_jsx(ArrowUpOutlined, {}),
134
- size: "small"
135
- }), /*#__PURE__*/_jsx(Button, {
136
- title: "Next Match",
137
- onClick: instance.next,
138
- icon: /*#__PURE__*/_jsx(ArrowDownOutlined, {}),
139
- size: "small"
140
- }), /*#__PURE__*/_jsx(Button, {
141
- onClick: instance.toggleSetting,
142
- icon: /*#__PURE__*/_jsx(EllipsisOutlined, {}),
143
- size: "small"
144
- }), /*#__PURE__*/_jsx(Button, {
145
- onClick: function onClick() {
146
- return instance.hide();
147
- },
148
- icon: /*#__PURE__*/_jsx(CloseOutlined, {}),
149
- size: "small"
150
- })]
151
187
  })]
152
- })]
153
- }), instance.replaceVisible && /*#__PURE__*/_jsxs("tr", {
154
- className: "libro-search-row",
155
- children: [/*#__PURE__*/_jsx("td", {
156
- className: "libro-search-input",
157
- children: /*#__PURE__*/_jsx(Input, {
158
- value: instance.replaceStr,
159
- onChange: instance.handleReplaceChange,
160
- size: "small",
161
- placeholder: "\u66FF\u6362"
162
- })
163
- }), /*#__PURE__*/_jsx("td", {
164
- className: "libro-search-action",
165
- children: /*#__PURE__*/_jsxs("div", {
166
- children: [/*#__PURE__*/_jsx(Button, {
167
- onClick: instance.replace,
168
- icon: /*#__PURE__*/_jsx(IconFont, {
169
- type: "icon-zifuchuantihuan_2"
170
- }),
171
- size: "small",
172
- title: "Replace"
173
- }), /*#__PURE__*/_jsx(Button, {
174
- onClick: instance.replaceAll,
175
- icon: /*#__PURE__*/_jsx(IconFont, {
176
- type: "icon-tihuantupian"
177
- }),
178
- size: "small",
179
- title: "Replace All"
180
- })]
181
- })
182
- })]
183
- }), instance.settingVisible && /*#__PURE__*/_jsxs("div", {
184
- className: "libro-search-row",
185
- children: [/*#__PURE__*/_jsx(Checkbox, {
186
- checked: (_instance$searchProvi = instance.searchProvider) === null || _instance$searchProvi === void 0 ? void 0 : _instance$searchProvi.searchCellOutput,
187
- onChange: instance.searchCellOutputChange,
188
- disabled: instance.replaceVisible,
189
- children: l10n.t('在 output 中查找')
190
- }), instance.replaceVisible && /*#__PURE__*/_jsx(Tag, {
191
- color: "warning",
192
- children: l10n.t('替换功能不能在 output 生效')
188
+ }), instance.settingVisible && /*#__PURE__*/_jsxs("div", {
189
+ className: "libro-search-row",
190
+ children: [/*#__PURE__*/_jsx(Checkbox, {
191
+ checked: (_instance$searchProvi = instance.searchProvider) === null || _instance$searchProvi === void 0 ? void 0 : _instance$searchProvi.searchCellOutput,
192
+ onChange: instance.searchCellOutputChange,
193
+ disabled: instance.replaceVisible,
194
+ children: l10n.t('在 output 中查找')
195
+ }), instance.replaceVisible && /*#__PURE__*/_jsx(Tag, {
196
+ color: "warning",
197
+ children: l10n.t('替换功能不能在 output 生效')
198
+ })]
193
199
  })]
194
200
  })]
195
- })]
201
+ })
196
202
  });
197
203
  };
198
204
  // TODO: 更改图标
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@difizen/libro-search",
3
- "version": "0.1.33",
3
+ "version": "0.1.35",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "libro",
@@ -36,9 +36,9 @@
36
36
  "@difizen/mana-app": "latest",
37
37
  "@difizen/mana-l10n": "latest",
38
38
  "@ant-design/icons": "^5.1.0",
39
- "@difizen/libro-common": "^0.1.33",
40
- "@difizen/libro-core": "^0.1.33",
41
- "@difizen/libro-code-editor": "^0.1.33",
39
+ "@difizen/libro-common": "^0.1.35",
40
+ "@difizen/libro-core": "^0.1.35",
41
+ "@difizen/libro-code-editor": "^0.1.35",
42
42
  "@types/lodash.debounce": "^4.0.7",
43
43
  "classnames": "^2.3.2",
44
44
  "lodash.debounce": "^4.0.8",
@@ -8,11 +8,11 @@ import {
8
8
  } from '@ant-design/icons';
9
9
  import type { LibroView } from '@difizen/libro-core';
10
10
  import { LibroContextKey } from '@difizen/libro-core';
11
- import { prop, useInject, useObserve, watch } from '@difizen/mana-app';
11
+ import { prop, ThemeService, useInject, useObserve, watch } from '@difizen/mana-app';
12
12
  import { BaseView, view, ViewInstance } from '@difizen/mana-app';
13
13
  import { inject, transient } from '@difizen/mana-app';
14
14
  import { l10n } from '@difizen/mana-l10n';
15
- import { Button, Checkbox, Input, Tag } from 'antd';
15
+ import { Button, Checkbox, ConfigProvider, Input, Tag, theme } from 'antd';
16
16
  import type { CheckboxChangeEvent } from 'antd/es/checkbox';
17
17
  import type { InputRef } from 'antd/es/input';
18
18
  import classnames from 'classnames';
@@ -63,6 +63,7 @@ export const SearchIndexMemo = memo(SearchIndex);
63
63
  export const SearchContent = () => {
64
64
  const instance = useInject<LibroSearchView>(ViewInstance);
65
65
  const findInputRef = useRef<InputRef>(null);
66
+ const themeService = useInject(ThemeService);
66
67
  useEffect(() => {
67
68
  if (findInputRef.current) {
68
69
  findInputRef.current.focus();
@@ -79,123 +80,132 @@ export const SearchContent = () => {
79
80
  }, [instance]);
80
81
 
81
82
  return (
82
- <div
83
- className="libro-search-content"
84
- style={{ height: `${instance.contentHeight}px` }}
83
+ <ConfigProvider
84
+ theme={{
85
+ algorithm:
86
+ themeService.getCurrentTheme().type === 'dark'
87
+ ? theme.darkAlgorithm
88
+ : theme.defaultAlgorithm,
89
+ }}
85
90
  >
86
- <ReplaceToggle />
87
- <table className="libro-search-input-area">
88
- <tr className="libro-search-row">
89
- <td className="libro-search-input">
90
- <Input
91
- ref={findInputRef}
92
- value={instance.findStr}
93
- onChange={instance.handleFindChange}
94
- size="small"
95
- placeholder="搜索"
96
- onFocus={() => {
97
- instance.hasFocus = true;
98
- }}
99
- onBlur={() => {
100
- instance.hasFocus = false;
101
- }}
102
- suffix={
103
- <span className="libro-search-input-suffix">
104
- <IconFont
105
- className={classnames({
106
- 'libro-search-input-suffix-active': instance.caseSensitive,
107
- })}
108
- onClick={instance.toggleCaseSensitive}
109
- type="icon-Aa"
110
- title="Match Case"
111
- />
112
-
113
- <IconFont
114
- className={classnames({
115
- 'libro-search-input-suffix-active': instance.useRegex,
116
- })}
117
- onClick={instance.toggleUseRegex}
118
- type="icon-zhengzeshi"
119
- title="Use Regular Expression"
120
- />
121
- </span>
122
- }
123
- />
124
- </td>
125
- <td className="libro-search-action">
126
- <SearchIndexMemo />
127
- <div>
128
- <Button
129
- title="Previous Match"
130
- onClick={instance.previous}
131
- icon={<ArrowUpOutlined />}
132
- size="small"
133
- />
134
- <Button
135
- title="Next Match"
136
- onClick={instance.next}
137
- icon={<ArrowDownOutlined />}
138
- size="small"
139
- />
140
- <Button
141
- onClick={instance.toggleSetting}
142
- icon={<EllipsisOutlined />}
143
- size="small"
144
- />
145
- <Button
146
- onClick={() => instance.hide()}
147
- icon={<CloseOutlined />}
148
- size="small"
149
- />
150
- </div>
151
- </td>
152
- </tr>
153
- {instance.replaceVisible && (
91
+ <div
92
+ className="libro-search-content"
93
+ style={{ height: `${instance.contentHeight}px` }}
94
+ >
95
+ <ReplaceToggle />
96
+ <table className="libro-search-input-area">
154
97
  <tr className="libro-search-row">
155
98
  <td className="libro-search-input">
156
99
  <Input
157
- value={instance.replaceStr}
158
- onChange={instance.handleReplaceChange}
100
+ ref={findInputRef}
101
+ value={instance.findStr}
102
+ onChange={instance.handleFindChange}
159
103
  size="small"
160
- placeholder="替换"
104
+ placeholder="搜索"
105
+ onFocus={() => {
106
+ instance.hasFocus = true;
107
+ }}
108
+ onBlur={() => {
109
+ instance.hasFocus = false;
110
+ }}
111
+ suffix={
112
+ <span className="libro-search-input-suffix">
113
+ <IconFont
114
+ className={classnames({
115
+ 'libro-search-input-suffix-active': instance.caseSensitive,
116
+ })}
117
+ onClick={instance.toggleCaseSensitive}
118
+ type="icon-Aa"
119
+ title="Match Case"
120
+ />
121
+
122
+ <IconFont
123
+ className={classnames({
124
+ 'libro-search-input-suffix-active': instance.useRegex,
125
+ })}
126
+ onClick={instance.toggleUseRegex}
127
+ type="icon-zhengzeshi"
128
+ title="Use Regular Expression"
129
+ />
130
+ </span>
131
+ }
161
132
  />
162
133
  </td>
163
134
  <td className="libro-search-action">
135
+ <SearchIndexMemo />
164
136
  <div>
165
137
  <Button
166
- onClick={instance.replace}
167
- icon={<IconFont type="icon-zifuchuantihuan_2" />}
138
+ title="Previous Match"
139
+ onClick={instance.previous}
140
+ icon={<ArrowUpOutlined />}
141
+ size="small"
142
+ />
143
+ <Button
144
+ title="Next Match"
145
+ onClick={instance.next}
146
+ icon={<ArrowDownOutlined />}
147
+ size="small"
148
+ />
149
+ <Button
150
+ onClick={instance.toggleSetting}
151
+ icon={<EllipsisOutlined />}
168
152
  size="small"
169
- title="Replace"
170
153
  />
171
-
172
154
  <Button
173
- onClick={instance.replaceAll}
174
- icon={<IconFont type="icon-tihuantupian" />}
155
+ onClick={() => instance.hide()}
156
+ icon={<CloseOutlined />}
175
157
  size="small"
176
- title="Replace All"
177
158
  />
178
159
  </div>
179
160
  </td>
180
161
  </tr>
181
- )}
182
-
183
- {instance.settingVisible && (
184
- <div className="libro-search-row">
185
- <Checkbox
186
- checked={instance.searchProvider?.searchCellOutput}
187
- onChange={instance.searchCellOutputChange}
188
- disabled={instance.replaceVisible}
189
- >
190
- {l10n.t('在 output 中查找')}
191
- </Checkbox>
192
- {instance.replaceVisible && (
193
- <Tag color="warning">{l10n.t('替换功能不能在 output 生效')}</Tag>
194
- )}
195
- </div>
196
- )}
197
- </table>
198
- </div>
162
+ {instance.replaceVisible && (
163
+ <tr className="libro-search-row">
164
+ <td className="libro-search-input">
165
+ <Input
166
+ value={instance.replaceStr}
167
+ onChange={instance.handleReplaceChange}
168
+ size="small"
169
+ placeholder="替换"
170
+ />
171
+ </td>
172
+ <td className="libro-search-action">
173
+ <div>
174
+ <Button
175
+ onClick={instance.replace}
176
+ icon={<IconFont type="icon-zifuchuantihuan_2" />}
177
+ size="small"
178
+ title="Replace"
179
+ />
180
+
181
+ <Button
182
+ onClick={instance.replaceAll}
183
+ icon={<IconFont type="icon-tihuantupian" />}
184
+ size="small"
185
+ title="Replace All"
186
+ />
187
+ </div>
188
+ </td>
189
+ </tr>
190
+ )}
191
+
192
+ {instance.settingVisible && (
193
+ <div className="libro-search-row">
194
+ <Checkbox
195
+ checked={instance.searchProvider?.searchCellOutput}
196
+ onChange={instance.searchCellOutputChange}
197
+ disabled={instance.replaceVisible}
198
+ >
199
+ {l10n.t('在 output 中查找')}
200
+ </Checkbox>
201
+ {instance.replaceVisible && (
202
+ <Tag color="warning">{l10n.t('替换功能不能在 output 生效')}</Tag>
203
+ )}
204
+ </div>
205
+ )}
206
+ </table>
207
+ </div>
208
+ </ConfigProvider>
199
209
  );
200
210
  };
201
211
  // TODO: 更改图标