@elementor/elementor-one-assets 0.3.11 → 0.4.5

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/README.md CHANGED
@@ -5,155 +5,67 @@ A publishable npm package containing shared UI components and utilities for Elem
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install @elementor/elementor-one-assets
9
- ```
10
-
11
- ### Required Dependencies
12
-
13
- ```bash
14
- npm install react react-dom @elementor/ui @elementor/icons
15
- ```
16
-
17
- ### Optional Dependencies
18
-
19
- Install based on features you use:
20
-
21
- | Dependency | Required for |
22
- | ---------------------------------- | ------------------------------------------ |
23
- | `react-redux` + `@reduxjs/toolkit` | Redux state management |
24
- | `react-router-dom` | Routing features |
25
- | `axios` | HTTP requests |
26
- | `react-hook-form` | Form components (e.g., SendFeedbackDialog) |
27
-
28
- ```bash
29
- # Example: Install all optional deps
30
- npm install react-redux @reduxjs/toolkit react-router-dom axios react-hook-form
8
+ npm install @elementor/elementor-one-assets --legacy-peer-dependencies
31
9
  ```
32
10
 
33
11
  ---
34
12
 
35
- ## Quick Start (Development)
36
-
37
- ```bash
38
- # Build the package
39
- npx nx build elementor-one-assets
40
-
41
- # Run tests
42
- npx nx test elementor-one-assets
43
-
44
- # Lint
45
- npx nx lint elementor-one-assets
46
-
47
- #Test build
48
- npx nx test-build elementor-one-assets
49
- ```
50
-
51
- ---
52
-
53
- ## Local Development
54
-
55
- > **Note:** This local development workflow only works within the **elementor-acd-workspace** monorepo. For external projects, you must install the published package from npm.
56
-
57
- Local development is designed for **instant hot reload** without any build steps. You just need to install the package:
58
-
59
- ```bash
60
- npm install ./dist/packages/elementor-one-assets
61
- ```
62
-
63
- ### How It Works
13
+ ## Usage
64
14
 
65
- When running locally (`NX_PUBLIC_LOCAL=true`), rspack resolves imports from `@elementor/elementor-one-assets` directly to the **source files** instead of `node_modules`. This means:
15
+ ### ElementorOneAssetsProvider
66
16
 
67
- - **No build step required** - just edit and save
68
- - ✅ **True hot module replacement** - changes appear instantly
69
- - ✅ **Same experience as workspace libs** - feels like editing any other library
17
+ The `ElementorOneAssetsProvider` is a context provider that initializes the package's core functionality. It should wrap your application or the components that use this package.
70
18
 
71
- This works via a **path alias** in `global.rspack.config.ts`:
19
+ **Basic Example:**
72
20
 
73
- ```ts
74
- resolve: {
75
- alias: isLocalDev
76
- ? { '@elementor/elementor-one-assets': packageSourcePath }
77
- : {},
78
- },
79
- ```
80
-
81
- This code is commented out since we want to use the published version. When working on the package itself uncomment this part.
82
-
83
- ## Testing the Built Package
84
-
85
- Before publishing, verify that the rollup-bundled package works correctly.
86
-
87
- ### Why Test the Build?
88
-
89
- Local development uses **rspack** to compile source files directly, but the published package uses **rollup**. Testing ensures both produce the same result.
90
-
91
- ### Quick Build Test
21
+ ```tsx
22
+ import { ElementorOneAssetsProvider, Environment } from '@elementor/elementor-one-assets';
92
23
 
93
- ```bash
94
- npx nx test-build elementor-one-assets
24
+ function App() {
25
+ return <ElementorOneAssetsProvider env={'staging' as Environment}>{/* Your app components */}</ElementorOneAssetsProvider>;
26
+ }
95
27
  ```
96
28
 
97
- This will:
98
-
99
- 1. Build the package with rollup
100
- 2. Verify the bundle loads correctly
101
- 3. Print the exported modules
29
+ **Props:**
102
30
 
