gwchq-textjam 0.1.73 → 0.1.74

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
@@ -54,20 +54,23 @@ The dev playground (`webpack.config.js`) keeps styles in JavaScript via `style-l
54
54
  **Refactor Global Styles**: When working on existing code, identify global styles and refactor them into CSS Modules when possible. This improves maintainability, reduces style conflicts, and makes components more self-contained.
55
55
 
56
56
  **CSS Modules Structure**:
57
+
57
58
  - Component-specific styles should live in `ComponentName/styles.module.scss` alongside the component
58
59
  - Import styles as: `import classes from './styles.module.scss'`
59
60
  - Use class names from the imported styles object: `className={classes.container}`
60
61
  - Webpack automatically generates scoped class names like `ComponentName__container--abc123`
61
62
 
62
63
  **When Global Styles Are Acceptable**:
64
+
63
65
  - Design system tokens and variables (e.g., color palettes, spacing scales)
64
66
  - Third-party library overrides that cannot be modularized
65
67
  - Base resets or typography that must apply globally
66
68
 
67
69
  **Example - Preferred CSS Modules Approach**:
70
+
68
71
  ```jsx
69
72
  // ComponentName/ComponentName.jsx
70
- import classes from './styles.module.scss';
73
+ import classes from "./styles.module.scss";
71
74
 
72
75
  export function ComponentName() {
73
76
  return <div className={classes.container}>Content</div>;
@@ -91,6 +94,7 @@ Automated unit tests can be run via the `yarn test` command. These unit tests ar
91
94
  ### Prerequisites
92
95
 
93
96
  1. Ensure you're logged into npm:
97
+
94
98
  ```bash
95
99
  npm login
96
100
  ```
@@ -105,25 +109,30 @@ Automated unit tests can be run via the `yarn test` command. These unit tests ar
105
109
  - Patch: `0.1.2` → `0.1.3` (bug fixes)
106
110
  - Minor: `0.1.2` → `0.2.0` (new features, backwards compatible)
107
111
  - Major: `0.1.2` → `1.0.0` (breaking changes)
108
-
109
112
  2. **Build the library** (automatically runs via `prepublishOnly` hook):
113
+
110
114
  ```bash
111
115
  yarn build:lib
112
116
  ```
117
+
113
118
  This creates the `dist` folder with:
119
+
114
120
  - `index.js` - The main ESM module
115
121
  - `style.css` - Extracted stylesheet
116
122
  - `assets/` - Static assets (icons, fonts, etc.)
117
123
 
118
124
  3. **Verify the build output**:
125
+
119
126
  - Check that `dist/index.js` exists and is properly built
120
127
  - Verify `dist/style.css` contains all styles
121
128
  - Ensure all required assets are in `dist/assets/`
122
129
 
123
130
  4. **Publish to npm**:
131
+
124
132
  ```bash
125
133
  npm publish
126
134
  ```
135
+
127
136
  The `prepublishOnly` script will automatically run `yarn build:lib` before publishing.
128
137
 
129
138
  5. **Verify publication**:
@@ -134,6 +143,7 @@ Automated unit tests can be run via the `yarn test` command. These unit tests ar
134
143
  ### What Gets Published
135
144
 
136
145
  The following files are included in the npm package (as defined in `package.json` → `files`):
146
+
137
147
  - `dist/` - Built library files
138
148
  - `README.md` - This file
139
149
  - `LICENSE` - License file
@@ -141,6 +151,7 @@ The following files are included in the npm package (as defined in `package.json
141
151
  ### Package Exports
142
152
 
143
153
  Consumers can import:
154
+
144
155
  - Main component: `import { TextJamEditor } from "gwchq-textjam"`
145
156
  - Stylesheet: `import "gwchq-textjam/style.css"`
146
157
 
@@ -150,7 +161,7 @@ The editor can be imported and rendered directly inside another React applicatio
150
161
 
151
162
  ```tsx
152
163
  import { TextJamEditor } from "gwchq-textjam";
153
- import "gwchq-textjam/style.css"
164
+ import "gwchq-textjam/style.css";
154
165
 
155
166
  export function EditorWrapper() {
156
167
  return (
@@ -162,6 +173,7 @@ export function EditorWrapper() {
162
173
  ```
163
174
 
164
175
  The consumer's webpack config should include the following setups
176
+
165
177
  ```
166
178
  {
167
179
  ...,
@@ -217,9 +229,14 @@ The consumer's webpack config should include the following setups
217
229
  - `project`: an object with the project data. Contains the following props:
218
230
  - `project_type`: Possible values `web` | `python`. Default project files will be created according to this value
219
231
  - `identifier`: A string that represents the project id. If provided, cached project with same id will be loaded
220
- - `packageApiUrl`: A string with url to download pyodide packages. If not provided - default value is pyodide CDN.
232
+ - `author`: an object with owner user data (firstName, lastName, id)
233
+ - `components`: an array of project components (files and folders)
234
+ - `packageApiUrl`: A string with url to download pyodide packages. If not provided - default value is pyodide CDN.
235
+ - `isSharedProject`: a boolean to show a shared project interface instead the regular editor if `true` (`false` by default)
236
+ - `isCodeVisible`: a boolean to show or hide the code panel (`true` by default)
221
237
 
222
238
  // TODO: review old options below
239
+
223
240
  - `loadCache`: Load latest version of project code from local storage (defaults to `true`)
224
241
  - `locale`: Locale for UI elements and to determine the language of projects loaded from the API (defaults to `en`)
225
242
  - `outputOnly`: Only display the output panel (defaults to `false`)
@@ -248,4 +265,3 @@ For backwards compatibility the editor continues to dispatch the following `docu
248
265
  - `editor-themeUpdated`
249
266
 
250
267
  These events make it possible for the host page to react to code execution, project changes, authentication requests, and theme updates.
251
-