@aparte/core 0.32.0 → 0.32.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.
@@ -2152,6 +2152,8 @@ function openCard(chip) {
2152
2152
  const el2 = document.createElement("div");
2153
2153
  el2.className = "aparte-citation-card aparte-popover";
2154
2154
  el2.id = `aparte-citation-card-${++cards}`;
2155
+ const transcript = chip.closest(".aparte-viewport-container, aparte-chat-viewport") ?? chip.ownerDocument.documentElement;
2156
+ el2.dir = getComputedStyle(transcript).direction === "rtl" ? "rtl" : "ltr";
2155
2157
  el2.setAttribute("role", "dialog");
2156
2158
  el2.setAttribute("aria-label", config.getLocale().sourcesCard ?? "Sources");
2157
2159
  const body = document.createElement("div");
@@ -2293,6 +2295,7 @@ function drawCard() {
2293
2295
  link.rel = "noopener noreferrer";
2294
2296
  link.dataset.aparteCardPart = "link";
2295
2297
  link.textContent = title;
2298
+ link.dir = "auto";
2296
2299
  const hint = document.createElement("span");
2297
2300
  hint.className = "aparte-sr-only";
2298
2301
  hint.textContent = ` ${locale.opensInNewTab ?? "(opens in a new tab)"}`;
@@ -2302,6 +2305,7 @@ function drawCard() {
2302
2305
  const plain = document.createElement("p");
2303
2306
  plain.className = "aparte-citation-card__title";
2304
2307
  plain.textContent = title;
2308
+ plain.dir = "auto";
2305
2309
  body.append(plain);
2306
2310
  }
2307
2311
  const domain = sourceDomain(source);
@@ -2309,12 +2313,14 @@ function drawCard() {
2309
2313
  const p = document.createElement("p");
2310
2314
  p.className = "aparte-citation-card__domain";
2311
2315
  p.textContent = domain;
2316
+ p.dir = "auto";
2312
2317
  body.append(p);
2313
2318
  }
2314
2319
  if (source.snippet) {
2315
2320
  const p = document.createElement("p");
2316
2321
  p.className = "aparte-citation-card__snippet";
2317
2322
  p.textContent = source.snippet;
2323
+ p.dir = "auto";
2318
2324
  body.append(p);
2319
2325
  }
2320
2326
  if (sources2.length > 1) {
@@ -2385,18 +2391,20 @@ function renderSourceList(container, after, sources2, config) {
2385
2391
  link.target = "_blank";
2386
2392
  link.rel = "noopener noreferrer";
2387
2393
  link.textContent = title;
2394
+ link.dir = "auto";
2388
2395
  const hint = document.createElement("span");
2389
2396
  hint.className = "aparte-sr-only";
2390
2397
  hint.textContent = ` ${hintText}`;
2391
2398
  link.append(hint);
2392
2399
  item.append(link);
2393
2400
  } else {
2394
- item.append(title);
2401
+ item.append(Object.assign(document.createElement("span"), { textContent: title, dir: "auto" }));
2395
2402
  }
2396
2403
  if (domain && domain !== title) {
2397
2404
  const d = document.createElement("span");
2398
2405
  d.className = "aparte-sources__domain";
2399
2406
  d.textContent = domain;
2407
+ d.dir = "auto";
2400
2408
  item.append(" ", d);
2401
2409
  }
2402
2410
  items.append(item);
@@ -7982,6 +7990,7 @@ function el$1(tag, className, text) {
7982
7990
  function optionBody(label, description, recommended) {
7983
7991
  const body = el$1("span", "aparte-elic-option-body");
7984
7992
  const title = el$1("span", "aparte-elic-option-title", label);
7993
+ title.dir = "auto";
7985
7994
  if (recommended) {
7986
7995
  const badge = el$1(
7987
7996
  "span",
@@ -7991,7 +8000,7 @@ function optionBody(label, description, recommended) {
7991
8000
  title.append(" ", badge);
7992
8001
  }
7993
8002
  body.appendChild(title);
7994
- if (description) body.appendChild(el$1("span", "aparte-elic-option-desc", description));
8003
+ if (description) body.appendChild(Object.assign(el$1("span", "aparte-elic-option-desc", description), { dir: "auto" }));
7995
8004
  return body;
7996
8005
  }
7997
8006
  function commandOption(label, description, recommended) {
@@ -8004,11 +8013,12 @@ function fieldHeader(parent, field, skipTitle) {
8004
8013
  let titleId;
8005
8014
  if (field.title && field.title.trim() !== skipTitle?.trim()) {
8006
8015
  const title = el$1("p", "aparte-elic-title", field.title);
8016
+ title.dir = "auto";
8007
8017
  titleId = `elic-title-${uuid()}`;
8008
8018
  title.id = titleId;
8009
8019
  parent.appendChild(title);
8010
8020
  }
8011
- if (field.description) parent.appendChild(el$1("p", "aparte-elic-desc", field.description));
8021
+ if (field.description) parent.appendChild(Object.assign(el$1("p", "aparte-elic-desc", field.description), { dir: "auto" }));
8012
8022
  return titleId;
8013
8023
  }
8014
8024
  function labelGroup(list, opts) {
@@ -8187,6 +8197,7 @@ function buildBooleanField(field, onChange, fallbackLabel, settle) {
8187
8197
  if (field.default != null && String(field.default) === val) control.checked = true;
8188
8198
  const body = el$1("span", "aparte-elic-option-body");
8189
8199
  const title = el$1("span", "aparte-elic-option-title", label);
8200
+ title.dir = "auto";
8190
8201
  if (defaulted) onRelabel(() => {
8191
8202
  title.textContent = contextConfig().t(defaulted);
8192
8203
  });
@@ -8274,7 +8285,7 @@ function buildElicitationPanel(message, schema, onChange) {
8274
8285
  function buildPanel(message, schema, onChange) {
8275
8286
  const panel = el$1("div", "aparte-elic-panel");
8276
8287
  const asked2 = typeof message === "function" ? message() : message;
8277
- if (asked2) panel.appendChild(el$1("p", "aparte-elic-message", asked2));
8288
+ if (asked2) panel.appendChild(Object.assign(el$1("p", "aparte-elic-message", asked2), { dir: "auto" }));
8278
8289
  let settleCb = null;
8279
8290
  let settled2 = false;
8280
8291
  const settle = (content) => {
@@ -8309,7 +8320,7 @@ function buildPanel(message, schema, onChange) {
8309
8320
  const fields = entries.map(([key, field2]) => {
8310
8321
  const built = buildField(field2, notify, void 0, key);
8311
8322
  if (!field2.title && !built.el.querySelector(".aparte-elic-title")) {
8312
- built.el.insertBefore(el$1("p", "aparte-elic-title", key), built.el.firstChild);
8323
+ built.el.insertBefore(Object.assign(el$1("p", "aparte-elic-title", key), { dir: "auto" }), built.el.firstChild);
8313
8324
  }
8314
8325
  body.appendChild(built.el);
8315
8326
  return { key, field: built, required: requiredKeys.has(key), header: field2.header };
@@ -8342,6 +8353,7 @@ function buildPanel(message, schema, onChange) {
8342
8353
  chip.type = "button";
8343
8354
  chip.setAttribute("role", "tab");
8344
8355
  chip.textContent = f.header?.trim() || String(i + 1);
8356
+ chip.dir = "auto";
8345
8357
  chip.addEventListener("click", () => {
8346
8358
  show(i);
8347
8359
  f.field.focus();
@@ -8352,7 +8364,9 @@ function buildPanel(message, schema, onChange) {
8352
8364
  f.field.el.setAttribute("aria-labelledby", chip.id);
8353
8365
  chip.setAttribute("aria-controls", f.field.el.id);
8354
8366
  chip.addEventListener("keydown", (e) => {
8355
- const step = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
8367
+ const forward = getComputedStyle(steps).direction === "rtl" ? "ArrowLeft" : "ArrowRight";
8368
+ const back = forward === "ArrowRight" ? "ArrowLeft" : "ArrowRight";
8369
+ const step = e.key === forward ? 1 : e.key === back ? -1 : 0;
8356
8370
  let next = -1;
8357
8371
  if (step) next = (i + step + fields.length) % fields.length;
8358
8372
  else if (e.key === "Home") next = 0;
@@ -8419,7 +8433,7 @@ function buildApprovalPanel(message, options, onChange, details, allowOther = tr
8419
8433
  const body = el("div", "aparte-elic-body");
8420
8434
  panel.appendChild(body);
8421
8435
  const askText = () => typeof message === "function" ? message() : message;
8422
- const ask = askText() ? el("p", "aparte-elic-message", askText()) : null;
8436
+ const ask = askText() ? Object.assign(el("p", "aparte-elic-message", askText()), { dir: "auto" }) : null;
8423
8437
  if (ask) body.appendChild(ask);
8424
8438
  let argsLabel = null;
8425
8439
  if (details) {
@@ -10549,4 +10563,4 @@ export {
10549
10563
  collectRendererStyles as y,
10550
10564
  contentToText as z
10551
10565
  };
10552
- //# sourceMappingURL=defer-hydration-ggxlbvL9.js.map
10566
+ //# sourceMappingURL=defer-hydration-DQKULLmH.js.map