imio.omnia.tinymce 1.0__py3-none-any.whl

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 (90) hide show
  1. imio/omnia/tinymce/__init__.py +6 -0
  2. imio/omnia/tinymce/browser/__init__.py +0 -0
  3. imio/omnia/tinymce/browser/action.py +6 -0
  4. imio/omnia/tinymce/browser/configure.zcml +40 -0
  5. imio/omnia/tinymce/browser/controlpanel.py +93 -0
  6. imio/omnia/tinymce/browser/npm/package-lock.json +125 -0
  7. imio/omnia/tinymce/browser/npm/package.json +8 -0
  8. imio/omnia/tinymce/browser/overrides/.gitkeep +0 -0
  9. imio/omnia/tinymce/browser/resources/.env.example +13 -0
  10. imio/omnia/tinymce/browser/resources/.git +1 -0
  11. imio/omnia/tinymce/browser/resources/.gitignore +26 -0
  12. imio/omnia/tinymce/browser/resources/.gitlab-ci.yml +77 -0
  13. imio/omnia/tinymce/browser/resources/.storybook/main.js +124 -0
  14. imio/omnia/tinymce/browser/resources/.storybook/preview.js +8 -0
  15. imio/omnia/tinymce/browser/resources/CHANGELOG.md +19 -0
  16. imio/omnia/tinymce/browser/resources/CLAUDE.md +62 -0
  17. imio/omnia/tinymce/browser/resources/Makefile +28 -0
  18. imio/omnia/tinymce/browser/resources/README.md +327 -0
  19. imio/omnia/tinymce/browser/resources/dev/index.html +41 -0
  20. imio/omnia/tinymce/browser/resources/dev/vite.config.js +78 -0
  21. imio/omnia/tinymce/browser/resources/docs/images/example1.png +0 -0
  22. imio/omnia/tinymce/browser/resources/eslint.config.js +36 -0
  23. imio/omnia/tinymce/browser/resources/package-lock.json +4913 -0
  24. imio/omnia/tinymce/browser/resources/package.json +61 -0
  25. imio/omnia/tinymce/browser/resources/src/assets/ia-icon.svg +5 -0
  26. imio/omnia/tinymce/browser/resources/src/assets/omnia-icon.svg +10 -0
  27. imio/omnia/tinymce/browser/resources/src/client.js +239 -0
  28. imio/omnia/tinymce/browser/resources/src/config.js +220 -0
  29. imio/omnia/tinymce/browser/resources/src/plugin.js +158 -0
  30. imio/omnia/tinymce/browser/resources/src/shortcuts.js +92 -0
  31. imio/omnia/tinymce/browser/resources/src/ui/App.jsx +75 -0
  32. imio/omnia/tinymce/browser/resources/src/ui/FloatingPanel.jsx +375 -0
  33. imio/omnia/tinymce/browser/resources/src/ui/PanelHeader.jsx +15 -0
  34. imio/omnia/tinymce/browser/resources/src/ui/SidePanel.jsx +284 -0
  35. imio/omnia/tinymce/browser/resources/src/ui/StreamingText.jsx +143 -0
  36. imio/omnia/tinymce/browser/resources/src/ui/components.jsx +70 -0
  37. imio/omnia/tinymce/browser/resources/src/ui/mount.jsx +35 -0
  38. imio/omnia/tinymce/browser/resources/src/ui/omnia.css +35 -0
  39. imio/omnia/tinymce/browser/resources/src/utils.js +56 -0
  40. imio/omnia/tinymce/browser/resources/stories/FloatingPanel.stories.jsx +66 -0
  41. imio/omnia/tinymce/browser/resources/stories/SidePanel.stories.jsx +31 -0
  42. imio/omnia/tinymce/browser/resources/stories/StreamingText.stories.jsx +85 -0
  43. imio/omnia/tinymce/browser/resources/stories/TinyMCEEditor.stories.js +228 -0
  44. imio/omnia/tinymce/browser/resources/stories/TypingDots.stories.jsx +31 -0
  45. imio/omnia/tinymce/browser/resources/stories/mocks/editor.js +66 -0
  46. imio/omnia/tinymce/browser/resources/stories/mocks/omnia-client.js +99 -0
  47. imio/omnia/tinymce/browser/resources/stories/presets/accessibilite-reglement.html +49 -0
  48. imio/omnia/tinymce/browser/resources/stories/presets/ameliorer-communication.html +36 -0
  49. imio/omnia/tinymce/browser/resources/stories/presets/corriger-bulletin.html +186 -0
  50. imio/omnia/tinymce/browser/resources/stories/presets/long-cdld.html +12389 -0
  51. imio/omnia/tinymce/browser/resources/stories/presets/reduire-deliberation.html +87 -0
  52. imio/omnia/tinymce/browser/resources/stories/presets/traduire-guide.html +234 -0
  53. imio/omnia/tinymce/browser/resources/vite.config.js +27 -0
  54. imio/omnia/tinymce/browser/static/omnia-tinymce.css +1 -0
  55. imio/omnia/tinymce/browser/static/omnia-tinymce.js +22 -0
  56. imio/omnia/tinymce/browser/templates/omnia_config.pt +10 -0
  57. imio/omnia/tinymce/browser/viewlets.py +57 -0
  58. imio/omnia/tinymce/configure.zcml +42 -0
  59. imio/omnia/tinymce/interfaces.py +7 -0
  60. imio/omnia/tinymce/locales/README.rst +37 -0
  61. imio/omnia/tinymce/locales/__init__.py +0 -0
  62. imio/omnia/tinymce/locales/en/LC_MESSAGES/imio.omnia.tinymce.po +83 -0
  63. imio/omnia/tinymce/locales/fr/LC_MESSAGES/imio.omnia.tinymce.po +83 -0
  64. imio/omnia/tinymce/locales/imio.omnia.tinymce.pot +86 -0
  65. imio/omnia/tinymce/locales/update.py +74 -0
  66. imio/omnia/tinymce/locales/update.sh +12 -0
  67. imio/omnia/tinymce/permissions.zcml +10 -0
  68. imio/omnia/tinymce/profiles/default/actions.xml +13 -0
  69. imio/omnia/tinymce/profiles/default/browserlayer.xml +7 -0
  70. imio/omnia/tinymce/profiles/default/catalog.xml +4 -0
  71. imio/omnia/tinymce/profiles/default/metadata.xml +7 -0
  72. imio/omnia/tinymce/profiles/default/registry/main.xml +35 -0
  73. imio/omnia/tinymce/profiles/default/rolemap.xml +7 -0
  74. imio/omnia/tinymce/profiles/uninstall/browserlayer.xml +7 -0
  75. imio/omnia/tinymce/setuphandlers.py +45 -0
  76. imio/omnia/tinymce/testing.py +48 -0
  77. imio/omnia/tinymce/tests/__init__.py +0 -0
  78. imio/omnia/tinymce/tests/robot/test_example.robot +66 -0
  79. imio/omnia/tinymce/tests/test_robot.py +28 -0
  80. imio/omnia/tinymce/tests/test_setup.py +68 -0
  81. imio/omnia/tinymce/tests/test_viewlet.py +99 -0
  82. imio.omnia.tinymce-1.0-py3.12-nspkg.pth +2 -0
  83. imio_omnia_tinymce-1.0.dist-info/METADATA +294 -0
  84. imio_omnia_tinymce-1.0.dist-info/RECORD +90 -0
  85. imio_omnia_tinymce-1.0.dist-info/WHEEL +5 -0
  86. imio_omnia_tinymce-1.0.dist-info/entry_points.txt +5 -0
  87. imio_omnia_tinymce-1.0.dist-info/licenses/LICENSE.GPL +339 -0
  88. imio_omnia_tinymce-1.0.dist-info/licenses/LICENSE.rst +15 -0
  89. imio_omnia_tinymce-1.0.dist-info/namespace_packages.txt +2 -0
  90. imio_omnia_tinymce-1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,66 @@
