@veroxm/react-sdk 1.11.0 → 1.11.1

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,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.11.1
4
+
5
+ - The editing bar no longer covers the slot panel's buttons. When the bar wraps to more rows (a narrow window,
6
+ longer Arabic words), the panel and the slot list end above it: their bottom follows the bar's measured height
7
+ (`ResizeObserver`), and they sit above the bar in stacking order. The interface language and Arabic digits are
8
+ one menu (English / العربية · 0123 / العربية · ٠١٢٣), and the project name hides in windows under 1000px, so the
9
+ bar stays one row where it can (863px wide: one row in English and Arabic).
10
+
3
11
  ## 1.11.0
4
12
 
5
13
  - The on-page editor in Arabic. Every word of the editor (the editing bar, the panel, buttons, messages, errors, empty
@@ -394,11 +394,29 @@ function Overlay({ onChange, tools }) {
394
394
  document.documentElement.removeEventListener('mouseleave', onLeave);
395
395
  };
396
396
  }, [editMode, ended]);
397
+ // The bar can wrap (a narrow window, longer Arabic words): the panel and the slot list always end above it, so the
398
+ // bar never covers the panel's buttons. barSpace = from the bar's top edge to the bottom of the window.
399
+ const barRef = useRef(null);
400
+ const [barSpace, setBarSpace] = useState(64);
401
+ useEffect(() => {
402
+ const bar = barRef.current;
403
+ if (!bar)
404
+ return;
405
+ const measure = () => setBarSpace(Math.max(0, Math.ceil(window.innerHeight - bar.getBoundingClientRect().top)));
406
+ measure();
407
+ const observer = typeof ResizeObserver === 'function' ? new ResizeObserver(measure) : null;
408
+ observer?.observe(bar);
409
+ window.addEventListener('resize', measure);
410
+ return () => {
411
+ observer?.disconnect();
412
+ window.removeEventListener('resize', measure);
413
+ };
414
+ }, []);
397
415
  const openEl = open ? slotElement(open.name, open.locale) : null;
398
416
  const hoverRect = hover && hover !== openEl ? rectOf(hover) : null;
399
417
  const openRect = rectOf(openEl);
400
418
  const fieldRect = openEl && highlightField ? rectOf(openEl.querySelector(`[data-veroxm-field="${CSS.escape(highlightField)}"]`)) : null;
