@aionbuilders/nabu 0.1.0-alpha.0 → 0.1.0-alpha.10

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 (108) hide show
  1. package/README.md +70 -1
  2. package/dist/behaviors/text/index.d.ts +1 -1
  3. package/dist/behaviors/text/index.js +1 -1
  4. package/dist/behaviors/text/rich-text.extension.js +96 -30
  5. package/dist/behaviors/text/text.behavior.svelte.d.ts +19 -0
  6. package/dist/behaviors/text/text.behavior.svelte.js +64 -2
  7. package/dist/blocks/Block.svelte +3 -3
  8. package/dist/blocks/BlockGap.svelte +55 -0
  9. package/dist/blocks/BlockGap.svelte.d.ts +11 -0
  10. package/dist/blocks/Nabu.svelte +8 -0
  11. package/dist/blocks/block.extension.d.ts +2 -0
  12. package/dist/blocks/block.extension.js +32 -0
  13. package/dist/blocks/block.svelte.d.ts +41 -9
  14. package/dist/blocks/block.svelte.js +55 -18
  15. package/dist/blocks/container.utils.d.ts +54 -4
  16. package/dist/blocks/container.utils.js +211 -8
  17. package/dist/blocks/dialogue/Dialogue.svelte +46 -0
  18. package/dist/blocks/dialogue/Dialogue.svelte.d.ts +11 -0
  19. package/dist/blocks/dialogue/dialogue.svelte.d.ts +41 -0
  20. package/dist/blocks/dialogue/dialogue.svelte.js +87 -0
  21. package/dist/blocks/dialogue/hooks/onBeforeInput.hook.d.ts +3 -0
  22. package/dist/blocks/dialogue/hooks/onBeforeInput.hook.js +52 -0
  23. package/dist/blocks/dialogue/index.d.ts +7 -0
  24. package/dist/blocks/dialogue/index.js +47 -0
  25. package/dist/blocks/heading/Heading.svelte +13 -9
  26. package/dist/blocks/heading/heading.svelte.d.ts +40 -4
  27. package/dist/blocks/heading/heading.svelte.js +60 -4
  28. package/dist/blocks/heading/hooks/onBeforeInput.hook.js +1 -1
  29. package/dist/blocks/heading/index.d.ts +2 -2
  30. package/dist/blocks/heading/index.js +11 -7
  31. package/dist/blocks/index.d.ts +7 -4
  32. package/dist/blocks/index.js +7 -4
  33. package/dist/blocks/list/ListItem.svelte +6 -2
  34. package/dist/blocks/list/hooks/onBeforeInput.hook.d.ts +3 -0
  35. package/dist/blocks/list/hooks/onBeforeInput.hook.js +77 -0
  36. package/dist/blocks/list/index.d.ts +2 -2
  37. package/dist/blocks/list/index.js +17 -3
  38. package/dist/blocks/list/list-item.svelte.d.ts +59 -6
  39. package/dist/blocks/list/list-item.svelte.js +157 -89
  40. package/dist/blocks/list/list.behavior.svelte.d.ts +1 -0
  41. package/dist/blocks/list/list.behavior.svelte.js +5 -4
  42. package/dist/blocks/list/list.svelte.d.ts +60 -7
  43. package/dist/blocks/list/list.svelte.js +116 -15
  44. package/dist/blocks/megablock.svelte.d.ts +30 -5
  45. package/dist/blocks/megablock.svelte.js +113 -17
  46. package/dist/blocks/nabu.svelte.d.ts +44 -6
  47. package/dist/blocks/nabu.svelte.js +397 -15
  48. package/dist/blocks/paragraph/Paragraph.svelte +12 -16
  49. package/dist/blocks/paragraph/Paragraph.svelte.d.ts +2 -2
  50. package/dist/blocks/paragraph/index.d.ts +2 -2
  51. package/dist/blocks/paragraph/index.js +29 -8
  52. package/dist/blocks/paragraph/paragraph.svelte.d.ts +33 -5
  53. package/dist/blocks/paragraph/paragraph.svelte.js +55 -3
  54. package/dist/blocks/selection.svelte.d.ts +6 -5
  55. package/dist/blocks/selection.svelte.js +209 -18
  56. package/dist/blocks/variable.svelte.d.ts +47 -0
  57. package/dist/blocks/variable.svelte.js +51 -0
  58. package/dist/blocks/zone/TemplateEditor.svelte +308 -0
  59. package/dist/blocks/zone/TemplateEditor.svelte.d.ts +11 -0
  60. package/dist/blocks/zone/Zone.svelte +272 -0
  61. package/dist/blocks/zone/Zone.svelte.d.ts +11 -0
  62. package/dist/blocks/zone/ZoneEditor copy.svelte +118 -0
  63. package/dist/blocks/zone/ZoneEditor copy.svelte.d.ts +11 -0
  64. package/dist/blocks/zone/ZoneEditor.svelte +289 -0
  65. package/dist/blocks/zone/ZoneEditor.svelte.d.ts +11 -0
  66. package/dist/blocks/zone/ZoneTemplatesList.svelte +188 -0
  67. package/dist/blocks/zone/ZoneTemplatesList.svelte.d.ts +11 -0
  68. package/dist/blocks/zone/hooks/onBeforeInput.hook.d.ts +3 -0
  69. package/dist/blocks/zone/hooks/onBeforeInput.hook.js +30 -0
  70. package/dist/blocks/zone/index.d.ts +2 -0
  71. package/dist/blocks/zone/index.js +2 -0
  72. package/dist/blocks/zone/zone.extension.d.ts +2 -0
  73. package/dist/blocks/zone/zone.extension.js +227 -0
  74. package/dist/blocks/zone/zone.svelte.d.ts +222 -0
  75. package/dist/blocks/zone/zone.svelte.js +620 -0
  76. package/dist/index.d.ts +3 -0
  77. package/dist/index.js +4 -1
  78. package/dist/nabu-theme.css +92 -0
  79. package/dist/overlays/context/Context.svelte +179 -0
  80. package/dist/overlays/context/Context.svelte.d.ts +16 -0
  81. package/dist/overlays/context/collect.d.ts +17 -0
  82. package/dist/overlays/context/collect.js +33 -0
  83. package/dist/overlays/context/context.extension.d.ts +2 -0
  84. package/dist/overlays/context/context.extension.js +8 -0
  85. package/dist/overlays/context/context.svelte.d.ts +81 -0
  86. package/dist/overlays/context/context.svelte.js +159 -0
  87. package/dist/overlays/context/index.d.ts +3 -0
  88. package/dist/overlays/context/index.js +3 -0
  89. package/dist/paste/html.paste.d.ts +12 -0
  90. package/dist/paste/html.paste.js +192 -0
  91. package/dist/paste/index.d.ts +4 -0
  92. package/dist/paste/index.js +4 -0
  93. package/dist/paste/markdown.paste.d.ts +12 -0
  94. package/dist/paste/markdown.paste.js +140 -0
  95. package/dist/paste/nabu.paste.d.ts +2 -0
  96. package/dist/paste/nabu.paste.js +20 -0
  97. package/dist/paste/plain-text.paste.d.ts +8 -0
  98. package/dist/paste/plain-text.paste.js +42 -0
  99. package/dist/persistence/indexeddb.d.ts +19 -0
  100. package/dist/persistence/indexeddb.js +71 -0
  101. package/dist/persistence/persistence.d.ts +48 -0
  102. package/dist/persistence/persistence.js +80 -0
  103. package/dist/presets.d.ts +38 -0
  104. package/dist/presets.js +86 -0
  105. package/dist/utils/extensions.d.ts +63 -0
  106. package/dist/utils/extensions.js +33 -0
  107. package/dist/utils/selection.svelte.js +0 -5
  108. package/package.json +14 -3
