@osfarm/itineraire-technique 1.2.0 → 1.2.2
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/.github/copilot-instructions.md +56 -0
- package/.github/workflows/publish.yml +34 -0
- package/README.md +2 -34
- package/css/styles-editor.css +1 -1
- package/css/styles-editor.css.map +1 -1
- package/editor.html +38 -748
- package/js/chart-render.js +16 -11
- package/js/editor-interventions.js +315 -189
- package/js/editor-loader-default.js +238 -0
- package/js/editor-loader-itinera.js +161 -0
- package/js/{editor-wiki-editor.js → editor-loader-wiki.js} +100 -12
- package/js/editor-main.js +752 -0
- package/js/intervention.js +12 -0
- package/js/step-model.js +69 -0
- package/package.json +6 -59
- package/scss/styles-editor.scss +145 -0
- package/scss/styles-rendering.scss +184 -0
- package/examples/README.md +0 -137
- package/examples/nextjs-_document.tsx +0 -66
- package/examples/nextjs-api-route.ts +0 -122
- package/examples/nextjs-app-router-editor.tsx +0 -304
- package/examples/nextjs-app-router-viewer.tsx +0 -90
- package/js/editor-attributes.js +0 -99
- package/js/editor-crops.js +0 -136
- package/js/editor-export.js +0 -118
- package/react/QUICKSTART.md +0 -172
- package/react/README.md +0 -305
- package/react/TikaEditor.jsx +0 -212
- package/react/TikaRenderer.jsx +0 -116
- package/react/hooks.ts +0 -217
- package/react/index.ts +0 -19
- package/react/types.ts +0 -152
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Copilot Instructions for TIKA Itineraire Technique
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
This project visualizes agricultural technical itineraries (sequences of interventions on a plot) for analysis and documentation. It provides both a visualizer and an editor, designed for easy integration into web pages and use on Triple Performance.
|
|
5
|
+
|
|
6
|
+
## Architecture & Key Components
|
|
7
|
+
- **HTML files**: Main entry points (`visualisateur.html`, `editor.html`, etc.)
|
|
8
|
+
- **JS directory**: Core logic for rendering charts, editing, exporting, and managing interventions. Key files:
|
|
9
|
+
- `chart-render.js`: Main chart rendering logic (frise and rotation views)
|
|
10
|
+
- `editor-attributes.js`, `editor-crops.js`, `editor-export.js`, `editor-interventions.js`, `editor-wiki-editor.js`: Editor and data manipulation modules
|
|
11
|
+
- **CSS/SCSS**: Styling for both editor and rendering views
|
|
12
|
+
- **test/**: Contains example JSON data and templates for validation and development
|
|
13
|
+
|
|
14
|
+
## Data Flow & Integration
|
|
15
|
+
- Input data is provided as JSON, following the format in `test/test.json` and `test.after.json`
|
|
16
|
+
- Rendering is performed by instantiating `RotationRenderer` with a target div and JSON data
|
|
17
|
+
- External dependencies: Apache Echarts, JQuery, Bootstrap, Underscore (included via CDN in HTML)
|
|
18
|
+
|
|
19
|
+
## Developer Workflows
|
|
20
|
+
- **Build**: No complex build system; use npm to install and copy files as needed
|
|
21
|
+
- Example: `npm i @osfarm/itineraire-technique`
|
|
22
|
+
- Copy JS/CSS from `node_modules` to local `js/` and `css/` folders
|
|
23
|
+
- **Testing**: Use the sample JSON files in `test/` for manual validation; no automated test runner
|
|
24
|
+
- **Debugging**: Open HTML files in browser, use browser dev tools; inspect JSON format and rendering
|
|
25
|
+
|
|
26
|
+
## Project-Specific Conventions
|
|
27
|
+
- All rendering logic expects a specific JSON schema (see `test/test.json`)
|
|
28
|
+
- Editor modules are split by concern (attributes, crops, interventions, etc.)
|
|
29
|
+
- No framework; vanilla JS modules and direct DOM manipulation
|
|
30
|
+
- CSS/SCSS files are mapped 1:1 to editor and rendering views
|
|
31
|
+
|
|
32
|
+
## Integration Points
|
|
33
|
+
- Designed for easy embedding in any HTML page
|
|
34
|
+
- Used on Triple Performance and Google Spreadsheet add-on
|
|
35
|
+
- Can be extended by adding new JS modules or updating JSON schema
|
|
36
|
+
|
|
37
|
+
## Example Usage
|
|
38
|
+
```js
|
|
39
|
+
let renderer = new RotationRenderer('uneDIVID', jsonData);
|
|
40
|
+
renderer.render();
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Key Files & Directories
|
|
44
|
+
- `js/chart-render.js`: Main chart logic
|
|
45
|
+
- `test/test.json`: Example data format
|
|
46
|
+
- `editor.html`, `visualisateur.html`: Entry points
|
|
47
|
+
- `css/styles-rendering.css`, `css/styles-editor.css`: Styling
|
|
48
|
+
|
|
49
|
+
## Tips for AI Agents
|
|
50
|
+
- Always validate JSON input against `test/test.json`
|
|
51
|
+
- When adding features, follow the modular JS file structure
|
|
52
|
+
- Reference CDN links for dependencies in HTML
|
|
53
|
+
- Prefer direct DOM manipulation and vanilla JS patterns
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
For questions about unclear conventions or missing documentation, ask the user for clarification or examples from their workflow.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Publish to npmjs
|
|
2
|
+
|
|
3
|
+
permissions:
|
|
4
|
+
contents: read
|
|
5
|
+
id-token: write
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches:
|
|
10
|
+
- main
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
publish:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Set up Node.js
|
|
20
|
+
uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: '24'
|
|
23
|
+
registry-url: 'https://registry.npmjs.org/'
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: npm install
|
|
27
|
+
|
|
28
|
+
- name: Build (if needed)
|
|
29
|
+
run: npm run build
|
|
30
|
+
continue-on-error: true
|
|
31
|
+
|
|
32
|
+
- name: Publish to npmjs
|
|
33
|
+
run: npm publish --provenance --access public
|
|
34
|
+
|
package/README.md
CHANGED
|
@@ -24,42 +24,10 @@ Le visualisateur est fourni avec un éditeur qui permet de créer son propre iti
|
|
|
24
24
|
Ce visualisateur est avant tout conçu pour être utilisé sur [Triple Performance](https://wiki.tripleperformance.fr/). Vous y trouverez de [nombreux](https://wiki.tripleperformance.fr/wiki/Retours_d%27exp%C3%A9rience) [retours d'expérience](https://wiki.tripleperformance.fr/wiki/Ferme_de_Longueil) documentés avec des données technico-économiques ainsi que les itinéraires techniques associés. Les itinéraires peuvent être créés alors directement dans [Google Spreadsheet](https://wiki.tripleperformance.fr/wiki/Aide:Ins%C3%A9rer_des_graphiques_dans_une_page) grâce à l'[add-on](https://workspace.google.com/marketplace/app/triple_performance/427792115089) spécifiquement conçu pour Google Workspace.
|
|
25
25
|
|
|
26
26
|
## Utilisation dans un autre contexte / logiciel
|
|
27
|
-
|
|
28
27
|
Il est possible d'utiliser cette librairie très facilement dans n'importe quel outil. Le visualisateur a été conçu pour être très facile à intégrer dans une page HTML, il ne dépend que de briques Javascript (Apache Echarts, JQuery et Bootstrap). N'hésitez pas à nous contacter si vous décidez de l'utiliser et à contribuer si vous faites des évolutions !
|
|
29
|
-
|
|
30
|
-
### 🆕 Composants React/Next.js
|
|
31
|
-
|
|
32
|
-
**Nouveauté version 1.2.0** : Le projet inclut désormais des composants React/Next.js prêts à l'emploi !
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
npm i @osfarm/itineraire-technique
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
**Utilisation rapide avec React/Next.js :**
|
|
39
|
-
|
|
40
|
-
```tsx
|
|
41
|
-
import { TikaRenderer } from '@osfarm/itineraire-technique/react';
|
|
42
|
-
|
|
43
|
-
function MyComponent() {
|
|
44
|
-
const data = { /* vos données JSON */ };
|
|
45
|
-
return <TikaRenderer data={data} />;
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
**📚 [Documentation complète React/Next.js](react/README.md)**
|
|
50
|
-
|
|
51
|
-
Consultez le guide complet avec :
|
|
52
|
-
- Composants `TikaRenderer` et `TikaEditor`
|
|
53
|
-
- Hooks personnalisés (`useItineraire`, etc.)
|
|
54
|
-
- Types TypeScript
|
|
55
|
-
- Exemples Next.js App Router et Pages Router
|
|
56
|
-
- Configuration et intégration
|
|
57
|
-
|
|
58
|
-
**🔗 [Exemples d'intégration](examples/)**
|
|
59
|
-
|
|
60
|
-
### Utilisation vanilla JS/HTML
|
|
61
28
|
|
|
62
|
-
|
|
29
|
+
|
|
30
|
+
Pour utiliser le package, le plus simple est d'utiliser npm :
|
|
63
31
|
|
|
64
32
|
```
|
|
65
33
|
npm i @osfarm/itineraire-technique
|
package/css/styles-editor.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.main-header{background-color:#6fa76f;color:#fff;height:3rem;display:flex;align-items:center}.main-header .btn.show,.main-header .btn:first-child:active,.main-header :not(.btn-check)+.btn:active{background-color:#026602}.editor-view{overflow-y:auto;height:calc(100vh - 4rem)}.rotation_item .step-edit{color:#878787;cursor:pointer;display:none;margin-left:10px;font-size:70%;vertical-align:super}.rotation_item:hover .step-edit{display:inline !important}.welcome-view{background-color:#6fa76f;color:#fff;padding:1rem;margin-top:1rem;border-radius:1rem}.welcome-view #cropsContainer{color:green}.card-white{background-color:#fff;padding:1rem;border-radius:1rem}.card-holder{background-color:#f5f5f5;padding:1rem;border-radius:1rem;margin:auto}.editable-row{background-color:#f7f7f7;min-height:3rem;display:flex;align-items:center;border-radius:.5rem}.editable-row .edit-buttons{visibility:hidden}.editable-row:hover>.edit-buttons{visibility:visible}.intervention-row{background:#e0e0e0}.primary-button{color:#fff;background-color:green;border:green}.primary-button:hover{background-color:#026602}.close-step-times{background:none;border:none;color:#878787;font-size:120%}.close-step-times:hover{color:#494949}#cropsContainer .drag-handle{color:#ccc;font-weight:normal;font-size:86%;margin-right:10px;vertical-align:middle;cursor:grab}#cropsContainer div.col{cursor:pointer}.form-control.text-right{text-align:right}.modal .form-label{font-weight:600}#code-snippet{font-family:monospace;font-size:13px;text-align:left;border:1px inset;background-color:#f1f1f1}
|
|
1
|
+
.main-header{background-color:#6fa76f;color:#fff;height:3rem;display:flex;align-items:center}.main-header .btn.show,.main-header .btn:first-child:active,.main-header :not(.btn-check)+.btn:active{background-color:#026602}.editor-view{overflow-y:auto;height:calc(100vh - 4rem)}.rotation_item .step-edit{color:#878787;cursor:pointer;display:none;margin-left:10px;font-size:70%;vertical-align:super}.rotation_item:hover .step-edit{display:inline !important}.welcome-view{background-color:#6fa76f;color:#fff;padding:1rem;margin-top:1rem;border-radius:1rem}.welcome-view #cropsContainer{color:green}.card-white{background-color:#fff;padding:1rem;border-radius:1rem}.card-holder{background-color:#f5f5f5;padding:1rem;border-radius:1rem;margin:auto}.editable-row{background-color:#f7f7f7;min-height:3rem;display:flex;align-items:center;border-radius:.5rem}.editable-row .edit-buttons{visibility:hidden}.editable-row:hover>.edit-buttons{visibility:visible}.intervention-row{background:#e0e0e0}.primary-button{color:#fff;background-color:green;border:green}.primary-button:hover{background-color:#026602}.close-step-times{background:none;border:none;color:#878787;font-size:120%}.close-step-times:hover{color:#494949}#cropsContainer .drag-handle{color:#ccc;font-weight:normal;font-size:86%;margin-right:10px;vertical-align:middle;cursor:grab}#cropsContainer div.col{cursor:pointer}.form-control.text-right{text-align:right}.modal .form-label{font-weight:600}#code-snippet{font-family:monospace;font-size:13px;text-align:left;border:1px inset;background-color:#f1f1f1}/*# sourceMappingURL=styles-editor.css.map */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../scss/styles-editor.scss"],"names":[],"mappings":"AAKA,aACI,yBACA,WACA,OALiB,KAOjB,aACA,mBAEA,sGAGI,yBAIR,aACI,gBAGA,0BAKA,0BACI,cACA,eACA,aACA,iBACA,cACA,qBAGJ,gCACI,0BAIR,cACI,yBACA,WACA,aACA,gBACA,mBAEA,8BACI,YAIR,YACI,sBACA,aACA,mBAGJ,aACI,yBACA,aACA,mBACA,YAGJ,cACI,yBACA,gBAEA,aACA,mBAEA,oBAEA,4BACI,kBAGJ,kCACI,mBAIR,kBACI,mBAGJ,gBACI,MAzFiB,KA0FjB,iBA5FiB,MA6FjB,OA7FiB,MA+FjB,sBACI,iBA/Fa,QAmGrB,kBACI,gBACA,YACA,cACA,eAEA,wBACI,cAKJ,6BACI,WACA,mBACA,cACA,kBACA,sBACA,YAGJ,wBACI,eAKJ,yBACI,iBAKJ,mBACI,gBAIR,cACI,sBACA,eACA,gBACA,iBACA
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../scss/styles-editor.scss"],"names":[],"mappings":"AAKA,aACI,yBACA,WACA,OALiB,KAOjB,aACA,mBAEA,sGAGI,yBAIR,aACI,gBAGA,0BAKA,0BACI,cACA,eACA,aACA,iBACA,cACA,qBAGJ,gCACI,0BAIR,cACI,yBACA,WACA,aACA,gBACA,mBAEA,8BACI,YAIR,YACI,sBACA,aACA,mBAGJ,aACI,yBACA,aACA,mBACA,YAGJ,cACI,yBACA,gBAEA,aACA,mBAEA,oBAEA,4BACI,kBAGJ,kCACI,mBAIR,kBACI,mBAGJ,gBACI,MAzFiB,KA0FjB,iBA5FiB,MA6FjB,OA7FiB,MA+FjB,sBACI,iBA/Fa,QAmGrB,kBACI,gBACA,YACA,cACA,eAEA,wBACI,cAKJ,6BACI,WACA,mBACA,cACA,kBACA,sBACA,YAGJ,wBACI,eAKJ,yBACI,iBAKJ,mBACI,gBAIR,cACI,sBACA,eACA,gBACA,iBACA","file":"styles-editor.css"}
|