@clikvn/showroom-visualizer 0.2.2-dev-10 → 0.2.2-dev-12

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 (71) hide show
  1. package/.idea/inspectionProfiles/Project_Default.xml +36 -0
  2. package/.idea/jsLinters/eslint.xml +7 -0
  3. package/.idea/misc.xml +9 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/prettier.xml +8 -0
  6. package/.idea/showroom-visualizer.iml +9 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/DEVELOPMENT.md +120 -120
  9. package/EXAMPLES.md +967 -967
  10. package/README.md +139 -139
  11. package/SETUP_COMPLETE.md +149 -149
  12. package/dist/components/SkinLayer/Drawer/PoiHeader/index.d.ts +16 -0
  13. package/dist/components/SkinLayer/Drawer/PoiHeader/index.d.ts.map +1 -0
  14. package/dist/components/SkinLayer/Drawer/index.d.ts +29 -0
  15. package/dist/components/SkinLayer/Drawer/index.d.ts.map +1 -0
  16. package/dist/components/SkinLayer/GalleryFullScreen/Content/ARViewer.d.ts +30 -0
  17. package/dist/components/SkinLayer/GalleryFullScreen/Content/ARViewer.d.ts.map +1 -0
  18. package/dist/components/SkinLayer/ModalItemInfo/Description.d.ts +10 -0
  19. package/dist/components/SkinLayer/ModalItemInfo/Description.d.ts.map +1 -0
  20. package/dist/components/SkinLayer/ModalItemInfo/Intro.d.ts +9 -0
  21. package/dist/components/SkinLayer/ModalItemInfo/Intro.d.ts.map +1 -0
  22. package/dist/components/SkinLayer/ModalItemInfo/Media.d.ts +13 -0
  23. package/dist/components/SkinLayer/ModalItemInfo/Media.d.ts.map +1 -0
  24. package/dist/components/SkinLayer/ModalItemInfo/index.d.ts +10 -0
  25. package/dist/components/SkinLayer/ModalItemInfo/index.d.ts.map +1 -0
  26. package/dist/components/SkinLayer/PlayAll/index.d.ts +8 -0
  27. package/dist/components/SkinLayer/PlayAll/index.d.ts.map +1 -0
  28. package/dist/components/SkinLayer/PoiTextureOptions/HorizontalMenu/index.d.ts +13 -0
  29. package/dist/components/SkinLayer/PoiTextureOptions/HorizontalMenu/index.d.ts.map +1 -0
  30. package/dist/components/SkinLayer/PoiTextureOptions/SemicircleMenu/index.d.ts +13 -0
  31. package/dist/components/SkinLayer/PoiTextureOptions/SemicircleMenu/index.d.ts.map +1 -0
  32. package/dist/components/SkinLayer/PoiTextureOptions/TextureMenuItem/index.d.ts +15 -0
  33. package/dist/components/SkinLayer/PoiTextureOptions/TextureMenuItem/index.d.ts.map +1 -0
  34. package/dist/components/SkinLayer/PoiTextureOptions/VerticalMenu/index.d.ts +13 -0
  35. package/dist/components/SkinLayer/PoiTextureOptions/VerticalMenu/index.d.ts.map +1 -0
  36. package/dist/context/StoreContext.d.ts +5 -0
  37. package/dist/context/StoreContext.d.ts.map +1 -0
  38. package/dist/features/ShowroomVisualizer/Scripts.d.ts +4 -0
  39. package/dist/features/ShowroomVisualizer/Scripts.d.ts.map +1 -0
  40. package/dist/features/ShowroomVisualizer/TourContainer.d.ts +9 -0
  41. package/dist/features/ShowroomVisualizer/TourContainer.d.ts.map +1 -0
  42. package/dist/features/ShowroomVisualizer/Tours.d.ts +3 -0
  43. package/dist/features/ShowroomVisualizer/Tours.d.ts.map +1 -0
  44. package/dist/features/VirtualTourVisualizer/index.d.ts +20 -0
  45. package/dist/features/VirtualTourVisualizer/index.d.ts.map +1 -0
  46. package/dist/features/VirtualTourVisualizerUI/index.d.ts +17 -0
  47. package/dist/features/VirtualTourVisualizerUI/index.d.ts.map +1 -0
  48. package/dist/hooks/Visualizer/reducer.d.ts +116 -0
  49. package/dist/hooks/Visualizer/reducer.d.ts.map +1 -0
  50. package/dist/index.html +95 -95
  51. package/dist/index.js +1 -1
  52. package/dist/web.js +1 -1
  53. package/example/CSS_HANDLING.md +141 -141
  54. package/example/FIXES_SUMMARY.md +121 -121
  55. package/example/PATH_ALIASES.md +103 -103
  56. package/example/README.md +64 -64
  57. package/example/index.html +13 -13
  58. package/example/package.json +25 -25
  59. package/example/postcss.config.cjs +5 -5
  60. package/example/tailwind.config.cjs +12 -12
  61. package/example/tsconfig.node.json +12 -12
  62. package/example/vite.config.ts +125 -125
  63. package/package.json +132 -132
  64. package/rollup.config.js +66 -3
  65. package/.claude/settings.local.json +0 -19
  66. package/dist/context/SwizzleContext.d.ts +0 -21
  67. package/dist/context/SwizzleContext.d.ts.map +0 -1
  68. package/dist/types/swizzle.d.ts +0 -59
  69. package/dist/types/swizzle.d.ts.map +0 -1
  70. /package/dist/features/ShowroomVisualizer/{CssStyles.d.ts → cssStyles.d.ts} +0 -0
  71. /package/dist/features/ShowroomVisualizer/{CssStyles.d.ts.map → cssStyles.d.ts.map} +0 -0