103
- ### Full Integration Test
31
+ | Prop | Type | Required | Default | Description |
32
+ | ---------- | ------------------------------------------------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
33
+ | `env` | `'local' \| 'development' \| 'staging' \| 'production'` | Yes | - | Environment configuration for API endpoints and other environment-specific settings. **Note:** The `'local'` environment uses staging API endpoints (`my.stg.elementor.red`) |
34
+ | `language` | `string` | No | `'en'` | Language code for i18n (e.g., 'en', 'es', 'fr', 'de', 'he-IL') |
104
35
 
105
- To test the actual installed package (from `node_modules`) in a running app:
36
+ **Features:**
106
37
 
107
- **Step 1:** Comment out the alias in `global.rspack.config.ts`
38
+ - Initializes i18n with the specified language
39
+ - Configures HTTP client with environment settings
40
+ - Provides environment configuration via context (`ElementorOneAssetsContext`)
41
+ - Applies scoped styles for package components
108
42
 
109
- ```ts
110
- resolve: {
111
- // Temporarily comment out for testing
112
- // alias: isLocalDev
113
- // ? { '@elementor/elementor-one-assets': packageSourcePath }
114
- // : {},
115
- },
116
- ```
43
+ ---
117
44
 
118
- **Step 2:** If testing unpublished changes, build and install from dist
45
+ ### ElementorOneHeader
119
46
 
120
- ```bash
121
- # Build the package
122
- npx nx build elementor-one-assets
47
+ The `ElementorOneHeader` component provides a standardized header for Elementor One applications with logo, title, help link, feedback dialog, and user info.
123
48
 
124
- # Install from local dist
125
- npm install ./dist/packages/elementor-one-assets
126
- ```
49
+ **Basic Example:**
127
50
 
128
- **Step 3:** Run and test the app
51
+ ```tsx
52
+ import { ElementorOneHeader } from '@elementor/elementor-one-assets';
129
53
 
130
- ```bash
131
- npx nx serve acd-client:locally
54
+ function App() {
55
+ return (
56
+ <>
57
+ <ElementorOneHeader appSettings={{ slug: 'elementor-pro', version: '1.0.0' }} />
58
+ {/* Rest of your app */}
59
+ </>
60
+ );
61
+ }
132
62
  ```
133
63
 
134
- **Step 4:** After testing, revert your changes
135
-
136
- 1. Uncomment the alias in `global.rspack.config.ts`
137
- 2. Revert `package.json` and `package-lock.json`:
138
-
139
- ### Checklist Before Publishing
140
-
141
- - [ ] `npx nx lint elementor-one-assets` passes
142
- - [ ] `npx nx test elementor-one-assets` passes
143
- - [ ] `npx nx test-build elementor-one-assets` passes
144
- - [ ] Tested installed version from dist
145
- - [ ] Version bumped appropriately
146
-
147
- ---
148
-
149
- ## Publishing
150
-
151
- ```bash
152
- # Dry run first
153
- npx nx release --group=elementor-one-assets --dry-run
154
-
155
- # Release (patch/minor/major)
156
- npx nx release --group=elementor-one-assets patch
157
- ```
64
+ **Props:**
158
65
 
159
- ---
66
+ | Prop | Type | Required | Default | Description |
67
+ | ----------------- | ---------------- | -------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
68
+ | `appSettings` | `AppSettings` | Yes | - | Application settings object containing `slug` and `version`. Supported slug values: `'elementor'`, `'elementor-pro'`, `'pojo-accessibility'`, `'image-optimization'`, `'site-mailer'`, `'angie'` |
69
+ | `title` | `string` | No | - | Custom title to display next to the logo. If not provided, uses the default translated title from i18n |
70
+ | `isWithinWpAdmin` | `boolean` | No | `true` | When `true`, adjusts the header positioning and drawer behavior for WordPress admin context |
71
+ | `containerSx` | `SxProps<Theme>` | No | `{}` | MUI `sx` prop for custom styling of the AppBar container. Useful for positioning |