@syntrologie/adapt-faq 2.25.2 → 2.26.0

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/dist/editor.js CHANGED
@@ -3242,7 +3242,7 @@ var INTERACTIVE_TAGS = new Set(action_step_field_mapping_default.interactive_tag
3242
3242
  var INTERACTIVE_ROLES = new Set(action_step_field_mapping_default.interactive_roles);
3243
3243
 
3244
3244
  // src/editor.ts
3245
- import { html as html14, LitElement as LitElement13, nothing as nothing9 } from "lit";
3245
+ import { html as html15, LitElement as LitElement14, nothing as nothing10 } from "lit";
3246
3246
 
3247
3247
  // ../../shared-editor-ui/src/components/AnchorPickerLit.ts
3248
3248
  import { html as html3, LitElement as LitElement2, render as litRender, nothing as nothing3 } from "lit";
@@ -4676,8 +4676,85 @@ if (!customElements.get("se-group-header")) {
4676
4676
  customElements.define("se-group-header", GroupHeaderLit);
4677
4677
  }
4678
4678
 
4679
+ // ../../shared-editor-ui/src/components/InspectToggleLit.ts
4680
+ import { html as html11, LitElement as LitElement10, nothing as nothing6 } from "lit";
4681
+ var InspectToggleLit = class extends LitElement10 {
4682
+ constructor() {
4683
+ super(...arguments);
4684
+ this.inspecting = false;
4685
+ this.accent = "purple";
4686
+ this.inspectLabel = "Inspect";
4687
+ }
4688
+ createRenderRoot() {
4689
+ return this;
4690
+ }
4691
+ _emit(next) {
4692
+ this.inspecting = next;
4693
+ this.dispatchEvent(
4694
+ new CustomEvent("se-inspect-toggle", {
4695
+ detail: { inspecting: next },
4696
+ bubbles: true,
4697
+ composed: true
4698
+ })
4699
+ );
4700
+ }
4701
+ _accentClasses() {
4702
+ if (this.accent === "blue") {
4703
+ return {
4704
+ track: "se-bg-blue-4",
4705
+ activeText: "se-text-blue-4",
4706
+ kbd: "se-border-blue-4/40 se-bg-blue-4/15 se-text-blue-4"
4707
+ };
4708
+ }
4709
+ return {
4710
+ track: "se-bg-purple-4",
4711
+ activeText: "se-text-purple-4",
4712
+ kbd: "se-border-purple-4/40 se-bg-purple-4/15 se-text-purple-4"
4713
+ };
4714
+ }
4715
+ render() {
4716
+ const c = this._accentClasses();
4717
+ const inspecting = this.inspecting;
4718
+ return html11`
4719
+ <div class="se-flex se-items-center se-gap-3 se-text-xs se-text-text-secondary">
4720
+ <button
4721
+ type="button"
4722
+ role="switch"
4723
+ aria-checked=${inspecting ? "true" : "false"}
4724
+ aria-label="Toggle inspect mode"
4725
+ @click=${() => this._emit(!inspecting)}
4726
+ class=${`se-relative se-inline-flex se-h-5 se-w-9 se-shrink-0 se-cursor-pointer se-rounded-full se-border-none se-transition-colors se-duration-150 ${inspecting ? c.track : "se-bg-border-primary"}`}
4727
+ >
4728
+ <span
4729
+ aria-hidden="true"
4730
+ class=${`se-pointer-events-none se-inline-block se-h-4 se-w-4 se-rounded-full se-bg-white se-shadow-sm se-transition-transform se-duration-150 ${inspecting ? "se-translate-x-4" : "se-translate-x-0.5"}`}
4731
+ style="margin-top:2px"
4732
+ ></span>
4733
+ </button>
4734
+ <span class=${inspecting ? c.activeText : ""}>
4735
+ ${inspecting ? this.inspectLabel : "Navigate"}
4736
+ </span>
4737
+ ${inspecting ? nothing6 : html11`<span class="se-ml-auto se-flex se-items-center se-gap-1">
4738
+ or press
4739
+ <kbd
4740
+ class=${`se-px-1.5 se-py-0.5 se-rounded se-border se-text-[10px] se-font-semibold ${c.kbd}`}
4741
+ >Ctrl</kbd>
4742
+ </span>`}
4743
+ </div>
4744
+ `;
4745
+ }
4746
+ };
4747
+ InspectToggleLit.properties = {
4748
+ inspecting: { type: Boolean },
4749
+ accent: { type: String },
4750
+ inspectLabel: { type: String }
4751
+ };
4752
+ if (!customElements.get("se-inspect-toggle")) {
4753
+ customElements.define("se-inspect-toggle", InspectToggleLit);
4754
+ }
4755
+
4679
4756
  // ../../shared-editor-ui/src/components/TileChromeEditorLit.ts
4680
- import { css as css2, html as html11, LitElement as LitElement10, nothing as nothing6 } from "lit";
4757
+ import { css as css2, html as html12, LitElement as LitElement11, nothing as nothing7 } from "lit";
4681
4758
  var EMOJI_LIST2 = [
4682
4759
  "\u{1F4B5}",
4683
4760
  "\u{1F4B0}",
@@ -4727,7 +4804,7 @@ var EMOJI_LIST2 = [
4727
4804
  "\u{1F4B9}",
4728
4805
  "\u{1F321}\uFE0F"
4729
4806
  ];
4730
- var TileChromeEditorLit2 = class extends LitElement10 {
4807
+ var TileChromeEditorLit2 = class extends LitElement11 {
4731
4808
  constructor() {
4732
4809
  super(...arguments);
4733
4810
  this.tileMeta = { title: "", subtitle: "", icon: "" };
@@ -4745,7 +4822,7 @@ var TileChromeEditorLit2 = class extends LitElement10 {
4745
4822
  this._patch("icon", value);
4746
4823
  }
4747
4824
  render() {
4748
- return html11`
4825
+ return html12`
4749
4826
  <form @submit=${(e) => e.preventDefault()}>
4750
4827
  <label>
4751
4828
  <span>Title</span>
@@ -4778,13 +4855,13 @@ var TileChromeEditorLit2 = class extends LitElement10 {
4778
4855
  this._pickerOpen = !this._pickerOpen;
4779
4856
  }}
4780
4857
  >
4781
- ${this.tileMeta.icon ? html11`<span style="font-size: 20px">${this.tileMeta.icon}</span>` : html11`<span style="color: var(--syntro-text-tertiary, #87919f)">Choose icon…</span>`}
4858
+ ${this.tileMeta.icon ? html12`<span style="font-size: 20px">${this.tileMeta.icon}</span>` : html12`<span style="color: var(--syntro-text-tertiary, #87919f)">Choose icon…</span>`}
4782
4859
  </button>
4783
4860
 
4784
- ${this._pickerOpen ? html11`
4861
+ ${this._pickerOpen ? html12`
4785
4862
  <div data-emoji-grid class="emoji-grid">
4786
4863
  ${EMOJI_LIST2.map(
4787
- (emoji) => html11`
4864
+ (emoji) => html12`
4788
4865
  <button
4789
4866
  type="button"
4790
4867
  data-emoji=${emoji}
@@ -4795,7 +4872,7 @@ var TileChromeEditorLit2 = class extends LitElement10 {
4795
4872
  `
4796
4873
  )}
4797
4874
  </div>
4798
- ` : nothing6}
4875
+ ` : nothing7}
4799
4876
  </div>
4800
4877
  </form>
4801
4878
  `;
@@ -4909,13 +4986,13 @@ if (!customElements.get("syntro-tile-chrome-editor")) {
4909
4986
  }
4910
4987
 
4911
4988
  // src/faq-item-editor.ts
4912
- import { css as css3, html as html12, LitElement as LitElement11, nothing as nothing7 } from "lit";
4989
+ import { css as css3, html as html13, LitElement as LitElement12, nothing as nothing8 } from "lit";
4913
4990
  var getAnswerText = (answer) => {
4914
4991
  if (typeof answer === "string") return answer;
4915
4992
  if (answer.type === "rich") return answer.html;
4916
4993
  return answer.content;
4917
4994
  };
4918
- var FAQItemEditorLit = class extends LitElement11 {
4995
+ var FAQItemEditorLit = class extends LitElement12 {
4919
4996
  constructor() {
4920
4997
  super(...arguments);
4921
4998
  this.itemId = "";
@@ -4943,11 +5020,11 @@ var FAQItemEditorLit = class extends LitElement11 {
4943
5020
  render() {
4944
5021
  const item = this._findItem();
4945
5022
  if (!item) {
4946
- return html12`<p>Item not found</p>`;
5023
+ return html13`<p>Item not found</p>`;
4947
5024
  }
4948
5025
  const q = item;
4949
5026
  const answerText = getAnswerText(q.config.answer);
4950
- return html12`
5027
+ return html13`
4951
5028
  <form @submit=${(e) => e.preventDefault()}>
4952
5029
  <div>
4953
5030
  <label>
@@ -4986,12 +5063,12 @@ var FAQItemEditorLit = class extends LitElement11 {
4986
5063
  </label>
4987
5064
  </div>
4988
5065
 
4989
- ${q.rationale ? html12`
5066
+ ${q.rationale ? html13`
4990
5067
  <div>
4991
5068
  <span>AI Rationale</span>
4992
5069
  <div data-rationale>${q.rationale.why}</div>
4993
5070
  </div>
4994
- ` : nothing7}
5071
+ ` : nothing8}
4995
5072
  </form>
4996
5073
  `;
4997
5074
  }
@@ -5060,8 +5137,8 @@ function truncate(text, max) {
5060
5137
  if (text.length <= max) return text;
5061
5138
  return `${text.slice(0, max).trimEnd()}...`;
5062
5139
  }
5063
- function stripHtml(html15) {
5064
- return html15.replace(/<[^>]*>/g, "").trim();
5140
+ function stripHtml(html16) {
5141
+ return html16.replace(/<[^>]*>/g, "").trim();
5065
5142
  }
5066
5143
  function getAnswerPreview(answer) {
5067
5144
  if (typeof answer === "string") return answer;
@@ -5084,7 +5161,7 @@ function isOwnAction(action) {
5084
5161
  }
5085
5162
 
5086
5163
  // src/FAQWidgetLit.editable.ts
5087
- import { html as html13, LitElement as LitElement12, nothing as nothing8 } from "lit";
5164
+ import { html as html14, LitElement as LitElement13, nothing as nothing9 } from "lit";
5088
5165
  import { styleMap as styleMap4 } from "lit/directives/style-map.js";
5089
5166
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
5090
5167
  function sm(styles) {
@@ -5205,7 +5282,7 @@ var TILE_EDIT_BTN_VISIBLE_STYLE = {
5205
5282
  ...TILE_EDIT_BTN_STYLE,
5206
5283
  opacity: "1"
5207
5284
  };
5208
- var FAQAccordionEditableElement = class extends LitElement12 {
5285
+ var FAQAccordionEditableElement = class extends LitElement13 {
5209
5286
  constructor() {
5210
5287
  super(...arguments);
5211
5288
  // -------------------------------------------------------------------------
@@ -5320,7 +5397,7 @@ var FAQAccordionEditableElement = class extends LitElement12 {
5320
5397
  const isExpanded = this._expandedId === item.config.id;
5321
5398
  const rowStyle = isHovered ? ROW_HOVER_STYLE : ROW_STYLE;
5322
5399
  const pencilStyle = isHovered ? PENCIL_VISIBLE_STYLE : PENCIL_STYLE;
5323
- return html13`
5400
+ return html14`
5324
5401
  <div
5325
5402
  data-faq-editable-row
5326
5403
  data-item-id=${item.config.id}
@@ -5332,14 +5409,14 @@ var FAQAccordionEditableElement = class extends LitElement12 {
5332
5409
  this._hoveredId = null;
5333
5410
  }}
5334
5411
  >
5335
- ${showHandles ? html13`
5412
+ ${showHandles ? html14`
5336
5413
  <span
5337
5414
  data-drag-handle
5338
5415
  style=${styleMap4(sm(DRAG_HANDLE_STYLE))}
5339
5416
  title="Drag to reorder"
5340
5417
  aria-hidden="true"
5341
5418
  >⠿</span>
5342
- ` : nothing8}
5419
+ ` : nothing9}
5343
5420
 
5344
5421
  <span
5345
5422
  style=${styleMap4(sm(QUESTION_STYLE))}
@@ -5356,7 +5433,7 @@ var FAQAccordionEditableElement = class extends LitElement12 {
5356
5433
  @click=${(e) => this._handlePencilClick(e, item.config.id)}
5357
5434
  >✏️</button>
5358
5435
 
5359
- ${isExpanded && item.config.answer ? html13`<div data-faq-answer style=${styleMap4(sm(ANSWER_STYLE))}>${unsafeHTML(renderAnswerHtml(item.config.answer))}</div>` : nothing8}
5436
+ ${isExpanded && item.config.answer ? html14`<div data-faq-answer style=${styleMap4(sm(ANSWER_STYLE))}>${unsafeHTML(renderAnswerHtml(item.config.answer))}</div>` : nothing9}
5360
5437
  </div>
5361
5438
  `;
5362
5439
  }
@@ -5368,7 +5445,7 @@ var FAQAccordionEditableElement = class extends LitElement12 {
5368
5445
  const hasController = this.controller !== null;
5369
5446
  const showHandles = hasController && items.length >= 2;
5370
5447
  if (items.length === 0) {
5371
- return html13`
5448
+ return html14`
5372
5449
  <div
5373
5450
  style=${styleMap4(sm(CONTAINER_STYLE))}
5374
5451
  data-adaptive-id="faq-editable"
@@ -5382,7 +5459,7 @@ var FAQAccordionEditableElement = class extends LitElement12 {
5382
5459
  }
5383
5460
  if (hasController) {
5384
5461
  const editBtnStyle = this._containerHovered ? TILE_EDIT_BTN_VISIBLE_STYLE : TILE_EDIT_BTN_STYLE;
5385
- return html13`
5462
+ return html14`
5386
5463
  <div
5387
5464
  style=${styleMap4(sm({ ...CONTAINER_STYLE, position: "relative" }))}
5388
5465
  data-adaptive-id="faq-editable"
@@ -5406,14 +5483,14 @@ var FAQAccordionEditableElement = class extends LitElement12 {
5406
5483
  </div>
5407
5484
  `;
5408
5485
  }
5409
- return html13`
5486
+ return html14`
5410
5487
  <div
5411
5488
  style=${styleMap4(sm(CONTAINER_STYLE))}
5412
5489
  data-adaptive-id="faq-editable"
5413
5490
  data-adaptive-type="adaptive-faq"
5414
5491
  >
5415
5492
  ${items.map(
5416
- (item) => html13`
5493
+ (item) => html14`
5417
5494
  <div
5418
5495
  style=${styleMap4(sm(ROW_STYLE))}
5419
5496
  data-faq-item-id=${item.config.id}
@@ -5521,7 +5598,7 @@ function buildFlatItem(key, groupIdx, itemIdx, q) {
5521
5598
  question: q
5522
5599
  };
5523
5600
  }
5524
- var FAQEditorLit = class extends LitElement13 {
5601
+ var FAQEditorLit = class extends LitElement14 {
5525
5602
  constructor() {
5526
5603
  super(...arguments);
5527
5604
  this.config = null;
@@ -5559,7 +5636,7 @@ var FAQEditorLit = class extends LitElement13 {
5559
5636
  };
5560
5637
  this._renderEditMode = (item) => {
5561
5638
  const { appConfig, onChange } = this._buildInnerProps(item);
5562
- return html14`
5639
+ return html15`
5563
5640
  <syntro-faq-item-editor
5564
5641
  .itemId=${item.question.config.id}
5565
5642
  .appConfig=${appConfig}
@@ -5567,7 +5644,7 @@ var FAQEditorLit = class extends LitElement13 {
5567
5644
  ></syntro-faq-item-editor>
5568
5645
  `;
5569
5646
  };
5570
- this._renderItemCard = (item) => html14`
5647
+ this._renderItemCard = (item) => html15`
5571
5648
  <div
5572
5649
  data-item-key=${item.key}
5573
5650
  data-card-body
@@ -5580,32 +5657,32 @@ var FAQEditorLit = class extends LitElement13 {
5580
5657
  deleteTestid: `delete-faq-${item.key}`,
5581
5658
  deleteLabel: "Delete question"
5582
5659
  })}
5583
- ${item.description ? html14`<div
5660
+ ${item.description ? html15`<div
5584
5661
  data-testid=${`faq-description-${item.key}`}
5585
5662
  class="se-text-[11px] se-text-text-secondary se-mt-1.5 se-line-clamp-2"
5586
- >${item.description}</div>` : nothing9}
5587
- ${item.triggerSummary ? html14`<div
5663
+ >${item.description}</div>` : nothing10}
5664
+ ${item.triggerSummary ? html15`<div
5588
5665
  data-testid=${`faq-trigger-${item.key}`}
5589
5666
  class="se-mt-1 se-inline-flex se-items-center se-gap-1 se-px-1.5 se-py-0.5 se-rounded se-bg-pink-4/10 se-text-pink-5 se-text-[10px] se-font-medium"
5590
5667
  >
5591
5668
  <span>📍</span>
5592
5669
  <span>When: ${item.triggerSummary}</span>
5593
- </div>` : nothing9}
5594
- ${item.validation && item.validation.length > 0 ? html14`<div
5670
+ </div>` : nothing10}
5671
+ ${item.validation && item.validation.length > 0 ? html15`<div
5595
5672
  data-testid=${`faq-validation-${item.key}`}
5596
5673
  class="se-mt-1.5 se-flex se-flex-col se-gap-0.5"
5597
5674
  >
5598
5675
  ${item.validation.map(
5599
- (line) => html14`<div
5676
+ (line) => html15`<div
5600
5677
  class="se-text-[10px] se-text-text-tertiary se-flex se-items-start se-gap-1"
5601
5678
  ><span class="se-text-text-tertiary">✓</span><span>${line}</span></div>`
5602
5679
  )}
5603
- </div>` : nothing9}
5604
- ${item.question.rationale ? html14`
5680
+ </div>` : nothing10}
5681
+ ${item.question.rationale ? html15`
5605
5682
  <div class="se-text-[10px] se-text-text-tertiary se-mt-1">
5606
5683
  WHY: ${item.question.rationale.why}
5607
5684
  </div>
5608
- ` : nothing9}
5685
+ ` : nothing10}
5609
5686
  </div>
5610
5687
  `;
5611
5688
  this._handleNavigateFromPill = (e) => {
@@ -5621,7 +5698,7 @@ var FAQEditorLit = class extends LitElement13 {
5621
5698
  this._renderGroupHeader = (section, count) => {
5622
5699
  const navRoute = section.routes[0];
5623
5700
  const testidSuffix = section.tileId ?? String(section.groupIdx);
5624
- return html14`
5701
+ return html15`
5625
5702
  <div
5626
5703
  data-faq-group-header
5627
5704
  data-faq-group-tile-id=${section.tileId ?? ""}
@@ -5633,13 +5710,13 @@ var FAQEditorLit = class extends LitElement13 {
5633
5710
  >
5634
5711
  ${section.title}
5635
5712
  </span>
5636
- ${navRoute ? html14`<se-anchor-pill
5713
+ ${navRoute ? html15`<se-anchor-pill
5637
5714
  .state=${"navigate"}
5638
5715
  .route=${navRoute}
5639
5716
  testid-prefix="goto-faq-group"
5640
5717
  testid-key=${testidSuffix}
5641
5718
  @se-anchor-navigate=${this._handleNavigateFromPill}
5642
- ></se-anchor-pill>` : nothing9}
5719
+ ></se-anchor-pill>` : nothing10}
5643
5720
  </div>
5644
5721
  <span class="se-text-text-tertiary se-text-[11px] se-font-normal">${count}</span>
5645
5722
  </div>
@@ -5647,21 +5724,21 @@ var FAQEditorLit = class extends LitElement13 {
5647
5724
  };
5648
5725
  this._renderListMode = (sections, items) => {
5649
5726
  if (items.length === 0) {
5650
- return html14`<div class="se-text-center se-py-8 se-px-4 se-text-text-secondary se-text-sm">
5727
+ return html15`<div class="se-text-center se-py-8 se-px-4 se-text-text-secondary se-text-sm">
5651
5728
  No FAQ questions configured.
5652
5729
  </div>`;
5653
5730
  }
5654
5731
  if (sections.length === 1 && sections[0].groupIdx === -1) {
5655
- return html14`
5732
+ return html15`
5656
5733
  <div class="se-text-[11px] se-font-semibold se-uppercase se-tracking-wider se-text-text-secondary se-mb-2 se-px-1">
5657
5734
  FAQ <span class="se-text-text-tertiary se-font-normal">${items.length}</span>
5658
5735
  </div>
5659
5736
  ${items.map(this._renderItemCard)}
5660
5737
  `;
5661
5738
  }
5662
- return html14`${sections.map((section) => {
5739
+ return html15`${sections.map((section) => {
5663
5740
  const sectionItems = items.filter((it) => it.groupIdx === section.groupIdx);
5664
- return html14`
5741
+ return html15`
5665
5742
  ${this._renderGroupHeader(section, sectionItems.length)}
5666
5743
  ${sectionItems.map(this._renderItemCard)}
5667
5744
  `;
@@ -5726,11 +5803,11 @@ var FAQEditorLit = class extends LitElement13 {
5726
5803
  }
5727
5804
  render() {
5728
5805
  if (!this.config) {
5729
- return html14`<div class="se-p-8 se-text-center se-text-text-secondary se-text-sm">Loading...</div>`;
5806
+ return html15`<div class="se-p-8 se-text-center se-text-text-secondary se-text-sm">Loading...</div>`;
5730
5807
  }
5731
5808
  const { sections, items } = flattenConfig(this.config);
5732
5809
  const editItem = this._editingKey !== null ? items.find((it) => it.key === this._editingKey) : null;
5733
- return html14`
5810
+ return html15`
5734
5811
  <div class="se-flex se-flex-col se-h-full">
5735
5812
  <!-- Header (no Back button — panel provides that) -->
5736
5813
  <div class="se-px-4 se-pt-3 se-pb-1">
@@ -5741,7 +5818,7 @@ var FAQEditorLit = class extends LitElement13 {
5741
5818
  </div>
5742
5819
 
5743
5820
  <div class="se-flex-1 se-overflow-auto se-p-4">
5744
- ${editItem ? html14`
5821
+ ${editItem ? html15`
5745
5822
  <button type="button" @click=${() => {
5746
5823
  this._editingKey = null;
5747
5824
  }}