1
+ import { render } from 'preact';
2
+ import { FloatingPanel } from '../src/ui/FloatingPanel';
3
+ import { createMockEditor } from './mocks/editor';
4
+ import { createMockOmniaClient } from './mocks/omnia-client';
5
+ import presetReduire from './presets/reduire-deliberation.html?raw';
6
+ import '../src/ui/omnia.css';
7
+
8
+ export default {
9
+ title: 'FloatingPanel',
10
+ argTypes: {
11
+ action: {
12
+ control: 'select',
13
+ options: [null, 'improve-text', 'expand-text', 'reduce-text', 'correct-text', 'make-accessible', 'translate-text'],
14
+ },
15
+ mode: {
16
+ control: 'select',
17
+ options: ['inline', 'blur'],
18
+ },
19
+ floatingPanelWidth: {
20
+ control: 'text',
21
+ description: 'Panel width: a number (px) or "full"',
22
+ },
23
+ mockError: {
24
+ control: 'boolean',
25
+ description: 'Simulate an API error',
26
+ },
27
+ },
28
+ };
29
+
30
+ function renderStory(args) {
31
+ const el = document.createElement('div');
32
+ el.style.width = '600px';
33
+ el.style.height = '400px';
34
+ el.style.position = 'relative';
35
+
36
+ const editor = createMockEditor();
37
+ const client = createMockOmniaClient({ error: args.mockError, response: presetReduire });
38
+
39
+ const width = args.floatingPanelWidth === 'full'
40
+ ? 'full'
41
+ : Number(args.floatingPanelWidth) || undefined;
42
+
43
+ render(
44
+ <FloatingPanel
45
+ editor={editor}
46
+ client={client}
47
+ config={{ floatingPanelWidth: width }}
48
+ mode={args.mode}
49
+ action={args.action}
50
+ onClose={() => console.log('close')}
51
+ onAccept={(text) => console.log('accept:', text)}
52
+ />,
53
+ el,
54
+ );
55
+ return el;
56
+ }
57
+
58
+ export const Default = {
59
+ render: renderStory,
60
+ args: {
61
+ action: 'improve-text',
62
+ mode: 'inline',
63
+ floatingPanelWidth: '600',
64
+ mockError: false,
65
+ },
66
+ };
@@ -0,0 +1,31 @@
1
+ import { render } from 'preact';
2
+ import { SidePanel } from '../src/ui/SidePanel';
3
+ import { createMockEditor } from './mocks/editor';
4
+ import { createMockOmniaClient } from './mocks/omnia-client';
5
+ import '../src/ui/omnia.css';
6
+
7
+ export default {
8
+ title: 'SidePanel',
9
+ parameters: {
10
+ layout: 'fullscreen',
11
+ },
12
+ };
13
+
14
+ function mount(vnode) {
15
+ const el = document.createElement('div');
16
+ el.style.height = '100vh';
17
+ render(vnode, el);
18
+ return el;
19
+ }
20
+
21
+ export const Generate = () => {
22
+ const editor = createMockEditor();
23
+ const client = createMockOmniaClient({
24
+ delay: 50,
25
+ response:
26
+ "Voici un long texte généré qui simule une réponse complète de l'API Omnia. Ce texte contient suffisamment de mots pour montrer le comportement du streaming en temps réel.",
27
+ });
28
+ return mount(
29
+ <SidePanel editor={editor} client={client} visible={true} onClose={() => console.log('close')} />,
30
+ );
31
+ };
@@ -0,0 +1,85 @@
1
+ import { render } from 'preact';
2
+ import { useState } from 'preact/hooks';
3
+ import { StreamingText } from '../src/ui/StreamingText';
4
+ import { createMockOmniaClient } from './mocks/omnia-client';
5
+ import presetReduire from './presets/reduire-deliberation.html?raw';
6
+ import '../src/ui/omnia.css';
7
+
8
+ export default {
9
+ title: 'StreamingText',
10
+ };
11
+
12
+ function mount(vnode) {
13
+ const el = document.createElement('div');
14
+ el.style.width = '700px';
15
+ render(vnode, el);
16
+ return el;
17
+ }
18
+
19
+ function StreamingTextWithState({ mockError, delay = 60, response = presetReduire, errorAfter }) {
20
+ const [status, setStatus] = useState('streaming');
21
+ const [error, setError] = useState(null);
22
+ const [key, setKey] = useState(0);
23
+
24
+ const [client] = useState(() => createMockOmniaClient({ delay, error: mockError, response, errorAfter }));
25
+ const [stream, setStream] = useState(() => client.generate('test'));
26
+
27
+ function replay() {
28
+ setStatus('streaming');
29
+ setError(null);
30
+ setStream(client.generate('test'));
31
+ setKey((k) => k + 1);
32
+ }
33
+
34
+ return (
35
+ <div>
36
+ <StreamingText
37
+ key={key}
38
+ stream={stream}
39
+ status={status}
40
+ error={error}
41
+ onComplete={() => setStatus('done')}
42
+ onError={(err) => {
43
+ setError(err.message);
44
+ setStatus('error');
45
+ }}
46
+ onRetry={replay}
47
+ />
48
+ {status !== 'streaming' && (
49
+ <button
50
+ onClick={replay}
51
+ style={{
52
+ marginTop: '12px',
53
+ padding: '6px 16px',
54
+ fontSize: '13px',
55
+ cursor: 'pointer',
56
+ border: '1px solid #ccc',
57
+ borderRadius: '4px',
58
+ background: '#f5f5f5',
59
+ }}
60
+ >
61
+ ▶ Replay
62
+ </button>
63
+ )}
64
+ </div>
65
+ );
66
+ }
67
+
68
+ export const Streaming = () => mount(<StreamingTextWithState mockError={false} />);
69
+
70
+ export const ErrorDuringStream = () => mount(<StreamingTextWithState mockError={true} errorAfter={37} />);
71
+
72
+ export const Error = () => {
73
+ return mount(
74
+ <StreamingText
75
+ stream={null}
76
+ status="error"
77
+ error="Network error: could not reach Omnia API"
78
+ onRetry={() => alert('Retry clicked')}
79
+ />,
80
+ );
81
+ };
82
+
83
+ export const Idle = () => {
84
+ return mount(<StreamingText stream={null} status="idle" error={null} />);
85
+ };
@@ -0,0 +1,228 @@
1
+ import tinymce from 'tinymce';
2
+ import 'tinymce/models/dom';
3
+ import 'tinymce/themes/silver';
4
+ import 'tinymce/icons/default';
5
+ import 'tinymce/plugins/lists';
6
+ import 'tinymce/plugins/link';
7
+ import 'tinymce/plugins/image';
8
+ import 'tinymce/plugins/table';
9
+ import 'tinymce/plugins/charmap';
10
+ import 'tinymce/plugins/searchreplace';
11
+ import 'tinymce/plugins/fullscreen';
12
+ import 'tinymce/plugins/code';
13
+ import 'tinymce/plugins/wordcount';
14
+ import '../src/plugin.js';
15
+ import { FEATURE_IDS, LANGUAGES } from '../src/config.js';
16
+
17
+ import presetReduire from './presets/reduire-deliberation.html?raw';
18
+ import presetAmeliorer from './presets/ameliorer-communication.html?raw';
19
+ import presetAccessibilite from './presets/accessibilite-reglement.html?raw';
20
+ import presetTraduire from './presets/traduire-guide.html?raw';
21
+ import presetCorriger from './presets/corriger-bulletin.html?raw';
22
+ import presetLong from './presets/long-cdld.html?raw';
23
+
24
+ const PRESETS = {
25
+ empty: '',
26
+ 'reduire': presetReduire,
27
+ 'ameliorer': presetAmeliorer,
28
+ 'accessibilite': presetAccessibilite,
29
+ 'traduire': presetTraduire,
30
+ 'corriger': presetCorriger,
31
+ 'long': presetLong,
32
+ };
33
+
34
+ const PRESET_LABELS = {
35
+ empty: 'Vide',
36
+ 'reduire': 'Réduire — Délibération du Conseil communal',
37
+ 'ameliorer': 'Améliorer — Communication citoyenne',
38
+ 'accessibilite': 'Rendre accessible — Règlement des cimetières',
39
+ 'traduire': 'Traduire — Guide des démarches administratives',
40
+ 'corriger': 'Corriger — Bulletin communal',
41
+ 'long': 'Long — Code de la démocratie locale et de la décentralisation (CDLD)'
42
+ };
43
+
44
+ export default {
45
+ title: 'TinyMCE Editor',
46
+ parameters: {
47
+ layout: 'fullscreen',
48
+ },
49
+ argTypes: {
50
+ preset: {
51
+ control: 'select',
52
+ options: Object.keys(PRESETS),
53
+ labels: PRESET_LABELS,
54
+ description: 'Text preset to load in the editor',
55
+ table: { category: 'Contenu' },
56
+ },
57
+ omnia_base_url: { control: 'text', description: 'Base URL for Omnia API', table: { category: 'Configuration Omnia' } },
58
+ omnia_application: { control: 'text', description: 'Application identifier', table: { category: 'Configuration Omnia' } },
59
+ omnia_municipality: { control: 'text', description: 'Municipality identifier', table: { category: 'Configuration Omnia' } },
60
+ omnia_default_translate_language: {
61
+ control: 'select',
62
+ options: LANGUAGES.map((l) => l.code),
63
+ description: 'Default language',
64
+ table: { category: 'Configuration Omnia' },
65
+ },
66
+ omnia_enabled_features: {
67
+ control: 'check',
68
+ options: FEATURE_IDS,
69
+ description: 'Enabled features',
70
+ table: { category: 'Configuration Omnia' },
71
+ },
72
+ omnia_shortcuts: { control: 'boolean', description: 'Enable keyboard shortcuts', table: { category: 'Configuration Omnia' } },
73
+ omnia_toolbar: { control: 'boolean', description: 'Show toolbar button', table: { category: 'Configuration Omnia' } },
74
+ omnia_context_menu: { control: 'boolean', description: 'Show context menu items', table: { category: 'Configuration Omnia' } },
75
+ omnia_translate_languages: {
76
+ control: 'check',
77
+ options: LANGUAGES.map((l) => l.code),
78
+ description: 'Available languages',
79
+ table: { category: 'Configuration Omnia' },
80
+ },
81
+ omnia_history_limit: { control: { type: 'number', min: 1, max: 50 }, description: 'History limit', table: { category: 'Configuration Omnia' } },
82
+ omnia_floating_panel_mode: {
83
+ control: 'select',
84
+ options: ['inline', 'blur'],
85
+ description: 'Floating panel display mode',
86
+ table: { category: 'Configuration Omnia' },
87
+ },
88
+ omnia_floating_panel_width: {
89
+ control: 'text',
90
+ description: 'Inline panel width: a number (px) or "full"',
91
+ table: { category: 'Configuration Omnia' },
92
+ },
93
+ },
94
+ };
95
+
96
+ function createEditor(el, args) {
97
+ return new Promise((resolve) => {
98
+ tinymce.init({
99
+ target: el,
100
+ skin_url: '/tinymce/skins/ui/oxide',
101
+ content_css: '/tinymce/skins/content/default/content.min.css',
102
+ license_key: 'gpl',
103
+ height: '100%',
104
+ plugins: 'omnia lists link image table charmap searchreplace fullscreen code wordcount',
105
+ toolbar:
106
+ 'undo redo | omnia | styles | bold italic underline strikethrough | ' +
107
+ 'bullist numlist outdent indent | link image table charmap | ' +
108
+ 'searchreplace fullscreen code',
109
+ contextmenu: 'link image table' + (args.omnia_context_menu ? ' omnia' : ''),
110
+ omnia_base_url: args.omnia_base_url,
111
+ omnia_application: args.omnia_application,
112
+ omnia_municipality: args.omnia_municipality,
113
+ omnia_default_translate_language: args.omnia_default_translate_language,
114
+ omnia_enabled_features: args.omnia_enabled_features,
115
+ omnia_shortcuts: args.omnia_shortcuts,
116
+ omnia_toolbar: args.omnia_toolbar,
117
+ omnia_context_menu: args.omnia_context_menu,
118
+ omnia_translate_languages: args.omnia_translate_languages,
119
+ omnia_history_limit: args.omnia_history_limit,
120
+ omnia_floating_panel_mode: args.omnia_floating_panel_mode,
121
+ omnia_floating_panel_width: args.omnia_floating_panel_width === 'full' ? 'full' : Number(args.omnia_floating_panel_width) || undefined,
122
+ promotion: false,
123
+ branding: false,
124
+ setup(editor) {
125
+ editor.on('init', () => {
126
+ editor.setContent(PRESETS[args.preset] || '');
127
+ resolve(editor);
128
+ });
129
+ },
130
+ });
131
+ });
132
+ }
133
+
134
+ function render(args) {
135
+ const wrapper = document.createElement('div');
136
+ wrapper.style.height = 'calc(100vh - 4rem)';
137
+ wrapper.style.display = 'flex';
138
+ wrapper.style.margin = '2rem';
139
+ wrapper.style.flexDirection = 'column';
140
+
141
+ const textarea = document.createElement('textarea');
142
+ wrapper.appendChild(textarea);
143
+
144
+ createEditor(textarea, args);
145
+
146
+ return wrapper;
147
+ }
148
+
149
+ // ── Mock API story ──────────────────────────────────────────────────
150
+
151
+ export const MockAPI = {
152
+ render,
153
+ args: {
154
+ omnia_base_url: '/api',
155
+ omnia_application: import.meta.env.VITE_OMNIA_APPLICATION || '',
156
+ omnia_municipality: import.meta.env.VITE_OMNIA_MUNICIPALITY || '',
157
+ omnia_default_translate_language: 'nl',
158
+ omnia_enabled_features: [...FEATURE_IDS],
159
+ omnia_shortcuts: true,
160
+ omnia_toolbar: true,
161
+ omnia_context_menu: true,
162
+ omnia_translate_languages: LANGUAGES.map((l) => l.code),
163
+ omnia_history_limit: 5,
164
+ omnia_floating_panel_mode: 'inline',
165
+ omnia_floating_panel_width: "450",
166
+ preset: 'ameliorer',
167
+ },
168
+ };
169
+
170
+ // ── Omnia API story (uses proxy from VITE_OMNIA_BASE_URL env var) ────
171
+
172
+ export const OmniaAPI = {
173
+ render,
174
+ args: {
175
+ ...MockAPI.args,
176
+ omnia_base_url: import.meta.env.VITE_OMNIA_BASE_URL || '/api',
177
+ },
178
+ };
179
+
180
+ // ── Vanilla TinyMCE (no Omnia plugin) ───────────────────────────────
181
+
182
+ function renderVanilla(args) {
183
+ const wrapper = document.createElement('div');
184
+ wrapper.style.height = 'calc(100vh - 4rem)';
185
+ wrapper.style.display = 'flex';
186
+ wrapper.style.margin = '2rem';
187
+ wrapper.style.flexDirection = 'column';
188
+
189
+ const textarea = document.createElement('textarea');
190
+ wrapper.appendChild(textarea);
191
+
192
+ tinymce.init({
193
+ target: textarea,
194
+ skin_url: '/tinymce/skins/ui/oxide',
195
+ content_css: '/tinymce/skins/content/default/content.min.css',
196
+ license_key: 'gpl',
197
+ height: '100%',
198
+ plugins: 'lists link image table charmap searchreplace fullscreen code wordcount',
199
+ toolbar:
200
+ 'undo redo | styles | bold italic underline strikethrough | ' +
201
+ 'bullist numlist outdent indent | link image table charmap | ' +
202
+ 'searchreplace fullscreen code',
203
+ promotion: false,
204
+ branding: false,
205
+ setup(editor) {
206
+ editor.on('init', () => {
207
+ editor.setContent(PRESETS[args.preset] || '');
208
+ });
209
+ },
210
+ });
211
+
212
+ return wrapper;
213
+ }
214
+
215
+ export const Vanilla = {
216
+ render: renderVanilla,
217
+ argTypes: {
218
+ preset: {
219
+ control: 'select',
220
+ options: Object.keys(PRESETS),
221
+ labels: PRESET_LABELS,
222
+ description: 'Text preset to load in the editor',
223
+ },
224
+ },
225
+ args: {
226
+ preset: 'corriger',
227
+ },
228
+ };
@@ -0,0 +1,31 @@
1
+ import { render } from 'preact';
2
+ import { TypingDots } from '../src/ui/components';
3
+ import '../src/ui/omnia.css';
4
+
5
+ export default {
6
+ title: 'TypingDots',
7
+ };
8
+
9
+ export const Default = () => {
10
+ const el = document.createElement('div');
11
+ el.setAttribute('data-omnia', '');
12
+ el.style.padding = '32px';
13
+ render(<TypingDots />, el);
14
+ return el;
15
+ };
16
+
17
+ export const OnPanel = () => {
18
+ const el = document.createElement('div');
19
+ el.setAttribute('data-omnia', '');
20
+ el.style.width = '380px';
21
+ el.style.border = '1px solid #e5e7eb';
22
+ el.style.borderRadius = '8px';
23
+ el.style.boxShadow = '0 4px 12px rgba(0,0,0,.08)';
24
+ render(
25
+ <div class="om:flex om:justify-center om:py-6">
26
+ <TypingDots />
27
+ </div>,
28
+ el,
29
+ );
30
+ return el;
31
+ };
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Factory for a mock TinyMCE editor instance.
3
+ * Provides only the API surface the Omnia plugin actually uses.
4
+ *
5
+ * @param {{ selectedText?: string, rect?: DOMRect, container?: HTMLElement }} [opts]
6
+ */
7
+ export function createMockEditor(opts = {}) {
8
+ const {
9
+ selectedText = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
10
+ rect = { top: 200, left: 300, bottom: 220, right: 500, width: 200, height: 20 },
11
+ container = null,
12
+ } = opts;
13
+
14
+ const listeners = new Map();
15
+ let lastInserted = null;
16
+ let lastSetContent = null;
17
+
18
+ return {
19
+ id: 'mock-editor-1',
20
+
21
+ selection: {
22
+ getContent() {
23
+ return selectedText;
24
+ },
25
+ getRng() {
26
+ return {
27
+ getBoundingClientRect() {
28
+ return rect;
29
+ },
30
+ };
31
+ },
32
+ setContent(html) {
33
+ lastSetContent = html;
34
+ },
35
+ },
36
+
37
+ insertContent(html) {
38
+ lastInserted = html;
39
+ },
40
+
41
+ getContainer() {
42
+ return container || document.body;
43
+ },
44
+
45
+ getBody() {
46
+ return container || document.body;
47
+ },
48
+
49
+ on(event, callback) {
50
+ if (!listeners.has(event)) listeners.set(event, new Set());
51
+ listeners.get(event).add(callback);
52
+ },
53
+
54
+ off(event, callback) {
55
+ listeners.get(event)?.delete(callback);
56
+ },
57
+
58
+ fire(event, data) {
59
+ listeners.get(event)?.forEach((cb) => cb(data));
60
+ },
61
+
62
+ // Test helpers
63
+ get _lastInserted() { return lastInserted; },
64
+ get _lastSetContent() { return lastSetContent; },
65
+ };
66
+ }
@@ -0,0 +1,99 @@
1
+ import defaultResponseHtml from '../presets/corriger-bulletin.html?raw';
2
+
3
+ /**
4
+ * Split HTML into small stream-friendly chunks: tags are emitted whole,
5
+ * text is split into short runs of 2-5 words.
6
+ */
7
+ function chunkHtml(html) {
8
+ const parts = [];
9
+ const re = /(<[^>]+>)|([^<]+)/g;
10
+ let m;
11
+ while ((m = re.exec(html)) !== null) {
12
+ if (m[1]) {
13
+ // Tag — emit whole
14
+ parts.push(m[1]);
15
+ } else {
16
+ // Text — split into small word groups
17
+ const words = m[2].split(/(?<= )/); // split keeping trailing spaces
18
+ let buf = '';
19
+ let count = 0;
20
+ const groupSize = 2 + Math.floor(Math.random() * 4); // 2-5
21
+ for (const w of words) {
22
+ buf += w;
23
+ count++;
24
+ if (count >= groupSize) {
25
+ parts.push(buf);
26
+ buf = '';
27
+ count = 0;
28
+ }
29
+ }
30
+ if (buf) parts.push(buf);
31
+ }
32
+ }
33
+ return parts;
34
+ }
35
+
36
+ /**
37
+ * Factory for a mock OmniaClient.
38
+ *
39
+ * @param {{ delay?: number, response?: string, error?: boolean }} [opts]
40
+ * - delay: ms before resolving (default 800)
41
+ * - response: HTML string returned by all agent methods
42
+ * - error: throw an error instead of returning a result
43
+ * - errorAfter: number of chunks to stream before the error (default: half)
44
+ */
45
+ export function createMockOmniaClient(opts = {}) {
46
+ const {
47
+ delay = 800,
48
+ response = defaultResponseHtml,
49
+ error = false,
50
+ errorAfter,
51
+ } = opts;
52
+
53
+ const chunks = chunkHtml(response);
54
+ const fullText = response;
55
+
56
+ async function resolve(signal) {
57
+ await new Promise((res) => setTimeout(res, delay));
58
+ if (signal?.aborted) return;
59
+ if (error) throw new Error('Simulated API error');
60
+ return fullText;
61
+ }
62
+
63
+ return {
64
+ generate(prompt, options = {}) {
65
+ async function* stream(signal) {
66
+ const errorAt = error ? (errorAfter ?? Math.ceil(chunks.length / 2)) : Infinity;
67
+ for (let i = 0; i < chunks.length; i++) {
68
+ if (signal?.aborted) return;
69
+ // Vary timing: tags are fast, text chunks get 80-200ms
70
+ const isTag = chunks[i].startsWith('<');
71
+ const ms = isTag ? 15 : 80 + Math.random() * 120;
72
+ await new Promise((res) => setTimeout(res, ms));
73
+ if (signal?.aborted) return;
74
+ if (i === errorAt) throw new Error('Simulated API error');
75
+ yield chunks[i];
76
+ }
77
+ }
78
+ return stream(options.signal);
79
+ },
80
+ expandText(text, options = {}) {
81
+ return resolve(options.signal);
82
+ },
83
+ improveText(text, options = {}) {
84
+ return resolve(options.signal);
85
+ },
86
+ reduceText(text, options = {}) {
87
+ return resolve(options.signal);
88
+ },
89
+ correctText(text, options = {}) {
90
+ return resolve(options.signal);
91
+ },
92
+ makeAccessible(text, options = {}) {
93
+ return resolve(options.signal);
94
+ },
95
+ translateText(text, targetLang, options = {}) {
96
+ return resolve(options.signal);
97
+ },
98
+ };
99
+ }
@@ -0,0 +1,49 @@
1
+ <h1>Règlement communal relatif à la gestion des cimetières et des sépultures</h1>
2
+
3
+ <p>Le CC, vu le CDLD, not. les art. L1122-30 et L1122-32 ; vu la L. du 20/07/1971 sur les fun. et sép., telle que mod. ; vu le décr. du 06/03/2009 mod. le Chap. II du Titre III du Livre II de la 1<sup>re</sup> partie du CDLD rel. aux fun. et sép. ; vu l'AGW du 29/10/2009 port. exéc. du décr. précité ;</p>
4
+
5
+ <p><strong>ARRETE</strong> le règlement suivant :</p>
6
+
7
+ <h2>Chap. I — Disp. gén.</h2>
8
+
9
+ <p><strong>Art. 1.</strong> Le présent règlement, ci-après dénommé « le Règlement », est d'application sur l'intégralité du périmètre géographique constitué par les enceintes des infrastructures cinéraires et d'inhumation relevant de la compétence juridictionnelle de l'entité communale, à savoir :</p>
10
+
11
+ <ol>
12
+ <li>Le cimetière central sis à la Rue de la Paix, 25</li>
13
+ <li>Le cimetière du Vieux-Village sis au Chemin du Repos, 3</li>
14
+ <li>Le cimetière de la Chapelle sis à la Route de Dinant, 142</li>
15
+ </ol>
16
+
17
+ <p><strong>Art. 2.</strong> L'accessibilité des sites susmentionnés au profit des usagers est autorisée conformément à la planification horaire ci-après définie : du 01/04 au 30/09, tous les jours de 8h00 à 19h00 ; du 01/10 au 31/03, tous les jours de 8h00 à 17h00 ; du 25/10 au 05/11 (période de la Toussaint), tous les jours de 8h00 à 19h30.</p>
18
+
19
+ <h2>Chap. II — Typol. des sép. et rég. concess.</h2>
20
+
21
+ <p><strong>Art. 3.</strong> Les modalités d'ensevelissement et/ou de conservation des restes mortels et/ou des cendres résultant de la crémation au sein des enceintes cinéraires susvisées sont limitativement énumérées comme suit : (a) l'inhumation en pleine terre dans une parcelle individuelle aux dimensions normalisées de 2,50 m × 1,20 m ; (b) l'inhumation en caveau maçonné, qu'il soit de configuration simple (une place) ou double (deux places) ; (c) la mise en columbarium dans des niches de configuration individuelle (une urne) ou familiale (jusqu'à quatre urnes) ; (d) la dispersion des cendres sur la pelouse spécifiquement aménagée à cet effet dans chacun des sites ; (e) la mise en cavurne, c.-à-d. un petit caveau exclusivement destiné à l'accueil d'urnes cinéraires.</p>
22
+
23
+ <p><strong>Art. 4.</strong> Les redevances afférentes à l'octroi des concessions de sépulture, exprimées en EUR et pour une durée trentenaire, sont fixées selon le barème ci-après : pleine terre individuelle : 350 € (hab.) / 700 € (non-hab.) ; caveau 1 pl. : 750 € / 1.500 € ; caveau 2 pl. : 1.200 € / 2.400 € ; niche columb. individuelle : 250 € / 500 € ; niche columb. familiale : 450 € / 900 € ; cavurne : 200 € / 400 € ; dispersion : gratuit / 75 €.</p>
24
+
25
+ <p><strong>Art. 5.</strong> Les concessions sont susceptibles de faire l'objet d'un renouvellement par périodes décennales, sous réserve de l'introduction de la demande afférente dans un délai maximal d'un an antérieurement à l'échéance de la concession en cours, le tarif du renouvellement étant calculé au prorata du tarif en vigueur au moment de l'introduction de ladite demande.</p>
26
+
27
+ <h2>Chap. III — Oblig. d'entretien</h2>
28
+
29
+ <p><strong>Art. 6.</strong> Il incombe aux concessionnaires et/ou à leurs ayants droit d'assurer le maintien en bon état d'entretien et de propreté des sépultures concédées. Constituent not. des manquements à cette obligation : le dépôt de déchets de qq. nature que ce soit en dehors des réceptacles prévus à cet effet ; l'utilisation de produits phytopharmaceutiques (herbicides, pesticides) conf. au décr. wal. « zéro phyto » ; la mise en place de plantations dont la hauteur à maturité excéderait 1,50 m ; l'installation de dispositifs de clôture ou de délimitation non préalablement autorisés ; le placement d'objets susceptibles de porter atteinte à la décence des lieux ou à la sécurité des usagers.</p>
30
+
31
+ <p><strong>Art. 7.</strong> En cas de constatation de l'état manifeste d'abandon d'une sépulture concédée, il sera fait application de la procédure prévue à l'art. L1232-5 du CDLD, impliquant l'apposition d'un acte sur ladite sépulture pour une durée d'un an, à l'expiration de laquelle, en l'absence de remise en état, la concession sera réputée abandonnée et l'admin. communale sera habilitée à procéder au démontage du monument.</p>
32
+
33
+ <h2>Chap. IV — Disp. rel. aux entr. de PF</h2>
34
+
35
+ <p><strong>Art. 8.</strong> Les entreprises de pompes funèbres opérant dans le périmètre des cimetières communaux sont tenues de se conformer aux prescriptions suivantes : (1) respect des plages horaires d'intervention fixées par le fossoyeur communal, soit du L au V, de 9h00 à 15h00 ; (2) détention d'une couverture assurantielle en RC couvrant les dommages éventuels aux sépultures adjacentes ; (3) remise en pristine état des lieux post-intervention ; (4) évacuation de l'intégralité des déchets de chantier (terre excédentaire, emballages, etc.) ; (5) signalement au fossoyeur communal de toute anomalie constatée lors de l'ouverture d'une fosse.</p>
36
+
37
+ <h2>Chap. V — Pol. des cim.</h2>
38
+
39
+ <p><strong>Art. 9.</strong> Sont prohibés dans l'enceinte des cimetières les comportements et/ou activités ci-après : (a) le trouble du recueillement des visiteurs par des comportements bruyants ou irrespectueux ; (b) la circulation au moyen de véhicules motorisés, sauf dérogation accordée par le fossoyeur communal au bénéfice des PMR ; (c) l'introduction d'animaux, à l'exception des chiens d'assistance maintenus en laisse ; (d) l'exercice de toute activité commerciale ou de démarchage ; (e) la captation d'images photographiques ou vidéographiques de cérémonies funéraires sans le consentement exprès des familles endeuillées.</p>
40
+
41
+ <p><strong>Art. 10.</strong> Les infractions au présent règlement sont passibles de SAC dont le montant est fixé entre 50 et 350 EUR, conf. à la L. du 24/06/2013 rel. aux SAC.</p>
42
+
43
+ <h2>Chap. VI — Disp. finales</h2>
44
+
45
+ <p><strong>Art. 11.</strong> Le présent règlement emporte abrogation et remplacement du règlement communal du 15/09/2018 rel. aux cim.</p>
46
+
47
+ <p><strong>Art. 12.</strong> Le présent règlement sortira ses effets le 5<sup>e</sup> jour suivant sa publication par voie d'affichage conf. aux art. L1133-1 et L1133-2 du CDLD.</p>
48
+
49
+ <p><em>Adopté par le CC en séance du 28/02/2026.</em></p>