ranui 0.1.0-alpha → 0.1.1-alpha

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 (46) hide show
  1. package/package.json +1 -1
  2. package/.vitepress/theme/index.ts +0 -9
  3. package/assets/image/failImage.ts +0 -4
  4. package/assets/svgs/check-circle.svg +0 -4
  5. package/assets/svgs/close-circle.svg +0 -4
  6. package/assets/svgs/eye-close.svg +0 -4
  7. package/assets/svgs/eye.svg +0 -4
  8. package/assets/svgs/info-circle.svg +0 -5
  9. package/assets/svgs/lock.svg +0 -4
  10. package/assets/svgs/unlock.svg +0 -4
  11. package/assets/svgs/user.svg +0 -3
  12. package/components/button/index.less +0 -95
  13. package/components/button/index.ts +0 -64
  14. package/components/form/index.less +0 -0
  15. package/components/form/index.ts +0 -36
  16. package/components/image/index.less +0 -0
  17. package/components/image/index.ts +0 -62
  18. package/components/input/index.less +0 -114
  19. package/components/input/index.ts +0 -367
  20. package/components/modal/index.less +0 -0
  21. package/components/modal/index.ts +0 -118
  22. package/components/tabPane/index.less +0 -0
  23. package/components/tabPane/index.ts +0 -71
  24. package/components/tabs/index.less +0 -47
  25. package/components/tabs/index.ts +0 -207
  26. package/dist/assets/image/failImage.d.ts +0 -2
  27. package/dist/components/button/index.d.ts +0 -2
  28. package/dist/components/image/index.d.ts +0 -2
  29. package/dist/components/input/index.d.ts +0 -2
  30. package/dist/components/modal/index.d.ts +0 -2
  31. package/dist/components/tabPane/index.d.ts +0 -2
  32. package/dist/components/tabs/index.d.ts +0 -2
  33. package/dist/typings.d.ts +0 -4
  34. package/dist/utils/index.d.ts +0 -7
  35. package/docs/button/index.md +0 -25
  36. package/docs/image/index.md +0 -9
  37. package/docs/input/index.md +0 -146
  38. package/docs/tabs/index.md +0 -121
  39. package/index.html +0 -67
  40. package/index.ts +0 -6
  41. package/plugins/auto-import-file.ts +0 -59
  42. package/plugins/load-style.ts +0 -31
  43. package/tsconfig.json +0 -31
  44. package/typings.d.ts +0 -4
  45. package/utils/index.ts +0 -12
  46. package/vite.config.ts +0 -58
