create-packer 1.38.0 → 1.39.0

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 (126) hide show
  1. package/package.json +4 -5
  2. package/template/cli/package.json +0 -1
  3. package/template/docusaurus/package.json +1 -1
  4. package/template/{web-app/react-vite/.eslintignore → lib/workspace/.stylelintignore} +2 -0
  5. package/template/lib/workspace/.stylelintrc +4 -9
  6. package/template/lib/workspace/eslint.config.mjs +116 -0
  7. package/template/lib/workspace/package.json +81 -73
  8. package/template/lib/workspace/packages/react/package.json +41 -41
  9. package/template/lib/workspace/packages/react/tsconfig.json +3 -8
  10. package/template/lib/workspace/packages/react/tsconfig.lint.json +21 -0
  11. package/template/lib/workspace/packages/ts/package.json +29 -29
  12. package/template/lib/workspace/packages/ts/tsconfig.json +9 -6
  13. package/template/lib/workspace/packages/ts/tsconfig.lint.json +21 -0
  14. package/template/nest/package.json +82 -84
  15. package/template/web-app/react-rsbuild/domain/app/components/app-context.tsx +17 -17
  16. package/template/web-app/react-rsbuild/domain/router/components/index.ts +2 -0
  17. package/template/web-app/react-rsbuild/domain/router/components/route-layout.tsx +19 -0
  18. package/template/web-app/react-rsbuild/domain/router/components/sub-route-outlet.tsx +22 -0
  19. package/template/web-app/react-rsbuild/domain/router/index.ts +4 -3
  20. package/template/web-app/react-rsbuild/eslint.config.js +104 -0
  21. package/template/web-app/react-rsbuild/package.json +78 -79
  22. package/template/web-app/react-rsbuild/pages/home/index.ts +1 -1
  23. package/template/web-app/react-rsbuild/pages/home/{home.styled.ts → view.styled.ts} +7 -7
  24. package/template/web-app/react-rsbuild/pages/home/{home.tsx → view.tsx} +10 -10
  25. package/template/web-app/{react-vite/shared/tools → react-rsbuild/shared/components}/componentInstance.tsx +80 -80
  26. package/template/web-app/react-rsbuild/shared/components/index.ts +1 -0
  27. package/template/web-app/react-rsbuild/shared/service/home.ts +8 -8
  28. package/template/web-app/react-rsbuild/shared/theme/theme.styled.ts +56 -56
  29. package/template/web-app/react-rsbuild/shared/tools/index.ts +0 -1
  30. package/template/web-app/react-vite/domain/router/components/index.ts +2 -0
  31. package/template/web-app/react-vite/domain/router/components/route-layout.tsx +19 -0
  32. package/template/web-app/react-vite/domain/router/components/sub-route-outlet.tsx +22 -0
  33. package/template/web-app/react-vite/domain/router/index.ts +4 -3
  34. package/template/web-app/react-vite/eslint.config.js +104 -0
  35. package/template/web-app/react-vite/package.json +79 -79
  36. package/template/web-app/react-vite/pages/home/index.ts +1 -1
  37. package/template/web-app/react-vite/pages/home/{home.mock.ts → view.mock.ts} +19 -19
  38. package/template/web-app/{react-webpack/pages/home/home.styled.ts → react-vite/pages/home/view.styled.ts} +7 -7
  39. package/template/web-app/react-vite/pages/home/{home.tsx → view.tsx} +10 -10
  40. package/template/web-app/{react-rsbuild/shared/tools → react-vite/shared/components}/componentInstance.tsx +80 -80
  41. package/template/web-app/react-vite/shared/components/index.ts +1 -0
  42. package/template/web-app/react-vite/shared/service/home.ts +10 -10
  43. package/template/web-app/react-vite/shared/theme/theme.styled.ts +55 -56
  44. package/template/web-app/react-vite/shared/tools/index.ts +0 -1
  45. package/template/web-app/react-vite/vite.config.ts +80 -76
  46. package/template/web-app/react-webpack/domain/router/components/index.ts +2 -0
  47. package/template/web-app/react-webpack/domain/router/components/route-layout.tsx +19 -0
  48. package/template/web-app/react-webpack/domain/router/components/sub-route-outlet.tsx +22 -0
  49. package/template/web-app/react-webpack/domain/router/index.ts +4 -3
  50. package/template/web-app/react-webpack/eslint.config.js +104 -0
  51. package/template/web-app/react-webpack/package.json +84 -87
  52. package/template/web-app/react-webpack/pages/home/index.ts +1 -1
  53. package/template/web-app/{react-vite/pages/home/home.styled.ts → react-webpack/pages/home/view.styled.ts} +7 -7
  54. package/template/web-app/react-webpack/pages/home/{home.tsx → view.tsx} +10 -10
  55. package/template/web-app/react-webpack/shared/{tools → components}/componentInstance.tsx +78 -78
  56. package/template/web-app/react-webpack/shared/components/index.ts +1 -0
  57. package/template/web-app/react-webpack/shared/theme/theme.styled.ts +56 -56
  58. package/template/web-app/react-webpack/shared/tools/index.ts +0 -1
  59. package/template/web-app/solid/package.json +53 -51
  60. package/template/web-app/solid/src/pages/home/index.ts +1 -1
  61. package/template/web-app/solid/src/pages/home/{home.container.tsx → view.tsx} +5 -5
  62. package/template/web-app/solid/src/pages/notFound/index.ts +1 -1
  63. package/template/web-app/solid/src/pages/notFound/{notFound.container.tsx → view.tsx} +3 -3
  64. package/template/web-app/svelte/.prettierrc +21 -14
  65. package/template/web-app/svelte/.svelte-kit/ambient.d.ts +181 -177
  66. package/template/web-app/svelte/.svelte-kit/generated/client/app.js +28 -23
  67. package/template/web-app/svelte/.svelte-kit/generated/client/matchers.js +1 -1
  68. package/template/web-app/svelte/.svelte-kit/generated/client/nodes/0.js +1 -1
  69. package/template/web-app/svelte/.svelte-kit/generated/client/nodes/1.js +1 -1
  70. package/template/web-app/svelte/.svelte-kit/generated/client/nodes/2.js +1 -1
  71. package/template/web-app/svelte/.svelte-kit/generated/root.js +3 -0
  72. package/template/web-app/svelte/.svelte-kit/generated/root.svelte +66 -62
  73. package/template/web-app/svelte/.svelte-kit/generated/server/internal.js +49 -61
  74. package/template/web-app/svelte/.svelte-kit/non-ambient.d.ts +25 -23
  75. package/template/web-app/svelte/.svelte-kit/tsconfig.json +49 -32
  76. package/template/web-app/svelte/.svelte-kit/types/route_meta_data.json +3 -3
  77. package/template/web-app/svelte/.svelte-kit/types/src/routes/$types.d.ts +22 -35
  78. package/template/web-app/svelte/eslint.config.js +95 -0
  79. package/template/web-app/svelte/package.json +55 -55
  80. package/template/web-app/svelte/src/app.d.ts +13 -12
  81. package/template/web-app/svelte/src/app.html +2 -2
  82. package/template/web-app/svelte/src/lib/index.ts +1 -0
  83. package/template/web-app/svelte/src/routes/+page.svelte +2 -2
  84. package/template/web-app/svelte/vite.config.ts +59 -55
  85. package/template/web-app/vue/eslint.config.js +109 -0
  86. package/template/web-app/vue/package.json +70 -70
  87. package/template/web-app/vue/pages/home/index.ts +1 -1
  88. package/template/web-app/vue/pages/home/{home.mock.ts → view.mock.ts} +19 -19
  89. package/template/web-app/vue/pages/home/{home.vue → view.vue} +16 -16
  90. package/template/web-app/vue/vite.config.ts +69 -65
  91. package/template/web-extension/.wxt/eslint-auto-imports.mjs +28 -0
  92. package/template/web-extension/.wxt/tsconfig.json +28 -25
  93. package/template/web-extension/.wxt/types/globals.d.ts +15 -15
  94. package/template/web-extension/.wxt/types/i18n.d.ts +81 -87
  95. package/template/web-extension/.wxt/types/imports.d.ts +22 -21
  96. package/template/web-extension/.wxt/types/paths.d.ts +16 -15
  97. package/template/web-extension/.wxt/wxt.d.ts +7 -6
  98. package/template/web-extension/entrypoints/content/domain/app/tools/insertApp.tsx +58 -59
  99. package/template/web-extension/entrypoints/content/index.tsx +10 -12
  100. package/template/web-extension/entrypoints/popup/main.tsx +14 -14
  101. package/template/web-extension/entrypoints/popup/{popup.container.tsx → popup.tsx} +3 -3
  102. package/template/web-extension/eslint.config.js +106 -0
  103. package/template/web-extension/package.json +84 -86
  104. package/template/web-extension/shared/content/constant.ts +1 -0
  105. package/template/web-extension/shared/content/index.ts +2 -1
  106. package/template/web-extension/shared/content/message.ts +25 -15
  107. package/template/web-extension/shared/styles/theme.styled.ts +56 -56
  108. package/template/web-extension/shared/tools/message.ts +70 -80
  109. package/template/web-extension/tsconfig.json +32 -32
  110. package/template/web-extension/vite-env.d.ts +20 -19
  111. package/template/web-extension/wxt.config.ts +43 -50
  112. package/template/lib/workspace/.eslintrc +0 -111
  113. package/template/lib/workspace/packages/react/.eslintrc +0 -111
  114. package/template/lib/workspace/packages/react/.stylelintrc +0 -29
  115. package/template/web-app/react-rsbuild/.eslintignore +0 -4
  116. package/template/web-app/react-rsbuild/.eslintrc +0 -111
  117. package/template/web-app/react-vite/.eslintrc +0 -110
  118. package/template/web-app/react-webpack/.eslintignore +0 -4
  119. package/template/web-app/react-webpack/.eslintrc +0 -110
  120. package/template/web-app/svelte/.eslintignore +0 -13
  121. package/template/web-app/svelte/.eslintrc +0 -76
  122. package/template/web-app/vue/.eslintignore +0 -4
  123. package/template/web-app/vue/.eslintrc +0 -97
  124. package/template/web-extension/.eslintignore +0 -4
  125. package/template/web-extension/.eslintrc +0 -110
  126. /package/template/web-app/solid/src/pages/home/{home.css → view.css} +0 -0