401
- return (_jsx(Ui.Provider, { value: ui, children: _jsxs("div", { ref: rootRef, className: "vx-root", "data-veroxm-overlay": "", dir: ui.dir, lang: ui.lang, children: [_jsx("style", { children: STYLES + RICH_TEXT_STYLES + MENU_STYLES }), hoverRect && _jsx(Outline, { rect: hoverRect, label: hover ? elementLabel(ui, hover) : '' }), openRect && _jsx(Outline, { rect: openRect, active: true }), fieldRect && !inlineHint && _jsx(Outline, { rect: fieldRect, field: true }), inlineHint ? _jsx(InlineHintBar, { hint: inlineHint }) : null, open && session && !ended && (_jsx(SlotPanel, { slot: open, canPublish: session.canPublish, canManageTests: session.canManageTests ?? false, canUploadMedia: session.canUploadMedia ?? false, dashboardUrl: session.dashboardUrl ?? null, onClose: () => {
419
+ return (_jsx(Ui.Provider, { value: ui, children: _jsxs("div", { ref: rootRef, className: "vx-root", "data-veroxm-overlay": "", dir: ui.dir, lang: ui.lang, style: { '--vx-bar-space': `${barSpace}px` }, children: [_jsx("style", { children: STYLES + RICH_TEXT_STYLES + MENU_STYLES }), hoverRect && _jsx(Outline, { rect: hoverRect, label: hover ? elementLabel(ui, hover) : '' }), openRect && _jsx(Outline, { rect: openRect, active: true }), fieldRect && !inlineHint && _jsx(Outline, { rect: fieldRect, field: true }), inlineHint ? _jsx(InlineHintBar, { hint: inlineHint }) : null, open && session && !ended && (_jsx(SlotPanel, { slot: open, canPublish: session.canPublish, canManageTests: session.canManageTests ?? false, canUploadMedia: session.canUploadMedia ?? false, dashboardUrl: session.dashboardUrl ?? null, onClose: () => {
402
420
  setOpen(null);
403
421
  setHighlightField(null);
404
422
  }, onFieldFocus: setHighlightField, onSessionError: onSessionError, onChange: onChange, onInline: setInlineHint }, `${open.name}|${open.locale}`)), listOpen && (_jsx(SlotList, { onPick: (s) => {
@@ -408,7 +426,17 @@ function Overlay({ onChange, tools }) {
408
426
  }, onClose: () => {
409
427
  setListOpen(false);
410
428
  listToggleRef.current?.focus();
411
- } })), _jsxs("div", { className: "vx-toolbar", role: "toolbar", "aria-label": ui.t('bar.aria'), dir: ui.dir, lang: ui.lang, children: [_jsxs("span", { className: "vx-brand", children: [_jsx("span", { className: "vx-dot", "aria-hidden": "true" }), ended ? ui.t('bar.ended') : ui.t('bar.editing'), session?.projectName ? (_jsxs("span", { className: "vx-muted", children: [' · ', _jsx("bdi", { children: session.projectName })] })) : null] }), ended ? (_jsx("span", { className: "vx-muted vx-ended", role: "alert", children: ended })) : (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "vx-btn", "aria-pressed": editMode, onClick: () => setEditMode((v) => !v), children: editMode ? ui.t('bar.clickOn') : ui.t('bar.clickOff') }), _jsx("button", { type: "button", ref: listToggleRef, className: "vx-btn", "data-vx-list-toggle": "", "aria-expanded": listOpen, onClick: () => setListOpen((v) => !v), children: ui.t('bar.slots') }), tools] })), _jsx("select", { className: "vx-lang", "aria-label": ui.t('bar.language'), value: ui.lang, onChange: (e) => savePrefs({ ...prefs, language: editorLang(e.target.value) ?? 'en' }), children: EDITOR_LANGS.map((l) => (_jsx("option", { value: l, lang: l, children: LANG_NAMES[l] }, l))) }), ui.lang === 'ar' ? (_jsxs("select", { className: "vx-lang", "aria-label": ui.t('bar.digits'), value: ui.digits, onChange: (e) => savePrefs({ ...prefs, digits: e.target.value === 'arab' ? 'arab' : 'latn' }), children: [_jsx("option", { value: "latn", children: ui.t('bar.digitsLatn') }), _jsx("option", { value: "arab", children: ui.t('bar.digitsArab') })] })) : null, _jsx("button", { type: "button", className: "vx-btn", onClick: () => transport.exit(), children: ui.t('bar.exit') })] })] }) }));
429
+ } })), _jsxs("div", { ref: barRef, className: "vx-toolbar", role: "toolbar", "aria-label": ui.t('bar.aria'), dir: ui.dir, lang: ui.lang, children: [_jsxs("span", { className: "vx-brand", children: [_jsx("span", { className: "vx-dot", "aria-hidden": "true" }), ended ? ui.t('bar.ended') : ui.t('bar.editing'), session?.projectName ? (_jsxs("span", { className: "vx-muted vx-project", title: session.projectName, children: [' · ', _jsx("bdi", { children: session.projectName })] })) : null] }), ended ? (_jsx("span", { className: "vx-muted vx-ended", role: "alert", children: ended })) : (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", className: "vx-btn", "aria-pressed": editMode, onClick: () => setEditMode((v) => !v), children: editMode ? ui.t('bar.clickOn') : ui.t('bar.clickOff') }), _jsx("button", { type: "button", ref: listToggleRef, className: "vx-btn", "data-vx-list-toggle": "", "aria-expanded": listOpen, onClick: () => setListOpen((v) => !v), children: ui.t('bar.slots') }), tools] })), _jsx("select", { className: "vx-lang", "aria-label": ui.t('bar.language'), title: ui.t('bar.language'), value: ui.lang === 'ar' ? `ar-${ui.digits}` : ui.lang, onChange: (e) => {
430
+ const [language, digits] = e.target.value.split('-');
431
+ savePrefs({ language: editorLang(language) ?? 'en', digits: digits === 'arab' ? 'arab' : digits === 'latn' ? 'latn' : prefs.digits });
432
+ }, children: EDITOR_LANGS.flatMap((l) => l === 'ar'
433
+ ? [
434
+ _jsxs("option", { value: "ar-latn", lang: "ar", "aria-label": `${LANG_NAMES.ar} – ${ui.t('bar.digitsLatn')}`, children: [LANG_NAMES.ar, " \u00B7 0123"] }, "ar-latn"),
435
+ _jsxs("option", { value: "ar-arab", lang: "ar", "aria-label": `${LANG_NAMES.ar} – ${ui.t('bar.digitsArab')}`, children: [LANG_NAMES.ar, " \u00B7 \u0660\u0661\u0662\u0663"] }, "ar-arab"),
436
+ ]
437
+ : [
438
+ _jsx("option", { value: l, lang: l, children: LANG_NAMES[l] }, l),
439
+ ]) }), _jsx("button", { type: "button", className: "vx-btn", onClick: () => transport.exit(), children: ui.t('bar.exit') })] })] }) }));
412
440
  }
413
441
  /** A slot's name on the page, in the interface language (data-veroxm-labels), else its one label, else its name. */