@@ -1,59 +0,0 @@
1
- import { Plugin } from 'vite';
2
- import fs from "fs";
3
- import ranuts from 'ranuts';
4
- const { writeFile, readFile, queryFileInfo } = ranuts;
5
-
6
- interface Options {
7
- ignore?: Array<string>,
8
- path: Array<string>,
9
- extensions: Array<string>
10
- }
11
-
12
- const createIndex = async (options: Options, entry: string) => {
13
- let content = ''
14
- const { path = [], extensions = [], ignore = [] } = options
15
- /**
16
- * @description: 递归查找目录
17
- * @param {Array} path
18
- */
19
- const recurveFile = async (path: Array<string>) => {
20
- for (const item of path) {
21
- const { status, data } = await queryFileInfo(item)
22
- const extension = item.substring(item.lastIndexOf('.'))
23
- if (status && data.isFile() && extensions.includes(extension) && !ignore.includes(item)) {
24
- content += `import '${item}';\n`
25
- }
26
- if (status && data.isDirectory() && !ignore.includes(item)) {
27
- const fileList = fs.readdirSync(item)
28
- const list = fileList.map(children => `${item}/${children}`)
29
- await recurveFile(list)
30
- }
31
- }
32
- }
33
- try {
34
- await recurveFile(path)
35
- const currContent = await readFile(entry)
36
- if (currContent.status && currContent.data !== content) return await writeFile(entry, content)
37
- return { status: false }
38
- } catch (error) {
39
- throw error
40
- }
41
-
42
- }
43
- // 当初始目录中没有index的时候,不会主动生成,需要至少增加一个空index.js
44
- export default function autoImportFilePlugin(options: Options): Plugin {
45
- return {
46
- name: 'vite-plugin-auto-import-file',
47
- enforce: 'pre',
48
- async config(context) {
49
- const { entry = '' } = context.build?.lib || {};
50
- // const { alias = {} } = context.resolve || {}
51
- // const aliasList = Object.keys(alias)
52
- if (entry) await createIndex(options, entry)
53
- },
54
- async handleHotUpdate(context) {
55
- const { entry = '' } = context.server.config.build.lib || {}
56
- if (entry) await createIndex(options, entry)
57
- }
58
- }
59
- }
@@ -1,31 +0,0 @@
1
- import { Plugin } from 'vite';
2
- interface Options {
3
- ignore?: Array<string>
4
- }
5
-
6
- export default function loadStylePlugin(options?: Options): Plugin {
7
- return {
8
- name: 'vite-plugin-load-style',
9
- transform(code, id) {
10
- const path = new RegExp('ranui\/components\/[a-zA-z0-9]+\/index\.ts')
11
- const stylePath = new RegExp(/((this\.)?[a-zA-Z0-9]+)\s*=\s*this\.attachShadow\(\{.*\}\)/)
12
- const front = `import f7170ee498e0dd32cbdcb63fba8f75cc from './index.less';`
13
- const { ignore = [] } = options ?? {}
14
- const [fragment, statement] = code.match(stylePath) ?? []
15
- let result = code
16
- if (path.test(id) && !ignore.some(item => new RegExp(item).test(id)) && fragment && statement) {
17
- result = result.replace(
18
- stylePath,
19
- `${fragment};
20
- const F7170EE498E0DD32CBDCB63FBA8F75CC = document.createElement('style');
21
- F7170EE498E0DD32CBDCB63FBA8F75CC.textContent = f7170ee498e0dd32cbdcb63fba8f75cc;
22
- ${statement}.appendChild(F7170EE498E0DD32CBDCB63FBA8F75CC);`)
23
- result = front + result;
24
- }
25
- return {
26
- code: result,
27
- map: null // TODO
28
- };
29
- }
30
- }
31
- }
package/tsconfig.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "jsx": "react",
4
- "module": "ESNext",
5
- "esModuleInterop": true,
6
- "target": "ESNext",
7
- "moduleResolution": "node",
8
- "outDir": "dist",
9
- "forceConsistentCasingInFileNames": true,
10
- "noFallthroughCasesInSwitch": true,
11
- "isolatedModules": false,
12
- "strict": true,
13
- "noImplicitAny": true,
14
- "useUnknownInCatchVariables": false,
15
- "inlineSourceMap": true,
16
- "baseUrl": ".",
17
- "experimentalDecorators":true,
18
- "paths": {
19
- "@/assets/*": ["assets/*"],
20
- "@/components/*": ["components/*"],
21
- "@/plugins/*": ["plugins/*"],
22
- "@/utils/*": ["utils/*"],
23
- },
24
- },
25
- "ts-node": {
26
- "esm": true,
27
- "experimentalSpecifierResolution":"node",
28
- },
29
- "include": ["**/*.ts", "**/*.tsx"],
30
- "exclude": ["node_modules"]
31
- }
package/typings.d.ts DELETED
@@ -1,4 +0,0 @@
1
- declare module "*.less"
2
- declare module '@/assets'
3
- declare module '@/components'
4
- declare module '@/plugins'
package/utils/index.ts DELETED
@@ -1,12 +0,0 @@
1
- export const falseList = [false, "false", null, undefined];
2
- /**
3
- * @description: 判断这个元素上是否有disabled属性
4
- * @param {Element} element
5
- * @return {*}
6
- */
7
- export const isDisabled = (element: Element) => {
8
- const status = element.hasAttribute('disabled')
9
- const value = element.getAttribute('disabled')
10
- if (status && !falseList.includes(value)) return true
11
- return false
12
- }
package/vite.config.ts DELETED
@@ -1,58 +0,0 @@
1
- import { defineConfig } from "vite";
2
- import path, { resolve } from "path";
3
- import { fileURLToPath } from "url";
4
- import dts from 'vite-plugin-dts'
5
- import loadStyle from './plugins/load-style'
6
- import autoImportFile from './plugins/auto-import-file'
7
-
8
- // const __filename = fileURLToPath(import.meta.url);
9
-
10
- // const __dirname = path.dirname(__filename);
11
-
12
- export default defineConfig({
13
- build: {
14
- minify: 'terser',
15
- sourcemap: true,
16
- lib: {
17
- entry: resolve(__dirname, "index.ts"),
18
- name: "ranui",
19
- fileName: "index",
20
- formats: ["es", "umd"],
21
- },
22
- },
23
- plugins: [
24
- dts({
25
- tsConfigFilePath: './tsconfig.json'
26
- }),
27
- loadStyle({
28
- ignore: ['ranui/components/modal/index.ts']
29
- }),
30
- autoImportFile({
31
- path: [
32
- './components',
33
- // resolve(__dirname, "components/")
34
- ],
35
- extensions: [".ts"],
36
- ignore: ['./components/form/index.ts']
37
- })
38
- ],
39
- resolve: {
40
- alias: {
41
- '@/components': resolve(__dirname, "components/"),
42
- '@/assets': resolve(__dirname, "assets/"),
43
- '@/utils': resolve(__dirname, "utils/"),
44
- },
45
- extensions: [".mjs", ".js", ".ts", ".jsx", ".tsx", ".json"],
46
- },
47
- css: {
48
- // preprocessorOptions: {
49
- // less: {
50
- // javascriptEnabled: true,
51
- // additionalData: `@import "client/assets/base.css";`
52
- // }
53
- // },
54
- modules: {
55
- generateScopedName: "[name--[local]--[hash:base64:5]]",
56
- },
57
- },
58
- });