@@ -1,126 +1,126 @@
1
- import { defineConfig, Plugin } from 'vite';
2
- import react from '@vitejs/plugin-react';
3
- import path from 'path';
4
- import fs from 'fs';
5
- import postcss from 'postcss';
6
- import tailwindcss from 'tailwindcss';
7
- import autoprefixer from 'autoprefixer';
8
-
9
- // Custom plugin to handle CSS imports as strings (matching Rollup's postcss behavior)
10
- const cssAsStringPlugin = (): Plugin => {
11
- let postcssProcessor: any;
12
-
13
- return {
14
- name: 'css-as-string',
15
- enforce: 'pre',
16
-
17
- async configResolved(config) {
18
- // Initialize PostCSS processor with Tailwind
19
- postcssProcessor = postcss([
20
- tailwindcss({
21
- config: path.resolve(__dirname, 'tailwind.config.cjs'),
22
- }),
23
- autoprefixer(),
24
- ]);
25
- },
26
-
27
- async resolveId(source, importer) {
28
- // Handle CSS imports from the library
29
- if (source.endsWith('.css') && importer) {
30
- // Check if this is from our library (any src folder) or @clikvn packages
31
- const isLibraryCSS =
32
- importer.includes('/showroom-visualizer/src/') ||
33
- source.includes('@clikvn/');
34
-
35
- if (isLibraryCSS) {
36
- // Resolve the full path
37
- let resolvedPath: string;
38
-
39
- if (source.startsWith('.') || source.startsWith('/')) {
40
- resolvedPath = path.resolve(path.dirname(importer), source);
41
- } else if (source.startsWith('@clikvn/')) {
42
- // Handle @clikvn packages - look in parent node_modules
43
- const packagePath = source.replace('@clikvn/', '../node_modules/@clikvn/');
44
- resolvedPath = path.resolve(__dirname, packagePath);
45
- } else {
46
- return null;
47
- }
48
-
49
- // Add a virtual marker to bypass Vite's CSS processing
50
- return '\0' + resolvedPath + '.string';
51
- }
52
- }
53
- return null;
54
- },
55
-
56
- async load(id) {
57
- // Handle our virtual CSS string modules
58
- if (id.startsWith('\0') && id.endsWith('.css.string')) {
59
- const realPath = id.slice(1, -7); // Remove \0 prefix and .string suffix
60
-
61
- try {
62
- const content = await fs.promises.readFile(realPath, 'utf-8');
63
-
64
- // Process all CSS through PostCSS/Tailwind to ensure Tailwind utilities work
65
- let processedContent = content;
66
- try {
67
- const result = await postcssProcessor.process(content, { from: realPath });
68
- processedContent = result.css;
69
- } catch (error) {
70
- console.warn(`PostCSS processing failed for ${realPath}:`, error);
71
- // Fall back to original content if processing fails
72
- processedContent = content;
73
- }
74
-
75
- return {
76
- code: `export default ${JSON.stringify(processedContent)};`,
77
- map: null,
78
- };
79
- } catch (error) {
80
- console.error(`Failed to load CSS file: ${realPath}`, error);
81
- return {
82
- code: `export default "";`,
83
- map: null,
84
- };
85
- }
86
- }
87
- return null;
88
- },
89
- };
90
- };
91
-
92
- // https://vitejs.dev/config/
93
- export default defineConfig({
94
- plugins: [cssAsStringPlugin(), react()],
95
- resolve: {
96
- alias: {
97
- // Force use of example's React to avoid duplicate instances
98
- 'react': path.resolve(__dirname, 'node_modules/react'),
99
- 'react-dom': path.resolve(__dirname, 'node_modules/react-dom'),
100
- 'react/jsx-runtime': path.resolve(__dirname, 'node_modules/react/jsx-runtime'),
101
- // Alias để import trực tiếp từ source code thay vì build
102
- '@clikvn/showroom-visualizer': path.resolve(__dirname, '../src'),
103
- // Thư viện sử dụng baseUrl: "./src" nên tất cả imports cần aliases
104
- commons: path.resolve(__dirname, '../src/commons'),
105
- components: path.resolve(__dirname, '../src/components'),
106
- constants: path.resolve(__dirname, '../src/constants'),
107
- context: path.resolve(__dirname, '../src/context'),
108
- features: path.resolve(__dirname, '../src/features'),
109
- hooks: path.resolve(__dirname, '../src/hooks'),
110
- models: path.resolve(__dirname, '../src/models'),
111
- services: path.resolve(__dirname, '../src/services'),
112
- types: path.resolve(__dirname, '../src/types'),
113
- utils: path.resolve(__dirname, '../src/utils'),
114
- },
115
- },
116
- server: {
117
- port: 3001,
118
- open: true,
119
- },
120
- optimizeDeps: {
121
- // Force prebundle để tránh conflict React versions
122
- include: ['react', 'react-dom'],
123
- // Ensure all React references use the same instance
124
- dedupe: ['react', 'react-dom'],
125
- },
1
+ import { defineConfig, Plugin } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import path from 'path';
4
+ import fs from 'fs';
5
+ import postcss from 'postcss';
6
+ import tailwindcss from 'tailwindcss';
7
+ import autoprefixer from 'autoprefixer';
8
+
9
+ // Custom plugin to handle CSS imports as strings (matching Rollup's postcss behavior)
10
+ const cssAsStringPlugin = (): Plugin => {
11
+ let postcssProcessor: any;
12
+
13
+ return {
14
+ name: 'css-as-string',
15
+ enforce: 'pre',
16
+
17
+ async configResolved(config) {
18
+ // Initialize PostCSS processor with Tailwind
19
+ postcssProcessor = postcss([
20
+ tailwindcss({
21
+ config: path.resolve(__dirname, 'tailwind.config.cjs'),
22
+ }),
23
+ autoprefixer(),
24
+ ]);
25
+ },
26
+
27
+ async resolveId(source, importer) {
28
+ // Handle CSS imports from the library
29
+ if (source.endsWith('.css') && importer) {
30
+ // Check if this is from our library (any src folder) or @clikvn packages
31
+ const isLibraryCSS =
32
+ importer.includes('/showroom-visualizer/src/') ||
33
+ source.includes('@clikvn/');
34
+
35
+ if (isLibraryCSS) {
36
+ // Resolve the full path
37
+ let resolvedPath: string;
38
+
39
+ if (source.startsWith('.') || source.startsWith('/')) {
40
+ resolvedPath = path.resolve(path.dirname(importer), source);
41
+ } else if (source.startsWith('@clikvn/')) {
42
+ // Handle @clikvn packages - look in parent node_modules
43
+ const packagePath = source.replace('@clikvn/', '../node_modules/@clikvn/');
44
+ resolvedPath = path.resolve(__dirname, packagePath);
45
+ } else {
46
+ return null;
47
+ }
48
+
49
+ // Add a virtual marker to bypass Vite's CSS processing
50
+ return '\0' + resolvedPath + '.string';
51
+ }
52
+ }
53
+ return null;
54
+ },
55
+
56
+ async load(id) {
57
+ // Handle our virtual CSS string modules
58
+ if (id.startsWith('\0') && id.endsWith('.css.string')) {
59
+ const realPath = id.slice(1, -7); // Remove \0 prefix and .string suffix
60
+
61
+ try {
62
+ const content = await fs.promises.readFile(realPath, 'utf-8');
63
+
64
+ // Process all CSS through PostCSS/Tailwind to ensure Tailwind utilities work
65
+ let processedContent = content;
66
+ try {
67
+ const result = await postcssProcessor.process(content, { from: realPath });
68
+ processedContent = result.css;
69
+ } catch (error) {
70
+ console.warn(`PostCSS processing failed for ${realPath}:`, error);
71
+ // Fall back to original content if processing fails
72
+ processedContent = content;
73
+ }
74
+
75
+ return {
76
+ code: `export default ${JSON.stringify(processedContent)};`,
77
+ map: null,
78
+ };
79
+ } catch (error) {
80
+ console.error(`Failed to load CSS file: ${realPath}`, error);
81
+ return {
82
+ code: `export default "";`,
83
+ map: null,
84
+ };
85
+ }
86
+ }
87
+ return null;
88
+ },
89
+ };
90
+ };
91
+
92
+ // https://vitejs.dev/config/
93
+ export default defineConfig({
94
+ plugins: [cssAsStringPlugin(), react()],
95
+ resolve: {
96
+ alias: {
97
+ // Force use of example's React to avoid duplicate instances
98
+ 'react': path.resolve(__dirname, 'node_modules/react'),
99
+ 'react-dom': path.resolve(__dirname, 'node_modules/react-dom'),
100
+ 'react/jsx-runtime': path.resolve(__dirname, 'node_modules/react/jsx-runtime'),
101
+ // Alias để import trực tiếp từ source code thay vì build
102
+ '@clikvn/showroom-visualizer': path.resolve(__dirname, '../src'),
103
+ // Thư viện sử dụng baseUrl: "./src" nên tất cả imports cần aliases
104
+ commons: path.resolve(__dirname, '../src/commons'),
105
+ components: path.resolve(__dirname, '../src/components'),
106
+ constants: path.resolve(__dirname, '../src/constants'),
107
+ context: path.resolve(__dirname, '../src/context'),
108
+ features: path.resolve(__dirname, '../src/features'),
109
+ hooks: path.resolve(__dirname, '../src/hooks'),
110
+ models: path.resolve(__dirname, '../src/models'),
111
+ services: path.resolve(__dirname, '../src/services'),
112
+ types: path.resolve(__dirname, '../src/types'),
113
+ utils: path.resolve(__dirname, '../src/utils'),
114
+ },
115
+ },
116
+ server: {
117
+ port: 3001,
118
+ open: true,
119
+ },
120
+ optimizeDeps: {
121
+ // Force prebundle để tránh conflict React versions
122
+ include: ['react', 'react-dom'],
123
+ // Ensure all React references use the same instance
124
+ dedupe: ['react', 'react-dom'],
125
+ },
126
126
  });
package/package.json CHANGED
@@ -1,132 +1,132 @@
1
- {
2
- "name": "@clikvn/showroom-visualizer",
3
- "description": "Showroom Visualizer",
4
- "version": "0.2.2-dev-10",
5
- "author": "Clik JSC",
6
- "license": "ISC",
7
- "type": "module",
8
- "main": "dist/index.js",
9
- "types": "dist/index.d.ts",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.ts",
13
- "import": "./dist/index.js"
14
- },
15
- "./dist/web": "./dist/web.js",
16
- "./dist/web.js": "./dist/web.js"
17
- },
18
- "scripts": {
19
- "dev": "rollup --watch --config rollup.config.js",
20
- "build": "rollup --config rollup.config.js",
21
- "lint": "eslint src",
22
- "lint:fix": "eslint --fix src",
23
- "prettier": "prettier --write .",
24
- "pub": "publish --access public",
25
- "deploy": "yarn build && yarn publish --access public"
26
- },
27
- "dependencies": {
28
- "@clikvn/react-bottom-sheet": "^1.0.3",
29
- "@clikvn/react-gallery-viewer": "^1.2.3-dev",
30
- "@fortawesome/fontawesome-svg-core": "^6.6.0",
31
- "@fortawesome/free-brands-svg-icons": "^6.6.0",
32
- "@fortawesome/free-regular-svg-icons": "^6.6.0",
33
- "@fortawesome/free-solid-svg-icons": "^6.6.0",
34
- "@fortawesome/react-fontawesome": "^0.2.2",
35
- "@radix-ui/react-slot": "^1.1.1",
36
- "@ts-stack/markdown": "1.4.0",
37
- "@types/moment": "^2.13.0",
38
- "antd": "^5.27.2",
39
- "axios": "^1.11.0",
40
- "class-variance-authority": "^0.7.1",
41
- "classnames": "^2.5.1",
42
- "clsx": "^2.1.1",
43
- "date-fns": "^4.1.0",
44
- "device-detector-js": "^3.0.3",
45
- "embla-carousel-react": "^8.6.0",
46
- "framer-motion": "^12.23.12",
47
- "howler": "^2.2.4",
48
- "i18next": "^25.5.1",
49
- "lodash": "^4.17.21",
50
- "lucide-react": "^0.544.0",
51
- "moment": "^2.30.1",
52
- "node-fetch": "^3.3.2",
53
- "qrcode.react": "^4.2.0",
54
- "rc-progress": "^4.0.0",
55
- "react": "^18.3.1",
56
- "react-dom": "^18.3.1",
57
- "react-i18next": "^15.7.3",
58
- "react-intersection-image": "^2.1.2",
59
- "react-markdown": "^9.0.3",
60
- "react-planet": "^1.0.1-ie11",
61
- "react-slick": "^0.31.0",
62
- "react-truncate-markup": "^5.1.2",
63
- "react-zoom-pan-pinch": "^3.7.0",
64
- "remark-gfm": "^4.0.0",
65
- "signals": "^1.0.0",
66
- "sonner": "^2.0.7",
67
- "swr": "^2.3.0",
68
- "usehooks-ts": "^3.1.0",
69
- "vtt.js": "^0.13.0",
70
- "web-vitals": "^2.1.0"
71
- },
72
- "eslintConfig": {
73
- "extends": [
74
- "react-app",
75
- "react-app/jest"
76
- ]
77
- },
78
- "browserslist": {
79
- "production": [
80
- ">0.2%",
81
- "not dead",
82
- "not op_mini all"
83
- ],
84
- "development": [
85
- "last 1 chrome version",
86
- "last 1 firefox version",
87
- "last 1 safari version"
88
- ]
89
- },
90
- "devDependencies": {
91
- "@rollup-extras/plugin-copy": "^1.11.1",
92
- "@rollup/plugin-babel": "^6.0.4",
93
- "@rollup/plugin-commonjs": "^28.0.1",
94
- "@rollup/plugin-json": "^6.1.0",
95
- "@rollup/plugin-node-resolve": "^15.3.0",
96
- "@rollup/plugin-typescript": "^12.1.1",
97
- "@tailwindcss/typography": "^0.5.15",
98
- "@testing-library/jest-dom": "^5.14.1",
99
- "@testing-library/react": "^13.0.0",
100
- "@testing-library/user-event": "^13.2.1",
101
- "@types/howler": "^2.2.12",
102
- "@types/jest": "^29.5.14",
103
- "@types/lodash": "^4.17.20",
104
- "@types/node": "^22.9.0",
105
- "@types/node-fetch": "^2.6.13",
106
- "@types/react": "^18.3.12",
107
- "@types/react-dom": "^18.3.1",
108
- "@types/signals": "^1.0.4",
109
- "@typescript-eslint/eslint-plugin": "^8.20.0",
110
- "@typescript-eslint/parser": "^8.20.0",
111
- "autoprefixer": "^10.4.20",
112
- "eslint": "^8.57.0",
113
- "eslint-config-prettier": "^10.0.1",
114
- "eslint-plugin-prettier": "^5.2.2",
115
- "prettier": "^3.4.2",
116
- "react-scripts": "5.0.1",
117
- "rollup": "^4.26.0",
118
- "rollup-plugin-peer-deps-external": "^2.2.4",
119
- "rollup-plugin-postcss": "^4.0.2",
120
- "rollup-plugin-replace": "^2.2.0",
121
- "rollup-plugin-terser": "^7.0.2",
122
- "rollup-plugin-typescript-paths": "^1.5.0",
123
- "rollup-plugin-uglify": "^6.0.4",
124
- "tailwind-merge": "^2.6.0",
125
- "tailwindcss": "^3.4.15",
126
- "tailwindcss-animate": "^1.0.7",
127
- "typescript": "^5.6.3"
128
- },
129
- "engines": {
130
- "node": ">=18.18.0"
131
- }
132
- }
1
+ {
2
+ "name": "@clikvn/showroom-visualizer",
3
+ "description": "Showroom Visualizer",
4
+ "version": "0.2.2-dev-12",
5
+ "author": "Clik JSC",
6
+ "license": "ISC",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "types": "dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./dist/web": "./dist/web.js",
16
+ "./dist/web.js": "./dist/web.js"
17
+ },
18
+ "scripts": {
19
+ "dev": "rollup --watch --config rollup.config.js",
20
+ "build": "rollup --config rollup.config.js",
21
+ "lint": "eslint src",
22
+ "lint:fix": "eslint --fix src",
23
+ "prettier": "prettier --write .",
24
+ "pub": "publish --access public",
25
+ "deploy": "yarn build && yarn publish --access public"
26
+ },
27
+ "dependencies": {
28
+ "@clikvn/react-bottom-sheet": "^1.0.3",
29
+ "@clikvn/react-gallery-viewer": "^1.2.3-dev",
30
+ "@fortawesome/fontawesome-svg-core": "^6.6.0",
31
+ "@fortawesome/free-brands-svg-icons": "^6.6.0",
32
+ "@fortawesome/free-regular-svg-icons": "^6.6.0",
33
+ "@fortawesome/free-solid-svg-icons": "^6.6.0",
34
+ "@fortawesome/react-fontawesome": "^0.2.2",
35
+ "@radix-ui/react-slot": "^1.1.1",
36
+ "@ts-stack/markdown": "1.4.0",
37
+ "@types/moment": "^2.13.0",
38
+ "antd": "^5.27.2",
39
+ "axios": "^1.11.0",
40
+ "class-variance-authority": "^0.7.1",
41
+ "classnames": "^2.5.1",
42
+ "clsx": "^2.1.1",
43
+ "date-fns": "^4.1.0",
44
+ "device-detector-js": "^3.0.3",
45
+ "embla-carousel-react": "^8.6.0",
46
+ "framer-motion": "^12.23.12",
47
+ "howler": "^2.2.4",
48
+ "i18next": "^25.5.1",
49
+ "lodash": "^4.17.21",
50
+ "lucide-react": "^0.544.0",
51
+ "moment": "^2.30.1",
52
+ "node-fetch": "^3.3.2",
53
+ "qrcode.react": "^4.2.0",
54
+ "rc-progress": "^4.0.0",
55
+ "react": "^18.3.1",
56
+ "react-dom": "^18.3.1",
57
+ "react-i18next": "^15.7.3",
58
+ "react-intersection-image": "^2.1.2",
59
+ "react-markdown": "^9.0.3",
60
+ "react-planet": "^1.0.1-ie11",
61
+ "react-slick": "^0.31.0",
62
+ "react-truncate-markup": "^5.1.2",
63
+ "react-zoom-pan-pinch": "^3.7.0",
64
+ "remark-gfm": "^4.0.0",
65
+ "signals": "^1.0.0",
66
+ "sonner": "^2.0.7",
67
+ "swr": "^2.3.0",
68
+ "usehooks-ts": "^3.1.0",
69
+ "vtt.js": "^0.13.0",
70
+ "web-vitals": "^2.1.0"
71
+ },
72
+ "eslintConfig": {
73
+ "extends": [
74
+ "react-app",
75
+ "react-app/jest"
76
+ ]
77
+ },
78
+ "browserslist": {
79
+ "production": [
80
+ ">0.2%",
81
+ "not dead",
82
+ "not op_mini all"
83
+ ],
84
+ "development": [
85
+ "last 1 chrome version",
86
+ "last 1 firefox version",
87
+ "last 1 safari version"
88
+ ]
89
+ },
90
+ "devDependencies": {
91
+ "@rollup-extras/plugin-copy": "^1.11.1",
92
+ "@rollup/plugin-babel": "^6.0.4",
93
+ "@rollup/plugin-commonjs": "^28.0.1",
94
+ "@rollup/plugin-json": "^6.1.0",
95
+ "@rollup/plugin-node-resolve": "^15.3.0",
96
+ "@rollup/plugin-typescript": "^12.1.1",
97
+ "@tailwindcss/typography": "^0.5.15",
98
+ "@testing-library/jest-dom": "^5.14.1",
99
+ "@testing-library/react": "^13.0.0",
100
+ "@testing-library/user-event": "^13.2.1",
101
+ "@types/howler": "^2.2.12",
102
+ "@types/jest": "^29.5.14",
103
+ "@types/lodash": "^4.17.20",
104
+ "@types/node": "^22.9.0",
105
+ "@types/node-fetch": "^2.6.13",
106
+ "@types/react": "^18.3.12",
107
+ "@types/react-dom": "^18.3.1",
108
+ "@types/signals": "^1.0.4",
109
+ "@typescript-eslint/eslint-plugin": "^8.20.0",
110
+ "@typescript-eslint/parser": "^8.20.0",
111
+ "autoprefixer": "^10.4.20",
112
+ "eslint": "^8.57.0",
113
+ "eslint-config-prettier": "^10.0.1",
114
+ "eslint-plugin-prettier": "^5.2.2",
115
+ "prettier": "^3.4.2",
116
+ "react-scripts": "5.0.1",
117
+ "rollup": "^4.26.0",
118
+ "rollup-plugin-peer-deps-external": "^2.2.4",
119
+ "rollup-plugin-postcss": "^4.0.2",
120
+ "rollup-plugin-replace": "^2.2.0",
121
+ "rollup-plugin-terser": "^7.0.2",
122
+ "rollup-plugin-typescript-paths": "^1.5.0",
123
+ "rollup-plugin-uglify": "^6.0.4",
124
+ "tailwind-merge": "^2.6.0",
125
+ "tailwindcss": "^3.4.15",
126
+ "tailwindcss-animate": "^1.0.7",
127
+ "typescript": "^5.6.3"
128
+ },
129
+ "engines": {
130
+ "node": ">=18.18.0"
131
+ }
132
+ }
package/rollup.config.js CHANGED
@@ -239,7 +239,8 @@ const indexConfig = {
239
239
  ignoreDynamicRequires: false,
240
240
  }),
