@antv/dumi-theme-antv 0.3.8 → 0.3.10

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,53 +0,0 @@
1
- var __create = Object.create;
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
- var __hasOwnProp = Object.prototype.hasOwnProperty;
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
- // If the importer is in node compatibility mode or this is not an ESM
21
- // file that has been converted to a CommonJS file using a Babel-
22
- // compatible transform (i.e. "__esModule" has not been set), then set
23
- // "default" to the CommonJS "module.exports" for node compatibility.
24
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
- mod
26
- ));
27
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
-
29
- // src/plugin/utils.ts
30
- var utils_exports = {};
31
- __export(utils_exports, {
32
- myResolve: () => myResolve
33
- });
34
- module.exports = __toCommonJS(utils_exports);
35
- var path = __toESM(require("path"));
36
- function myResolve(p, alternateExts = [".js"]) {
37
- const extname2 = path.extname(p);
38
- const pathname = p.slice(0, p.length - extname2.length);
39
- const exts = [extname2, ...alternateExts];
40
- for (let i = 0; i < exts.length; i++) {
41
- const ext = exts[i];
42
- const fullpath = `${pathname}${ext}`;
43
- try {
44
- return require.resolve(fullpath);
45
- } catch (e) {
46
- }
47
- }
48
- return "";
49
- }
50
- // Annotate the CommonJS export names for ESM import in node:
51
- 0 && (module.exports = {
52
- myResolve
53
- });
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import '@docsearch/css';
3
- import 'docsearch.js/dist/cdn/docsearch.min.css';
4
- export interface SearchProps {
5
- docsearchOptions?: {
6
- versionV3?: boolean;
7
- appId?: string;
8
- apiKey: string;
9
- indexName: string;
10
- };
11
- }
12
- export declare const Search: React.FC<SearchProps>;
@@ -1,87 +0,0 @@
1
- import React, { useEffect } from 'react';
2
- import { SearchOutlined } from '@ant-design/icons';
3
- import { DocSearch } from '@docsearch/react';
4
- import { useLocale, useIntl } from 'dumi';
5
- import '@docsearch/css';
6
- import styles from "./Search.module.less";
7
- import 'docsearch.js/dist/cdn/docsearch.min.css';
8
- function initDocSearchV2(_ref) {
9
- var docsearchV2 = _ref.docsearchV2,
10
- lang = _ref.lang,
11
- docsearchOptions = _ref.docsearchOptions;
12
- var _ref2 = docsearchOptions || {},
13
- _ref2$apiKey = _ref2.apiKey,
14
- apiKey = _ref2$apiKey === void 0 ? '194b1be7fb1254c787f4e036912af3eb' : _ref2$apiKey,
15
- _ref2$indexName = _ref2.indexName,
16
- indexName = _ref2$indexName === void 0 ? 'antv' : _ref2$indexName;
17
- docsearchV2({
18
- apiKey: apiKey,
19
- indexName: indexName,
20
- inputSelector: ".".concat(styles.input),
21
- algoliaOptions: {
22
- facetFilters: ["tags:".concat(lang)]
23
- },
24
- transformData: function transformData(hits) {
25
- hits.forEach(function (hit) {
26
- /* eslint-disable no-param-reassign */
27
- hit.url = hit.url.replace('g2.antv.vision', window.location.host);
28
- hit.url = hit.url.replace('g6.antv.vision', window.location.host);
29
- hit.url = hit.url.replace('f2.antv.vision', window.location.host);
30
- hit.url = hit.url.replace('l7.antv.vision', window.location.host);
31
- hit.url = hit.url.replace('x6.antv.vision', window.location.host);
32
- hit.url = hit.url.replace('g2plot.antv.vision', window.location.host);
33
- hit.url = hit.url.replace('graphin.antv.vision', window.location.host);
34
- hit.url = hit.url.replace('https:', window.location.protocol);
35
- hit.url = hit.url.replace('#gatsby-focus-wrapper', '');
36
- /* eslint-enable no-param-reassign */
37
- });
38
-
39
- return hits;
40
- },
41
- debug: false // Set debug to true if you want to inspect the dropdown
42
- });
43
- }
44
-
45
- export var Search = function Search(_ref3) {
46
- var docsearchOptions = _ref3.docsearchOptions;
47
- var locale = useLocale();
48
- var intl = useIntl();
49
- var _ref4 = docsearchOptions || {},
50
- _ref4$apiKey = _ref4.apiKey,
51
- apiKey = _ref4$apiKey === void 0 ? '' : _ref4$apiKey,
52
- _ref4$indexName = _ref4.indexName,
53
- indexName = _ref4$indexName === void 0 ? '' : _ref4$indexName,
54
- _ref4$versionV = _ref4.versionV3,
55
- versionV3 = _ref4$versionV === void 0 ? false : _ref4$versionV,
56
- _ref4$appId = _ref4.appId,
57
- appId = _ref4$appId === void 0 ? '' : _ref4$appId;
58
- useEffect(function () {
59
- if (typeof window !== 'undefined' && !versionV3) {
60
- import('docsearch.js').then(function (_ref5) {
61
- var docsearchV2 = _ref5.default;
62
- initDocSearchV2({
63
- docsearchV2: docsearchV2,
64
- lang: locale.id,
65
- docsearchOptions: docsearchOptions
66
- });
67
- });
68
- }
69
- }, []);
70
- return /*#__PURE__*/React.createElement("label", {
71
- className: styles.search,
72
- htmlFor: "search",
73
- id: "search"
74
- }, versionV3 ? /*#__PURE__*/React.createElement(DocSearch, {
75
- appId: appId,
76
- indexName: indexName,
77
- apiKey: apiKey
78
- }) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchOutlined, {
79
- className: styles.icon
80
- }), /*#__PURE__*/React.createElement("input", {
81
- className: styles.input,
82
- id: "search",
83
- placeholder: intl.formatMessage({
84
- id: '搜索…'
85
- })
86
- })));
87
- };