@@ -1,12 +1,10 @@
1
- import { Common } from './modules'
2
-
3
- export default defineContentScript({
4
- run_at: 'document_start',
5
- matches: [
6
- 'https://developer.chrome.com/docs/extensions/*',
7
- 'https://developer.chrome.com/docs/webstore/*'
8
- ],
9
- main: () => {
10
- Common.insert()
11
- }
12
- })
1
+ import { Common } from './modules'
2
+ import { CONTENT_MATCHES } from '@/shared/content'
3
+
4
+ export default defineContentScript({
5
+ run_at: 'document_idle',
6
+ matches: CONTENT_MATCHES,
7
+ main: () => {
8
+ Common.insert()
9
+ }
10
+ })
@@ -1,14 +1,14 @@
1
- import { StrictMode } from 'react'
2
- import { createRoot } from 'react-dom/client'
3
- import { AppContext } from '@/shared/components'
4
- import { GlobalStyle } from '@/shared/styles'
5
- import Popup from './popup.container'
6
-
7
- createRoot(document.getElementById('root') as HTMLElement).render(
8
- <StrictMode>
9
- <AppContext>
10
- <GlobalStyle />
11
- <Popup />
12
- </AppContext>
13
- </StrictMode>
14
- )
1
+ import { StrictMode } from 'react'
2
+ import { createRoot } from 'react-dom/client'
3
+ import { AppContext } from '@/shared/components'
4
+ import { GlobalStyle } from '@/shared/styles'
5
+ import Popup from './popup'
6
+
7
+ createRoot(document.getElementById('root') as HTMLElement).render(
8
+ <StrictMode>
9
+ <AppContext>
10
+ <GlobalStyle />
11
+ <Popup />
12
+ </AppContext>
13
+ </StrictMode>
14
+ )
@@ -1,3 +1,3 @@
1
- export default function Home() {
2
- return <div>home</div>
3
- }
1
+ export default function Home() {
2
+ return <div>home</div>
3
+ }
@@ -0,0 +1,106 @@
1
+ import eslint from '@eslint/js'
2
+ import globals from 'globals'
3
+ import tseslint from 'typescript-eslint'
4
+ import importPlugin from 'eslint-plugin-import'
5
+ import reactPlugin from 'eslint-plugin-react'
6
+ import reactHooksPlugin from 'eslint-plugin-react-hooks'
7
+ import autoImports from './.wxt/eslint-auto-imports.mjs'
8
+
9
+ const scriptExtensions = ['js', 'jsx', 'mjs', 'cjs', 'ts', 'tsx']
10
+ const files = scriptExtensions.map(ext => `**/*.${ext}`)
11
+
12
+ export default tseslint.config([
13
+ {
14
+ ignores: ['**/node_modules/', '**/dist/', '**/.history/', '**/.vscode/', 'vite.config.ts.*']
15
+ },
16
+ eslint.configs.recommended,
17
+ importPlugin.flatConfigs.recommended,
18
+ tseslint.configs.recommended,
19
+ autoImports,
20
+ {
21
+ plugins: { reactPlugin, reactHooksPlugin },
22
+ files,
23
+ languageOptions: {
24
+ ecmaVersion: 2018,
25
+ sourceType: 'module',
26
+ parserOptions: {
27
+ ecmaFeatures: {
28
+ jsx: true
29
+ },
30
+ useJSXTextNode: true
31
+ },
32
+ globals: {
33
+ ...globals.browser,
34
+ ...globals.node
35
+ }
36
+ },
37
+ settings: {
38
+ 'import/resolver': {
39
+ typescript: true,
40
+ node: true
41
+ },
42
+ react: {
43
+ version: '18'
44
+ }
45
+ },
46
+ rules: {
47
+ 'import/export': 'off',
48
+ 'import/namespace': 'off',
49
+ 'import/default': 'off',
50
+ 'import/no-named-as-default-member': 'off',
51
+ 'import/no-named-as-default': 'off',
52
+ 'import/order': [
53
+ 'error',
54
+ {
55
+ groups: [
56
+ 'builtin',
57
+ 'external',
58
+ 'internal',
59
+ 'parent',
60
+ 'sibling',
61
+ 'index',
62
+ 'object',
63
+ 'type'
64
+ ],
65
+ pathGroups: [
66
+ { pattern: 'react', group: 'external', position: 'before' },
67
+ { pattern: 'react-dom/*', group: 'external', position: 'before' },
68
+ { pattern: 'react-router', group: 'external', position: 'before' },
69
+ { pattern: 'react-router-dom', group: 'external', position: 'before' }
70
+ ],
71
+ pathGroupsExcludedImportTypes: ['react', 'react-router', 'react-router-dom']
72
+ }
73
+ ],
74
+ 'no-case-declarations': 'off',
75
+ '@typescript-eslint/no-unused-expressions': 'off',
76
+ '@typescript-eslint/no-empty-object-type': 'off',
77
+ '@typescript-eslint/no-var-requires': 0,
78
+ '@typescript-eslint/explicit-function-return-type': 'off',
79
+ '@typescript-eslint/no-explicit-any': 0,
80
+ '@typescript-eslint/no-non-null-assertion': 'off',
81
+ '@typescript-eslint/no-inferrable-types': [
82
+ 'warn',
83
+ {
84
+ ignoreParameters: true
85
+ }
86
+ ],
87
+ '@typescript-eslint/no-unused-vars': [
88
+ 'warn',
89
+ {
90
+ argsIgnorePattern: '^_'
91
+ }
92
+ ],
93
+ '@typescript-eslint/member-delimiter-style': 0,
94
+ '@typescript-eslint/class-name-casing': 0,
95
+ '@typescript-eslint/explicit-module-boundary-types': 'off',
96
+ '@typescript-eslint/ban-ts-comment': 'off',
97
+ '@typescript-eslint/no-empty-interface': 'off',
98
+ 'react/prop-types': 'off',
99
+ 'react/no-find-dom-node': 'off',
100
+ 'react-hooks/exhaustive-deps': 'off',
101
+ 'react/display-name': 'off',
102
+ 'react/react-in-jsx-scope': 'off',
103
+ 'no-constant-condition': 'off'
104
+ }
105
+ }
106
+ ])
@@ -1,86 +1,84 @@
1
- {
2
- "name": "web-extension",
3
- "private": true,
4
- "version": "0.0.0",
5
- "type": "module",
6
- "scripts": {
7
- "prepare": "husky install",
8
- "dev": "wxt",
9
- "dev:firefox": "wxt -b firefox",
10
- "build": "wxt build",
11
- "build_dev": "wxt build --mode dev",
12
- "build:firefox": "wxt build -b firefox",
13
- "build_dev:firefox": "wxt build -b firefox --mode dev",
14
- "zip": "wxt zip",
15
- "zip_dev": "wxt zip --mode dev",
16
- "zip:firefox": "wxt zip -b firefox",
17
- "zip_dev:firefox": "wxt zip -b firefox --mode dev",
18
- "postinstall": "wxt prepare",
19
- "up:vite": "pnpm up vite @vitejs/* -L",
20
- "format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,css,scss,less}\"",
21
- "lint": "tsc --noEmit && eslint **/*.{tsx,ts} && stylelint **/*.{css,scss,less}",
22
- "lint:fix": "eslint **/*.{tsx,ts} --fix && stylelint **/*.{css,scss,less} --fix",
23
- "cz": "cz",
24
- "push": "npm run commit && git push",
25
- "commit": "git add . && npm run cz"
26
- },
27
- "dependencies": {
28
- "@tanstack/react-query": "5.51.15",
29
- "axios": "^1.7.2",
30
- "define-zustand": "3.1.1",
31
- "immer": "10.0.1",
32
- "lodash-es": "4.17.21",
33
- "qs": "6.11.2",
34
- "react": "18.3.1",
35
- "react-dom": "18.3.1",
36
- "styled-components": "6.1.11",
37
- "zustand": "4.4.1"
38
- },
39
- "devDependencies": {
40
- "1k-types": "1.2.0",
41
- "@commitlint/cli": "17.6.1",
42
- "@commitlint/config-conventional": "17.6.1",
43
- "@commitlint/cz-commitlint": "17.5.0",
44
- "@rollup/plugin-eslint": "9.0.5",
45
- "@types/chrome": "0.0.254",
46
- "@types/lodash-es": "4.17.7",
47
- "@types/node": "18.16.0",
48
- "@types/qs": "6.9.7",
49
- "@types/react": "18.3.3",
50
- "@types/react-dom": "18.3.0",
51
- "@typescript-eslint/eslint-plugin": "7.0.2",
52
- "@typescript-eslint/parser": "7.0.2",
53
- "@vitejs/plugin-react": "4.3.1",
54
- "autoprefixer": "10.4.14",
55
- "babel-plugin-styled-components": "2.1.4",
56
- "commitizen": "4.3.0",
57
- "cssnano": "6.0.0",
58
- "eslint": "8.56.0",
59
- "eslint-import-resolver-typescript": "3.6.1",
60
- "eslint-plugin-import": "2.29.1",
61
- "eslint-plugin-react": "7.33.2",
62
- "eslint-plugin-react-hooks": "4.6.0",
63
- "husky": "9.1.6",
64
- "inquirer": "^8.1.2",
65
- "postcss": "8.4.31",
66
- "postcss-import": "15.1.0",
67
- "postcss-nesting": "11.2.2",
68
- "postcss-scss": "4.0.9",
69
- "postcss-styled-syntax": "0.6.4",
70
- "prettier": "3.2.5",
71
- "rimraf": "5.0.1",
72
- "sass": "1.63.4",
73
- "stylelint": "16.10.0",
74
- "stylelint-config-standard": "36.0.1",
75
- "typescript": "5.5.2",
76
- "vite": "5.3.3",
77
- "vite-plugin-stylelint": "5.3.1",
78
- "vite-plugin-svgr": "4.2.0",
79
- "wxt": "0.19.11"
80
- },
81
- "config": {
82
- "commitizen": {
83
- "path": "@commitlint/cz-commitlint"
84
- }
85
- }
86
- }
1
+ {
2
+ "name": "web-extension",
3
+ "private": true,
4
+ "version": "0.0.0",
5
+ "type": "module",
6
+ "scripts": {
7
+ "prepare": "husky install",
8
+ "dev": "wxt",
9
+ "dev:firefox": "wxt -b firefox",
10
+ "build": "wxt build",
11
+ "build_dev": "wxt build --mode dev",
12
+ "build:firefox": "wxt build -b firefox",
13
+ "build_dev:firefox": "wxt build -b firefox --mode dev",
14
+ "zip": "wxt zip",
15
+ "zip_dev": "wxt zip --mode dev",
16
+ "zip:firefox": "wxt zip -b firefox",
17
+ "zip_dev:firefox": "wxt zip -b firefox --mode dev",
18
+ "postinstall": "wxt prepare",
19
+ "up:vite": "pnpm up vite @vitejs/* -L",
20
+ "format": "prettier --write \"**/*.{ts,js,tsx,jsx,json,css,scss,less}\"",
21
+ "lint": "tsc --noEmit && eslint && stylelint **/*.{css,scss,less}",
22
+ "lint:fix": "eslint --fix && stylelint **/*.{css,scss,less} --fix",
23
+ "cz": "cz",
24
+ "push": "npm run commit && git push",
25
+ "commit": "git add . && npm run cz"
26
+ },
27
+ "dependencies": {
28
+ "@tanstack/react-query": "5.51.15",
29
+ "axios": "1.7.9",
30
+ "define-zustand": "3.1.1",
31
+ "immer": "10.0.1",
32
+ "lodash-es": "4.17.21",
33
+ "qs": "6.11.2",
34
+ "react": "18.3.1",
35
+ "react-dom": "18.3.1",
36
+ "styled-components": "6.1.11",
37
+ "zustand": "4.4.1"
38
+ },
39
+ "devDependencies": {
40
+ "@commitlint/cli": "17.6.1",
41
+ "@commitlint/config-conventional": "17.6.1",
42
+ "@commitlint/cz-commitlint": "17.5.0",
43
+ "@eslint/js": "9.15.0",
44
+ "@types/chrome": "0.0.254",
45
+ "@types/lodash-es": "4.17.12",
46
+ "@types/node": "18.16.0",
47
+ "@types/qs": "6.9.7",
48
+ "@types/react": "18.3.3",
49
+ "@types/react-dom": "18.3.0",
50
+ "@vitejs/plugin-react": "4.3.4",
51
+ "autoprefixer": "10.4.14",
52
+ "babel-plugin-styled-components": "2.1.4",
53
+ "commitizen": "4.3.0",
54
+ "cssnano": "6.0.0",
55
+ "eslint": "9.17.0",
56
+ "eslint-import-resolver-typescript": "3.7.0",
57
+ "eslint-plugin-import": "2.31.0",
58
+ "eslint-plugin-react": "7.37.2",
59
+ "eslint-plugin-react-hooks": "5.1.0",
60
+ "globals": "15.12.0",
61
+ "husky": "9.1.6",
62
+ "inquirer": "^8.1.2",
63
+ "postcss": "8.4.31",
64
+ "postcss-import": "15.1.0",
65
+ "postcss-nesting": "11.2.2",
66
+ "postcss-scss": "4.0.9",
67
+ "postcss-styled-syntax": "0.6.4",
68
+ "prettier": "3.2.5",
69
+ "rimraf": "5.0.1",
70
+ "sass": "1.63.4",
71
+ "stylelint": "16.10.0",
72
+ "stylelint-config-standard": "36.0.1",
73
+ "typescript": "5.7.2",
74
+ "typescript-eslint": "8.15.0",
75
+ "vite": "6.0.7",
76
+ "vite-plugin-svgr": "4.3.0",
77
+ "wxt": "0.19.25"
78
+ },
79
+ "config": {
80
+ "commitizen": {
81
+ "path": "@commitlint/cz-commitlint"
82
+ }
83
+ }
84
+ }
@@ -0,0 +1 @@
1
+ export const CONTENT_MATCHES = ['<all_urls>']
@@ -1 +1,2 @@
1
- export * as contentMessage from './message'
1
+ export * as contentMessage from './message'
2
+ export * from './constant'
@@ -1,15 +1,25 @@
1
- import { message } from '@/shared/tools'
2
- export enum ACTIONS {
3
- TEST = 'TEST'
4
- }
5
-
6
- export interface messageType {
7
- [ACTIONS.TEST]: object
8
- }
9
- export interface responseType {}
10
-
11
- export const action = message.create<ACTIONS, messageType, responseType>()
12
-
13
- export function batchSend<A extends ACTIONS>(message: { action: A } & messageType[A]) {
14
- return action.batchSendToContent(message, { active: true, url: '*://*.tiktok.com/*' })
15
- }
1
+ import { message } from '@/shared/tools'
2
+ import { CONTENT_MATCHES } from './constant'
3
+
4
+ export enum ACTIONS {
5
+ TEST = 'TEST'
6
+ }
7
+
8
+ export interface messageType {
9
+ [ACTIONS.TEST]: object
10
+ }
11
+ export interface responseType {}
12
+
13
+ export const action = message.create<ACTIONS, messageType, responseType>()
14
+
15
+ export function sendToAllContent<A extends ACTIONS>(
16
+ message: message.genMessageType<A, messageType[A]>
17
+ ) {
18
+ return action.sendToContent(message, { active: true, url: CONTENT_MATCHES })
19
+ }
20
+
21
+ export function sendToCurrentContent<A extends ACTIONS>(
22
+ message: message.genMessageType<A, messageType[A]>
23
+ ) {
24
+ return action.sendToContent(message, { active: true, url: CONTENT_MATCHES })
25
+ }
@@ -1,56 +1,56 @@
1
- import { CSSProperties } from 'react'
2
- import { AnyFunc } from '1k-types'
3
- import { isString } from 'lodash-es'
4
-
5
- export const theme = {
6
- tools: {
7
- ellipsis: () => ({
8
- overflow: 'hidden',
9
- textOverflow: 'ellipsis',
10
- whiteSpace: 'nowrap'
11
- }),
12
- lineClamp: (n: number) => ({
13
- '-webkit-line-clamp': `${n}`,
14
- '-webkit-box-orient': 'vertical',
15
- overflow: 'hidden',
16
- display: '-webkit-box'
17
- }),
18
- size: (s: string) => ({ width: s, height: s }),
19
- py: (s: string) => ({ paddingTop: s, paddingBottom: s }),
20
- px: (s: string) => ({ paddingLeft: s, paddingRight: s }),
21
- my: (s: string) => ({ marginTop: s, marginBottom: s }),
22
- mx: (s: string) => ({ marginLeft: s, marginRight: s }),
23
- flex: (
24
- align: CSSProperties['alignItems'],
25
- justify: CSSProperties['justifyContent'],
26
- vertical?: boolean
27
- ) => {
28
- return {
29
- display: 'flex',
30
- alignItems: align,
31
- justifyContent: justify,
32
- flexDirection: vertical ? 'column' : 'row'
33
- } satisfies CSSProperties
34
- },
35
- /** 数字为元素数量,字符串为对应css的值 */
36
- grid: {
37
- grid: (rows: number | string, cols: number | string, gap?: number) => ({
38
- display: 'grid',
39
- gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
40
- gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
41
- gap: gap ? `${gap}px` : void 0
42
- }),
43
- rows: (rows: number | string, gap?: number) => ({
44
- display: 'grid',
45
- gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
46
- rowGap: gap ? `${gap}px` : void 0
47
- }),
48
- cols: (cols: number | string, gap?: number) => ({
49
- display: 'grid',
50
- gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
51
- columnGap: gap ? `${gap}px` : void 0
52
- })
53
- } satisfies Record<string, AnyFunc<CSSProperties>>
54
- }
55
- }
56
- export type themeType = typeof theme
1
+ import { CSSProperties } from 'react'
2
+
3
+ import { isString } from 'lodash-es'
4
+
5
+ export const theme = {
6
+ tools: {
7
+ ellipsis: () => ({
8
+ overflow: 'hidden',
9
+ textOverflow: 'ellipsis',
10
+ whiteSpace: 'nowrap'
11
+ }),
12
+ lineClamp: (n: number) => ({
13
+ '-webkit-line-clamp': `${n}`,
14
+ '-webkit-box-orient': 'vertical',
15
+ overflow: 'hidden',
16
+ display: '-webkit-box'
17
+ }),
18
+ size: (s: string) => ({ width: s, height: s }),
19
+ py: (s: string) => ({ paddingTop: s, paddingBottom: s }),
20
+ px: (s: string) => ({ paddingLeft: s, paddingRight: s }),
21
+ my: (s: string) => ({ marginTop: s, marginBottom: s }),
22
+ mx: (s: string) => ({ marginLeft: s, marginRight: s }),
23
+ flex: (
24
+ align: CSSProperties['alignItems'],
25
+ justify: CSSProperties['justifyContent'],
26
+ vertical?: boolean
27
+ ) => {
28
+ return {
29
+ display: 'flex',
30
+ alignItems: align,
31
+ justifyContent: justify,
32
+ flexDirection: vertical ? 'column' : 'row'
33
+ } satisfies CSSProperties
34
+ },
35
+ /** 数字为元素数量,字符串为对应css的值 */
36
+ grid: {
37
+ grid: (rows: number | string, cols: number | string, gap?: number) => ({
38
+ display: 'grid',
39
+ gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
40
+ gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
41
+ gap: gap ? `${gap}px` : void 0
42
+ }),
43
+ rows: (rows: number | string, gap?: number) => ({
44
+ display: 'grid',
45
+ gridTemplateRows: isString(rows) ? rows : `repeat(${rows}, minmax(0, 1fr))`,
46
+ rowGap: gap ? `${gap}px` : void 0
47
+ }),
48
+ cols: (cols: number | string, gap?: number) => ({
49
+ display: 'grid',
50
+ gridTemplateColumns: isString(cols) ? cols : `repeat(${cols}, minmax(0, 1fr))`,
51
+ columnGap: gap ? `${gap}px` : void 0
52
+ })
53
+ } satisfies Record<string, (...args: any) => CSSProperties>
54
+ }
55
+ }
56
+ export type themeType = typeof theme