241
241
  // Skip uglify in dev mode - tốn thời gian
242
- !isDev && uglify(),
242
+ // uglify does not support ES2015+ properly — and React’s ESM builds rely heavily on ES2015+ semantics
243
+ // !isDev && uglify(),
243
244
  json(),
244
245
  // Skip babel in dev mode - giảm thời gian compile
245
246
  !isDev &&
@@ -300,7 +301,68 @@ const browserConfig = {
300
301
  // ❌ KHÔNG external React - Bundle React version 19 vào file
301
302
  // external: [], // Không khai báo external = bundle tất cả
302
303
  onwarn: indexConfig.onwarn,
303
- plugins: indexConfig.plugins,
304
+ plugins: [
305
+ resolve({
306
+ browser: true,
307
+ extensions: ['.ts', '.tsx', '.js'],
308
+ dedupe: ['react', 'react-dom'],
309
+ preferBuiltins: false,
310
+ }),
311
+
312
+ commonjs({
313
+ esmExternals: true,
314
+ requireReturnsDefault: 'auto',
315
+ }),
316
+
317
+ json(),
318
+ !isDev &&
319
+ babel({
320
+ babelHelpers: 'bundled',
321
+ extensions: ['.ts', '.tsx', '.js'],
322
+ exclude: 'node_modules/**',
323
+ }),
324
+
325
+ replace({
326
+ 'process.env.NODE_ENV': JSON.stringify(
327
+ isDev ? 'development' : 'production'
328
+ ),
329
+ preventAssignment: true,
330
+ }),
331
+
332
+ postcss({
333
+ plugins: [autoprefixer(), tailwindcss()],
334
+ extract: false,
335
+ modules: false,
336
+ autoModules: false,
337
+ minimize: !isDev,
338
+ inject: false,
339
+ }),
340
+
341
+ typescript({
342
+ sourceMap: isDev,
343
+ inlineSources: isDev,
344
+ }),
345
+
346
+ typescriptPaths({ preserveExtensions: true }),
347
+ !isDev &&
348
+ terser({
349
+ format: { comments: false },
350
+ }),
351
+
352
+ copy({
353
+ targets: [
354
+ {
355
+ src: [
356
+ 'src/assets/fonts/icomoon.woff',
357
+ 'src/assets/fonts/icomoon.ttf',
358
+ 'src/assets/fonts/icomoon.svg',
359
+ 'src/assets/fonts/icomoon.eot',
360
+ ],
361
+ dest: 'fonts',
362
+ },
363
+ ],
364
+ }),
365
+ ].filter(Boolean),
304
366
  };
