docblocks-react-ui 0.4.6 → 0.4.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # docblocks-react-ui
2
2
 
3
+ ## 0.4.7
4
+
5
+ ### Patch Changes
6
+
7
+ - e065e49: The `DocblocksI18nProvider` (exported from the package entry) accepts an
8
+ optional `locale` prop: the controlled mode for server-rendered
9
+ consumers, where the `<html lang>` read is unavailable on the server and
10
+ the first client render would take a different language (the hydration
11
+ mismatch). The passed locale is normalized over the existing rules
12
+ (`ru*` → `ru`, `en*` / unknown / empty → `en`), the provider creates its
13
+ own synchronously initialized `i18next` instance keyed by the normalized
14
+ value (a locale change selects the new instance and re-renders the
15
+ subtree), and a nested provider without a `locale` inherits the outer's
16
+ instance. The controlled mode never mutates the legacy attribute-driven
17
+ instance and never touches the consumer's global `i18next`, so
18
+ concurrent subtrees over different locales stay isolated; the locale is
19
+ UI state only. Outside a controlled provider, the attribute-driven
20
+ behavior is unchanged.
21
+ - 3223722: The page view now edits over one shared `contenteditable` surface (the
22
+ page's container), with each text block's inner a nested editable: the
23
+ native selection crosses block boundaries in every engine, and the
24
+ block's handlers receive the container-level events through a dispatch
25
+ that resolves the active block from the live selection. The follow-up
26
+ keys run in the shared surface's context, so the in-block range's
27
+ Delete / Backspace commits as a command (the caret re-seats at the
28
+ range's start), the empty cell's activation layer suppresses the
29
+ line-backspace, and the Home / End over a page text block resolve the
30
+ block's own line edges. The gutter-handle drag's release keeps the
31
+ user's text seat: the browser's release over the drag's non-editable
32
+ chrome would collapse the selection to the page container (and the
33
+ release's click would stand a residual blocks selection), so the drag
34
+ session suppresses the release's click over non-text chrome and
35
+ restores the captured seat on the release (a drop over a text inner
36
+ seats the caret at the drop point instead).
37
+ - aa7ffb3: The table's row/column drag preview now applies the transform over the
38
+ dragged row/column's cells instead of the row element (the `<tr>` is not
39
+ a CSS transformable element — the engine may ignore the row's
40
+ transform, leaving the preview dead while the handle follows the
41
+ pointer). The dragged cell reads as a lifted card (a `--card`
42
+ background + a `--docblocks-table-drag-shadow` box shadow over the
43
+ uncolored cells, behind the cell's own row/column color), so the
44
+ preview is visible over an empty table. The read-only modes render an
45
+ empty table cell's placeholder (one line, matching the activation
46
+ layer's footprint), keeping the edit mode's minimum row height in the
47
+ view/published views.
48
+
3
49
  ## 0.4.6
4
50
 
5
51
  ### Patch Changes
package/README.md CHANGED
@@ -550,11 +550,40 @@ and pan are view state — they never reach the document.
550
550
  ### Localization
551
551
 
552
552
  The editor's UI strings ship localized (en + ru). The language is
553
- consumer-driven — the package reads the `<html lang>` attribute (the `ru*`
554
- prefix stands the Russian stand; the absent / unknown language falls back
553
+ consumer-driven: by default the package reads the `<html lang>` attribute
554
+ (the `ru*` prefix picks Russian; the absent / unknown language falls back
555
555
  to English) and follows the attribute's change at runtime (the editor
556
- re-renders over the flip). There is no `locale` prop — the document's
557
- language is the consumer's, set on `<html>`.
556
+ re-renders over the flip).
557
+
558
+ **Controlled locale (SSR / hydration).** For server-rendered consumers
559
+ the `<html lang>` read is unavailable on the server, so the server render
560
+ would take English while the first client render takes the browser's
561
+ language — a hydration mismatch for any `ru` document. The
562
+ `DocblocksI18nProvider` accepts an optional `locale` prop that pins the
563
+ subtree's language explicitly (the consumer passes its own resolved
564
+ locale — the same value on the server and the first client render):
565
+
566
+ ```tsx
567
+ import { DocblocksI18nProvider } from "docblocks-react-ui";
568
+
569
+ <DocblocksI18nProvider locale={locale}>{/* the header + the editor */}</DocblocksI18nProvider>;
570
+ ```
571
+
572
+ - The passed locale is normalized over the same rules as the attribute
573
+ read: `ru*` → `ru`, `en*` / unknown / empty → `en`.
574
+ - A nested `DocblocksI18nProvider` without a `locale` inherits the
575
+ outer's instance — the package's internal scopes (`DocHeader`,
576
+ `EditorProvider`, the standalone `DatabaseTable`) keep the consumer's
577
+ locale without threading it through each component.
578
+ - The controlled mode runs its own `i18next` instance (one per provider,
579
+ keyed by the normalized locale — a locale change selects the new
580
+ instance and re-renders the subtree). It never mutates the legacy
581
+ attribute-driven instance and never touches the consumer's global
582
+ `i18next`, so concurrent subtrees over different locales stay
583
+ isolated. The locale is UI state only — it never reaches the document,
584
+ the CRDT, or the transport.
585
+ - Outside a controlled provider, the provider without a `locale` keeps
586
+ the attribute-driven behavior above.
558
587
 
559
588
  The package runs its **own** `i18next` instance (the shipped catalogs,
560
589
  `i18next` + `react-i18next` are runtime dependencies) under the