@@ -0,0 +1,308 @@
1
+ <script>
2
+ import { formatTemplateLabel } from './zone.svelte.js';
3
+
4
+ /** @type {{ template: import('./zone.svelte.js').Template }} */
5
+ let { template } = $props();
6
+
7
+ let labelDraft = $state(template.label);
8
+ /** @type {HTMLInputElement} */
9
+ let inputEl;
10
+
11
+ function commitLabel() {
12
+ const trimmed = labelDraft.trim();
13
+ if (trimmed && trimmed !== template.label) {
14
+ template.label = trimmed;
15
+ } else {
16
+ labelDraft = template.label;
17
+ }
18
+ }
19
+
20
+ /** @param {KeyboardEvent} e */
21
+ function onLabelKeydown(e) {
22
+ e.stopPropagation();
23
+ if (e.key === 'Enter') { e.preventDefault(); commitLabel(); }
24
+ if (e.key === 'Escape') { labelDraft = template.label; }
25
+ }
26
+
27
+ /** @param {string} tag */
28
+ function insertTag(tag) {
29
+ if (!inputEl) return;
30
+ const start = inputEl.selectionStart || labelDraft.length;
31
+ const end = inputEl.selectionEnd || labelDraft.length;
32
+ const before = labelDraft.substring(0, start);
33
+ const after = labelDraft.substring(end);
34
+
35
+ labelDraft = before + tag + after;
36
+
37
+ // Restore focus and cursor position
38
+ setTimeout(() => {
39
+ inputEl.focus();
40
+ inputEl.setSelectionRange(start + tag.length, start + tag.length);
41
+ commitLabel();
42
+ }, 0);
43
+ }
44
+
45
+ /** @param {'none'|'parent'|'root'} scope */
46
+ function setCounter(scope) {
47
+ if (scope === 'none') template.counter = null;
48
+ else template.counter = { scope };
49
+ }
50
+ </script>
51
+
52
+ <div class="te">
53
+ <div class="te-head">
54
+ <span class="te-title">Template Format</span>
55
+ <span class="te-id">:::{template.id}</span>
56
+ </div>
57
+
58
+ <div class="te-body">
59
+ <!-- Display Format Field with Smart Tags -->
60
+ <div class="te-field">
61
+ <input
62
+ bind:this={inputEl}
63
+ class="te-input"
64
+ bind:value={labelDraft}
65
+ onblur={commitLabel}
66
+ onkeydown={onLabelKeydown}
67
+ onbeforeinput={(e) => e.stopPropagation()}
68
+ placeholder={'e.g. Chapter {{I}} - {{title}}'}
69
+ />
70
+
71
+ <div class="te-tags">
72
+ <button class="te-tag" aria-label="Decimal Index" onclick={() => insertTag('{{1}}')}>1, 2</button>
73
+ <button class="te-tag" aria-label="Roman Uppercase" onclick={() => insertTag('{{I}}')}>I, II</button>
74
+ <button class="te-tag" aria-label="Alpha Uppercase" onclick={() => insertTag('{{A}}')}>A, B</button>
75
+ <button class="te-tag" aria-label="Zone Title" onclick={() => insertTag('{{title}}')}>title</button>
76
+ </div>
77
+
78
+ <!-- Live Preview -->
79
+ <div class="te-preview">
80
+ <span class="te-preview-label">Live Preview</span>
81
+ <div class="te-preview-list">
82
+ <span class="te-preview-item">{formatTemplateLabel(labelDraft, 1, 'Introduction')}</span>
83
+ <span class="te-preview-item te-preview-dim">{formatTemplateLabel(labelDraft, 2, 'Methods')}</span>
84
+ </div>
85
+ </div>
86
+ </div>
87
+
88
+ <!-- Numbering Scope -->
89
+ <div class="te-field">
90
+ <span class="te-label">Numbering Rules</span>
91
+ <div class="te-segmented">
92
+ <button
93
+ class="te-seg-btn"
94
+ class:active={template.counter == null}
95
+ onclick={() => setCounter('none')}>
96
+ None
97
+ </button>
98
+ <button
99
+ class="te-seg-btn"
100
+ class:active={template.counter?.scope === 'parent'}
101
+ onclick={() => setCounter('parent')}>
102
+ Parent
103
+ </button>
104
+ <button
105
+ class="te-seg-btn"
106
+ class:active={template.counter?.scope === 'root'}
107
+ onclick={() => setCounter('root')}>
108
+ Global
109
+ </button>
110
+ </div>
111
+ <span class="te-hint">
112
+ {#if template.counter == null}
113
+ This template will not increment a counter.
114
+ {:else if template.counter.scope === 'parent'}
115
+ Restarts numbering inside each parent zone.
116
+ {:else}
117
+ Continuous numbering across the entire document.
118
+ {/if}
119
+ </span>
120
+ </div>
121
+ </div>
122
+ </div>
123
+
124
+ <style>
125
+ .te {
126
+ display: flex;
127
+ flex-direction: column;
128
+ padding: 6px;
129
+ gap: 8px;
130
+ background: hsla(0, 0%, 12%, 0.75);
131
+ padding: 4px;
132
+ gap: 12px;
133
+ }
134
+
135
+ .te-head {
136
+ display: flex;
137
+ align-items: baseline;
138
+ gap: 8px;
139
+ padding: 0 4px;
140
+ }
141
+
142
+ .te-title {
143
+ font-size: 11px;
144
+ font-weight: 600;
145
+ text-transform: uppercase;
146
+ letter-spacing: 0.5px;
147
+ color: var(--nb-text-muted, hsla(0, 0%, 100%, 0.4));
148
+ }
149
+
150
+ .te-id {
151
+ font-size: 10px;
152
+ color: var(--nb-text-muted, hsla(0, 0%, 100%, 0.3));
153
+ font-family: ui-monospace, monospace;
154
+ }
155
+
156
+ .te-body {
157
+ display: flex;
158
+ flex-direction: column;
159
+ gap: 12px;
160
+ padding: 8px;
161
+ background: var(--nb-bg-surface-hover, hsla(0, 0%, 100%, 0.02));
162
+ border-radius: 12px;
163
+ border: 1px solid var(--nb-border-subtle, hsla(0, 0%, 100%, 0.03));
164
+ }
165
+
166
+ .te-field {
167
+ display: flex;
168
+ flex-direction: column;
169
+ gap: 6px;
170
+ }
171
+
172
+ .te-label {
173
+ font-size: 11px;
174
+ font-weight: 500;
175
+ color: var(--nb-text-secondary, hsla(0, 0%, 100%, 0.6));
176
+ margin-left: 2px;
177
+ }
178
+
179
+ .te-hint {
180
+ font-size: 10px;
181
+ color: var(--nb-text-muted, hsla(0, 0%, 100%, 0.4));
182
+ margin-left: 2px;
183
+ margin-top: 2px;
184
+ font-style: italic;
185
+ }
186
+
187
+ .te-input {
188
+ width: 100%;
189
+ background: var(--nb-bg-surface-sunken, hsla(0, 0%, 0%, 0.2));
190
+ border: 1px solid var(--nb-border-subtle, hsla(0, 0%, 100%, 0.05));
191
+ border-radius: 8px;
192
+ padding: 8px 10px;
193
+ color: var(--nb-text-primary, #eee);
194
+ font-size: 13px;
195
+ font-family: inherit;
196
+ outline: none;
197
+ box-shadow: var(--nb-shadow-inset, inset 0 2px 4px rgba(0,0,0,0.1));
198
+ transition: all 0.2s ease;
199
+ }
200
+
201
+ .te-input:focus {
202
+ border-color: var(--nb-border-focus, hsla(0, 0%, 100%, 0.2));
203
+ box-shadow: var(--nb-shadow-inset, inset 0 2px 4px rgba(0,0,0,0.1)), var(--nb-shadow-glow, 0 0 0 2px hsla(0, 0%, 100%, 0.05));
204
+ background: var(--nb-bg-surface-sunken, hsla(0, 0%, 0%, 0.3));
205
+ }
206
+
207
+ .te-tags {
208
+ display: flex;
209
+ flex-wrap: wrap;
210
+ gap: 4px;
211
+ margin-top: 2px;
212
+ }
213
+
214
+ .te-tag {
215
+ background: var(--nb-bg-surface-hover, hsla(0, 0%, 100%, 0.05));
216
+ border: 1px solid var(--nb-border-subtle, hsla(0, 0%, 100%, 0.05));
217
+ border-radius: 6px;
218
+ padding: 4px 8px;
219
+ color: var(--nb-text-secondary, hsla(0, 0%, 100%, 0.6));
220
+ font-size: 10px;
221
+ font-weight: 600;
222
+ cursor: pointer;
223
+ transition: all 0.1s ease;
224
+ }
225
+
226
+ .te-tag:hover {
227
+ background: var(--nb-bg-surface-active, hsla(0, 0%, 100%, 0.1));
228
+ color: var(--nb-text-primary, hsla(0, 0%, 100%, 0.9));
229
+ border-color: var(--nb-border, hsla(0, 0%, 100%, 0.15));
230
+ }
231
+
232
+ .te-tag:active {
233
+ transform: scale(0.95);
234
+ }
235
+
236
+ .te-preview {
237
+ display: flex;
238
+ flex-direction: column;
239
+ gap: 4px;
240
+ margin-top: 6px;
241
+ padding: 8px 10px;
242
+ background: var(--nb-bg-surface-sunken, hsla(0, 0%, 0%, 0.15));
243
+ border-radius: 8px;
244
+ border: 1px dashed var(--nb-border-subtle, hsla(0, 0%, 100%, 0.06));
245
+ }
246
+
247
+ .te-preview-label {
248
+ font-size: 9px;
249
+ text-transform: uppercase;
250
+ letter-spacing: 0.1em;
251
+ color: var(--nb-text-muted, hsla(0, 0%, 100%, 0.3));
252
+ }
253
+
254
+ .te-preview-list {
255
+ display: flex;
256
+ flex-direction: column;
257
+ gap: 2px;
258
+ }
259
+
260
+ .te-preview-item {
261
+ font-size: 12px;
262
+ color: var(--nb-text-primary, hsla(0, 0%, 100%, 0.9));
263
+ font-weight: 500;
264
+ white-space: nowrap;
265
+ overflow: hidden;
266
+ text-overflow: ellipsis;
267
+ }
268
+
269
+ .te-preview-dim {
270
+ opacity: 0.4;
271
+ }
272
+
273
+ .te-segmented {
274
+ display: flex;
275
+ background: var(--nb-bg-surface-sunken, hsla(0, 0%, 0%, 0.2));
276
+ border: 1px solid var(--nb-border-subtle, hsla(0, 0%, 100%, 0.05));
277
+ border-radius: 8px;
278
+ padding: 2px;
279
+ box-shadow: var(--nb-shadow-inset, inset 0 2px 4px rgba(0,0,0,0.1));
280
+ }
281
+
282
+ .te-seg-btn {
283
+ flex: 1;
284
+ padding: 6px 8px;
285
+ background: transparent;
286
+ border: none;
287
+ border-radius: 6px;
288
+ color: var(--nb-text-muted, hsla(0, 0%, 100%, 0.4));
289
+ font-size: 11px;
290
+ font-weight: 600;
291
+ cursor: pointer;
292
+ transition: all 0.2s ease;
293
+ }
294
+
295
+ .te-seg-btn:hover:not(.active) {
296
+ color: var(--nb-text-primary, hsla(0, 0%, 100%, 0.8));
297
+ }
298
+
299
+ .te-seg-btn.active {
300
+ color: var(--nb-text-primary, hsla(0, 0%, 100%, 0.9));
301
+ background: var(--nb-bg-surface-active, hsla(0, 0%, 100%, 0.1));
302
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1), inset 0 1px 0 var(--nb-border-subtle, hsla(0,0%,100%,0.05));
303
+ }
304
+
305
+ .te-seg-btn:active:not(.active) {
306
+ transform: scale(0.96);
307
+ }
308
+ </style>
@@ -0,0 +1,11 @@
1
+ export default TemplateEditor;
2
+ type TemplateEditor = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const TemplateEditor: import("svelte").Component<{
7
+ template: import("./zone.svelte.js").Template;
8
+ }, {}, "">;
9
+ type $$ComponentProps = {
10
+ template: import("./zone.svelte.js").Template;
11
+ };
@@ -0,0 +1,272 @@
1
+ <script>
2
+ import { untrack } from 'svelte';
3
+ import Block from '../Block.svelte';
4
+ import { collect } from '../../overlays/context/collect.js';
5
+ import ZoneEditor from './ZoneEditor.svelte';
6
+
7
+ /** @type {{ block: import('./zone.svelte.js').ZoneBlock }} */
8
+ let { block } = $props();
9
+
10
+ let editing = $state(false);
11
+ let titleDraft = $state('');
12
+ /** @type {HTMLInputElement | null} */
13
+ let inputEl = $state(null);
14
+
15
+ const template = $derived(block.template ? block.zones.templates.get(block.template) : null);
16
+ const formattedTemplate = $derived(template ? template.renderLabel(block.count || 1, block.title) : null);
17
+
18
+ const displayLabel = $derived.by(() => {
19
+ if (!formattedTemplate) return block.title;
20
+ if (template?.label.includes('{{title}}')) return formattedTemplate;
21
+ if (block.title) return `${formattedTemplate} · ${block.title}`;
22
+ return formattedTemplate;
23
+ });
24
+
25
+ const progress = $derived(
26
+ block.wordCountTarget
27
+ ? Math.min(100, Math.round((block.wordCount / block.wordCountTarget) * 100))
28
+ : 0
29
+ );
30
+
31
+ function startEdit() {
32
+ titleDraft = block.title;
33
+ editing = true;
34
+ }
35
+
36
+ function commitTitle() {
37
+ block.title = titleDraft.trim();
38
+ editing = false;
39
+ }
40
+
41
+ /** @param {KeyboardEvent} e */
42
+ function onKeydown(e) {
43
+ e.stopPropagation();
44
+ if (e.key === 'Enter' || e.key === 'Escape') {
45
+ e.preventDefault();
46
+ commitTitle();
47
+ }
48
+ }
49
+
50
+ /** @param {InputEvent} e */
51
+ function onBeforeInput(e) {
52
+ e.stopPropagation();
53
+ }
54
+
55
+ $effect(() => {
56
+ if (editing && inputEl) {
57
+ inputEl.focus();
58
+ inputEl.select();
59
+ }
60
+ });
61
+
62
+ $effect(() => {
63
+ const tick = block._focusTitleTick;
64
+ if (tick === 0) return;
65
+ untrack(() => startEdit());
66
+ });
67
+ </script>
68
+
69
+ <div
70
+ class="nabu-zone"
71
+ data-block-id={block.id}
72
+ data-block-type="zone"
73
+ data-zone-id={block.id}
74
+ data-zone-status={block.status}
75
+ use:collect={() => [
76
+ {
77
+ key: `zone-editor-${block.id}`,
78
+ component: ZoneEditor,
79
+ props: { block },
80
+ },
81
+ {
82
+ key: `zone-actions-${block.id}`,
83
+ items: [
84
+ { label: 'Renommer', action: () => block.focusTitle() },
85
+ { label: 'Unwrap', action: () => block.nabu.exec('zone:unwrap', { zoneId: block.id }) },
86
+ ],
87
+ },
88
+ ]}
89
+ >
90
+ {#each block.children as child (child.id)}
91
+ <Block block={child} />
92
+ {/each}<!--
93
+ Zone UI overlay: boundaries + title (contenteditable=false = hors-flux éditeur)
94
+ CRITICAL: DO NOT REMOVE contenteditable="false" OR pointer-events: none.
95
+ --><div class="nabu-zone-ui" contenteditable="false" aria-hidden="true" style="user-select: none;">
96
+
97
+ <!-- Lignes horizontales minimalistes (section breaks) -->
98
+ <div class="nabu-zone-boundary nabu-zone-boundary--top" data-nabu-inert></div>
99
+ <div class="nabu-zone-boundary nabu-zone-boundary--bottom" data-nabu-inert></div>
100
+
101
+ <!-- Le Badge Flottant en haut à gauche -->
102
+ <div class="nabu-zone-title" data-nabu-ui>
103
+ {#if editing}
104
+ <input
105
+ bind:this={inputEl}
106
+ bind:value={titleDraft}
107
+ class="nabu-zone-title-input"
108
+ placeholder="Titre de la zone…"
109
+ onblur={commitTitle}
110
+ onkeydown={onKeydown}
111
+ onbeforeinput={onBeforeInput}
112
+ />
113
+ {:else}
114
+ <span class="nabu-zone-title-label" onclick={startEdit}>
115
+ {displayLabel || 'Nouvelle Zone'}
116
+ </span>
117
+ {/if}
118
+
119
+ {#if block.wordCountTarget || block.wordCount > 0}
120
+ <span
121
+ class="nabu-zone-wc"
122
+ class:has-target={block.wordCountTarget != null}
123
+ class:is-done={block.wordCountTarget && block.wordCount >= block.wordCountTarget}
124
+ style={block.wordCountTarget ? `--progress: ${progress}%` : ''}
125
+ >
126
+ {#if block.wordCountTarget}
127
+ {block.wordCount} / {block.wordCountTarget}
128
+ {:else}
129
+ {block.wordCount} mots
130
+ {/if}
131
+ </span>
132
+ {/if}
133
+ </div>
134
+
135
+ </div>
136
+ </div>
137
+
138
+ <style>
139
+ .nabu-zone {
140
+ /* On augmente un peu la marge externe pour que les badges ne se touchent jamais */
141
+ margin: 1.5rem 0;
142
+ /* Plus d'espace en haut (1.5rem) pour laisser respirer le texte sous la pilule */
143
+ padding: 1.5rem 0 0.75rem 0;
144
+ position: relative;
145
+ }
146
+
147
+ .nabu-zone-ui {
148
+ position: absolute;
149
+ inset: 0;
150
+ pointer-events: none;
151
+ }
152
+
153
+ /* Les "fences" (lignes) sont devenues horizontales et s'effacent doucement en dégradé */
154
+ .nabu-zone-boundary {
155
+ position: absolute;
156
+ left: 0;
157
+ width: 100%;
158
+ max-width: 250px; /* La ligne disparait dans le vide, très littéraire */
159
+ height: 1px;
160
+ pointer-events: none;
161
+ }
162
+
163
+ .nabu-zone-boundary--top {
164
+ top: 0;
165
+ background: linear-gradient(to right, var(--nb-border, hsla(0, 0%, 100%, 0.1)), transparent);
166
+ }
167
+
168
+ .nabu-zone-boundary--bottom {
169
+ bottom: 0;
170
+ background: linear-gradient(to right, var(--nb-border-subtle, hsla(0, 0%, 100%, 0.05)), transparent);
171
+ }
172
+
173
+ /* Couleurs de statut appliquées à la ligne du haut */
174
+ [data-zone-status="revised"] > .nabu-zone-ui > .nabu-zone-boundary--top { background: linear-gradient(to right, var(--nb-warning, rgba(245, 158, 11, 0.4)), transparent); }
175
+ [data-zone-status="done"] > .nabu-zone-ui > .nabu-zone-boundary--top { background: linear-gradient(to right, var(--nb-success-bg, rgba(16, 185, 129, 0.4)), transparent); }
176
+
177
+ /* Badge Titre Flottant */
178
+ .nabu-zone-title {
179
+ position: absolute;
180
+ top: 0;
181
+ left: 0;
182
+ transform: translateY(-50%);
183
+ pointer-events: all; /* Important pour rendre le badge cliquable */
184
+ display: flex;
185
+ align-items: center;
186
+ gap: 6px;
187
+ z-index: 10;
188
+ }
189
+
190
+ .nabu-zone-title-label {
191
+ font-size: 10px;
192
+ font-weight: 500;
193
+ letter-spacing: 0.03em;
194
+ color: var(--nb-text-muted, hsla(0, 0%, 100%, 0.4));
195
+ background: var(--nb-bg-surface, hsla(0, 0%, 15%, 0.6));
196
+ backdrop-filter: var(--nb-glass-blur-sm, blur(12px));
197
+ -webkit-backdrop-filter: var(--nb-glass-blur-sm, blur(12px));
198
+ padding: 2px 8px;
199
+ border-radius: 12px;
200
+ border: 1px solid var(--nb-border-subtle, hsla(0, 0%, 100%, 0.05));
201
+ cursor: pointer;
202
+ transition: all 0.2s ease;
203
+ user-select: none;
204
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
205
+ white-space: nowrap;
206
+ }
207
+
208
+ .nabu-zone-title-label:hover {
209
+ color: var(--nb-text-primary, hsla(0, 0%, 100%, 0.8));
210
+ background: var(--nb-bg-surface-active, hsla(0, 0%, 20%, 0.8));
211
+ border-color: var(--nb-border, hsla(0, 0%, 100%, 0.1));
212
+ box-shadow: 0 4px 8px rgba(0,0,0,0.2);
213
+ }
214
+
215
+ .nabu-zone-title-input {
216
+ font-size: 10px;
217
+ font-weight: 500;
218
+ letter-spacing: 0.03em;
219
+ color: var(--nb-text-primary, hsla(0, 0%, 100%, 0.9));
220
+ background: var(--nb-bg-surface-sunken, hsla(0, 0%, 0%, 0.6));
221
+ backdrop-filter: var(--nb-glass-blur-sm, blur(12px));
222
+ -webkit-backdrop-filter: var(--nb-glass-blur-sm, blur(12px));
223
+ padding: 2px 8px;
224
+ border-radius: 12px;
225
+ border: 1px solid var(--nb-border-focus, hsla(0, 0%, 100%, 0.2));
226
+ outline: none;
227
+ width: 140px;
228
+ box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
229
+ font-family: inherit;
230
+ }
231
+
232
+ .nabu-zone-wc {
233
+ font-size: 9px;
234
+ font-weight: 600;
235
+ text-transform: uppercase;
236
+ letter-spacing: 0.06em;
237
+ color: var(--nb-text-muted, hsla(0, 0%, 100%, 0.4));
238
+ background: var(--nb-bg-surface-sunken, hsla(0, 0%, 100%, 0.03));
239
+ padding: 2px 6px;
240
+ border-radius: 8px;
241
+ border: 1px solid var(--nb-border-subtle, hsla(0, 0%, 100%, 0.02));
242
+ user-select: none;
243
+ position: relative;
244
+ overflow: hidden;
245
+ transition: all 0.3s ease;
246
+ z-index: 1; /* Keep text above the pseudo-element */
247
+ }
248
+
249
+ .nabu-zone-wc.has-target {
250
+ color: var(--nb-text-secondary, hsla(0, 0%, 100%, 0.7));
251
+ border-color: var(--nb-border, hsla(0, 0%, 100%, 0.05));
252
+ }
253
+
254
+ .nabu-zone-wc.has-target::before {
255
+ content: '';
256
+ position: absolute;
257
+ top: 0; left: 0; bottom: 0;
258
+ width: var(--progress, 0%);
259
+ background: var(--nb-accent, hsla(210, 100%, 60%, 0.25)); /* Progress blue fill */
260
+ z-index: -1;
261
+ transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
262
+ }
263
+
264
+ .nabu-zone-wc.is-done {
265
+ color: var(--nb-success, hsla(150, 100%, 60%, 0.9));
266
+ border-color: var(--nb-success-bg, hsla(150, 100%, 60%, 0.2));
267
+ }
268
+
269
+ .nabu-zone-wc.is-done::before {
270
+ background: var(--nb-success-bg, hsla(150, 100%, 60%, 0.15)); /* Done green fill */
271
+ }
272
+ </style>
@@ -0,0 +1,11 @@
1
+ export default Zone;
2
+ type Zone = {
3
+ $on?(type: string, callback: (e: any) => void): () => void;
4
+ $set?(props: Partial<$$ComponentProps>): void;
5
+ };
6
+ declare const Zone: import("svelte").Component<{
7
+ block: import("./zone.svelte.js").ZoneBlock;
8
+ }, {}, "">;
9
+ type $$ComponentProps = {
10
+ block: import("./zone.svelte.js").ZoneBlock;
11
+ };