414
442
  function elementLabel(ui, el) {
@@ -1130,17 +1158,20 @@ const STYLES = `
1130
1158
  .vx-tag{position:absolute;top:-24px;inset-inline-start:-2px;background:#6d28d9;color:#fff;font-size:12px;padding:2px 8px;border-radius:4px;white-space:nowrap}
1131
1159
  .vx-toolbar{position:fixed;z-index:2147483002;left:50%;bottom:16px;transform:translateX(-50%);width:max-content;display:flex;flex-wrap:wrap;align-items:center;gap:8px;max-width:calc(100vw - 32px);background:#18181b;color:#fafafa;padding:8px 10px;border-radius:12px;box-shadow:0 8px 30px rgba(0,0,0,.3)}
1132
1160
  .vx-toolbar .vx-muted{color:#a1a1aa}
1133
- .vx-brand{display:flex;align-items:center;gap:6px;font-weight:600;padding:0 4px}
1161
+ .vx-brand{display:flex;align-items:center;gap:6px;font-weight:600;padding:0 4px;white-space:nowrap;min-width:0}
1162
+ .vx-project{max-width:10rem;overflow:hidden;text-overflow:ellipsis}
1163
+ .vx-toolbar .vx-btn{white-space:nowrap}
1164
+ @media (max-width:1000px){.vx-project{display:none}}
1134
1165
  .vx-dot{width:8px;height:8px;border-radius:50%;background:#a78bfa}
1135
1166
  .vx-ended{max-width:28rem}
1136
1167
  .vx-btn{appearance:none;cursor:pointer;display:inline-flex;align-items:center;min-height:32px;padding:4px 12px;border-radius:8px;border:1px solid #d4d4d8;background:#fff;color:#18181b;text-decoration:none}
1137
1168
  .vx-toolbar .vx-btn{background:#27272a;border-color:#3f3f46;color:#fafafa}
1138
1169
  .vx-toolbar .vx-btn[aria-pressed="true"]{background:#4c1d95;border-color:#6d28d9}
1139
- .vx-lang{appearance:auto;min-height:32px;padding:4px 8px;border-radius:8px;border:1px solid #3f3f46;background:#27272a;color:#fafafa;cursor:pointer}
1170
+ .vx-lang{appearance:auto;min-height:32px;max-width:9.5rem;padding:4px 8px;border-radius:8px;border:1px solid #3f3f46;background:#27272a;color:#fafafa;cursor:pointer}
1140
1171
  .vx-btn:disabled{opacity:.5;cursor:not-allowed}
1141
1172
  .vx-primary{background:#6d28d9;border-color:#6d28d9;color:#fff}
1142
1173
  .vx-root :focus-visible{outline:2px solid #f59e0b;outline-offset:2px}
1143
- .vx-panel{position:fixed;z-index:2147483001;top:12px;inset-inline-end:12px;bottom:76px;width:min(380px,calc(100vw - 24px));display:flex;flex-direction:column;background:#fff;border:1px solid #e4e4e7;border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.18)}
1174
+ .vx-panel{position:fixed;z-index:2147483003;top:12px;inset-inline-end:12px;bottom:calc(var(--vx-bar-space,64px) + 12px);max-height:calc(100vh - var(--vx-bar-space,64px) - 24px);width:min(380px,calc(100vw - 24px));display:flex;flex-direction:column;background:#fff;border:1px solid #e4e4e7;border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.18)}
1144
1175
  .vx-panel-head{display:flex;justify-content:space-between;gap:8px;padding:14px 16px;border-bottom:1px solid #f4f4f5}
1145
1176
  .vx-panel-head h2{margin:0;font-size:16px;font-weight:650}
1146
1177
  .vx-panel-head p{margin:2px 0 0}
@@ -1179,7 +1210,7 @@ const STYLES = `
1179
1210
  .vx-review-title{margin:0;font-weight:600}
1180
1211
  .vx-review-comment{width:100%;padding:6px 8px;border:1px solid #d4d4d8;border-radius:8px;background:#fff;resize:vertical}
1181
1212
  .vx-review-withdraw{align-self:flex-start;margin-top:4px}
1182
- .vx-list{position:fixed;z-index:2147483002;left:50%;bottom:70px;transform:translateX(-50%);width:min(360px,calc(100vw - 24px));max-height:50vh;overflow:auto;background:#fff;border:1px solid #e4e4e7;border-radius:12px;box-shadow:0 12px 40px rgba(0,0,0,.18);padding:10px}
1213
+ .vx-list{position:fixed;z-index:2147483003;left:50%;bottom:calc(var(--vx-bar-space,64px) + 8px);transform:translateX(-50%);width:min(360px,calc(100vw - 24px));max-height:50vh;overflow:auto;background:#fff;border:1px solid #e4e4e7;border-radius:12px;box-shadow:0 12px 40px rgba(0,0,0,.18);padding:10px}
1183
1214
  .vx-list-title{font-weight:650;margin:0 0 6px}
1184
1215
  .vx-list ul{list-style:none;margin:0;padding:0}
1185
1216
  .vx-list button{appearance:none;cursor:pointer;width:100%;text-align:start;border:0;background:transparent;padding:8px;border-radius:8px;display:flex;gap:6px;align-items:baseline;flex-wrap:wrap}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veroxm/react-sdk",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "React and Next.js SDK for VeroXM: content hooks, visual slots with A/B tests, the on-page editor, forms and product journeys, llms.txt and structured data.",
5
5
  "keywords": [
6
6
  "veroxm",