cdui-js 1.0.27 → 1.0.29
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/build/icons.ts +1 -1
- package/build/load-svg-icons.ts +22 -0
- package/demo/icons/build.ts +1 -0
- package/demo/index.html +2 -2
- package/package.json +2 -1
- package/src/components/Icon.tsx +0 -23
- package/src/reactive.ts +5 -19
package/build/icons.ts
CHANGED
|
@@ -106,7 +106,7 @@ export const saveIconsToHtml = (htmlFile: string, symbols: string) => {
|
|
|
106
106
|
export const saveIconsModule = (moduleFile: string, symbols: string) => {
|
|
107
107
|
fs.writeFileSync(
|
|
108
108
|
moduleFile,
|
|
109
|
-
`import
|
|
109
|
+
`import loadSvgIcons from 'cdui-js/build/load-svg-icons';
|
|
110
110
|
|
|
111
111
|
loadSvgIcons(\`${symbols}\`);
|
|
112
112
|
`,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 加载 svg 图标集
|
|
3
|
+
*
|
|
4
|
+
* @param svgSymbols svg symbol 内容(由 icons 构建工具生成)
|
|
5
|
+
*/
|
|
6
|
+
export default function loadSvgIcons(svgSymbols) {
|
|
7
|
+
var body = document.body;
|
|
8
|
+
var svg = document.getElementById('ICONS');
|
|
9
|
+
|
|
10
|
+
if (svg) {
|
|
11
|
+
svg.insertAdjacentHTML('beforeend', svgSymbols);
|
|
12
|
+
} else {
|
|
13
|
+
svg = document.createElement('svg');
|
|
14
|
+
svg.id = 'ICONS';
|
|
15
|
+
svg.ariaHidden = 'true';
|
|
16
|
+
svg.style.cssText = 'position:absolute;width:0px;height:0px;overflow:hidden;';
|
|
17
|
+
svg.innerHTML = svgSymbols;
|
|
18
|
+
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
19
|
+
|
|
20
|
+
body.insertBefore(svg, body.firstChild);
|
|
21
|
+
}
|
|
22
|
+
}
|
package/demo/icons/build.ts
CHANGED
package/demo/index.html
CHANGED
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
<symbol id="icon-backward" viewBox="0 0 16 16" fill="none">
|
|
21
21
|
<path d="M10.3661 2.72003L6.01942 7.0667C5.50609 7.58003 5.50609 8.42003 6.01942 8.93336L10.3661 13.28" stroke="#1B212D" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
|
22
22
|
</symbol>
|
|
23
|
-
<symbol id="icon-close" viewBox="0 0
|
|
24
|
-
<path d="
|
|
23
|
+
<symbol id="icon-close" viewBox="0 0 24 24" fill="none">
|
|
24
|
+
<path d="M6.16709 17.8331L17.8333 6.16689M17.8333 17.8331L6.16709 6.16689" stroke="#262626" stroke-linecap="round" stroke-linejoin="round"/>
|
|
25
25
|
</symbol>
|
|
26
26
|
<symbol id="icon-dropdown" viewBox="0 0 16 16" fill="none">
|
|
27
27
|
<path d="M2.72 5.63428L7.06667 9.98094C7.58 10.4943 8.42 10.4943 8.93333 9.98094L13.28 5.63428" stroke="#1B212D" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cdui-js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"bin": {
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"dev": "vite --config demo/vite.config.ts",
|
|
11
|
+
"build": "vite build --config demo/vite.config.ts",
|
|
11
12
|
"icons": "npx tsx demo/icons/build.ts",
|
|
12
13
|
"css": "npx tsx demo/css/build.ts"
|
|
13
14
|
},
|
package/src/components/Icon.tsx
CHANGED
|
@@ -13,26 +13,3 @@ export const Icon = (props?: JSX.SvgSVGAttributes<never> & { name: string }) =>
|
|
|
13
13
|
</svg>
|
|
14
14
|
);
|
|
15
15
|
};
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* 加载 svg 图标集
|
|
19
|
-
*
|
|
20
|
-
* @param svgSymbols svg symbol 内容(由 icons 构建工具生成)
|
|
21
|
-
*/
|
|
22
|
-
export const loadSvgIcons = (svgSymbols: string) => {
|
|
23
|
-
let body = document.body;
|
|
24
|
-
let svg = document.getElementById('ICONS');
|
|
25
|
-
|
|
26
|
-
if (svg) {
|
|
27
|
-
svg.insertAdjacentHTML('beforeend', svgSymbols);
|
|
28
|
-
} else {
|
|
29
|
-
svg = document.createElement('svg');
|
|
30
|
-
svg.id = 'ICONS';
|
|
31
|
-
svg.ariaHidden = 'true';
|
|
32
|
-
svg.style.cssText = 'position:absolute;width:0px;height:0px;overflow:hidden;';
|
|
33
|
-
svg.innerHTML = svgSymbols;
|
|
34
|
-
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
35
|
-
|
|
36
|
-
body.insertBefore(svg, body.firstChild);
|
|
37
|
-
}
|
|
38
|
-
};
|
package/src/reactive.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
1
|
+
import { createEffect, createSignal, createUniqueId, splitProps } from 'solid-js';
|
|
4
2
|
|
|
5
3
|
export const defineProperty = Object.defineProperty;
|
|
6
4
|
export const defineProperties = Object.defineProperties;
|
|
@@ -9,18 +7,19 @@ export const isArray = Array.isArray;
|
|
|
9
7
|
|
|
10
8
|
export {
|
|
11
9
|
type JSX,
|
|
10
|
+
batch,
|
|
12
11
|
children,
|
|
13
12
|
createComponent,
|
|
14
13
|
createEffect,
|
|
15
14
|
createMemo,
|
|
16
15
|
createContext,
|
|
17
16
|
createSignal,
|
|
18
|
-
|
|
19
|
-
splitProps,
|
|
17
|
+
lazy,
|
|
20
18
|
onMount,
|
|
21
19
|
onCleanup,
|
|
20
|
+
splitProps,
|
|
22
21
|
untrack,
|
|
23
|
-
|
|
22
|
+
useContext,
|
|
24
23
|
} from 'solid-js';
|
|
25
24
|
|
|
26
25
|
export { hydrate, render } from 'solid-js/web';
|
|
@@ -495,16 +494,3 @@ export const createFetcher = <T>(asyncLoad: () => Promise<T>, ssr_cache?: string
|
|
|
495
494
|
},
|
|
496
495
|
) as unknown as FetcherResult<T>;
|
|
497
496
|
};
|
|
498
|
-
|
|
499
|
-
/**
|
|
500
|
-
* 延迟加载组件
|
|
501
|
-
*
|
|
502
|
-
* @param importFn 按需导入的组件 import('...')
|
|
503
|
-
*/
|
|
504
|
-
export const LazyComponent = (
|
|
505
|
-
importFn: () => Promise<{
|
|
506
|
-
default: Component<any>;
|
|
507
|
-
}>,
|
|
508
|
-
) => {
|
|
509
|
-
return lazy(importFn);
|
|
510
|
-
};
|