305
367
 
306
368
  // ============================================================================
@@ -322,7 +384,8 @@ const configs = [
322
384
  // - Cần customize components qua custom layout overrides
323
385
  // - Muốn kiểm soát React version
324
386
  {
325
- input: './src/index.ts',
387
+ input: './src/index.ts', // ⭐ IMPORTANT: Do NOT bundle react / react-dom
388
+ external: ['react', 'react-dom', 'react/jsx-runtime'],
326
389
  output: {
327
390
  file: 'dist/index.js',
328
391
  format: 'esm',
@@ -1,19 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(find:*)",
5
- "Bash(npm run build:*)",
6
- "Bash(grep:*)",
7
- "Bash(rm:*)",
8
- "Bash(ls:*)",
9
- "Bash(sed:*)",
10
- "Bash(yarn build)",
11
- "Bash(yalc push:*)",
12
- "Bash(yarn dev)",
13
- "Bash(yarn list:*)",
14
- "Bash(mv:*)",
15
- "Bash(rg:*)"
16
- ],
17
- "deny": []
18
- }
19
- }
@@ -1,21 +0,0 @@
1
- import React, { ReactNode, ComponentType } from 'react';
2
- import { SwizzleConfig, SwizzlePath } from '../types/swizzle';
3
- type SwizzleContextType = {
4
- swizzle: SwizzleConfig;
5
- getSwizzledComponent: <T = unknown>(path: SwizzlePath, defaultComponent: ComponentType<T>) => ComponentType<T>;
6
- };
7
- /**
8
- * Hook để access swizzle configuration
9
- */
10
- export declare const useSwizzle: () => SwizzleContextType;
11
- type Props = {
12
- swizzle?: SwizzleConfig;
13
- children: ReactNode;
14
- };
15
- /**
16
- * SwizzleProvider - Wrap app với provider này để enable component swizzling
17
- * Giống như Docusaurus swizzle pattern
18
- */
19
- export declare const SwizzleProvider: React.FC<Props>;
20
- export {};
21
- //# sourceMappingURL=SwizzleContext.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SwizzleContext.d.ts","sourceRoot":"","sources":["../../src/context/SwizzleContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAGZ,SAAS,EACT,aAAa,EAGd,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAQ9D,KAAK,kBAAkB,GAAG;IACxB,OAAO,EAAE,aAAa,CAAC;IACvB,oBAAoB,EAAE,CAAC,CAAC,GAAG,OAAO,EAChC,IAAI,EAAE,WAAW,EACjB,gBAAgB,EAAE,aAAa,CAAC,CAAC,CAAC,KAC/B,aAAa,CAAC,CAAC,CAAC,CAAC;CACvB,CAAC;AAOF;;GAEG;AACH,eAAO,MAAM,UAAU,0BAAmC,CAAC;AAE3D,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAkG3C,CAAC"}