@syntrologie/adapt-faq 2.19.0 → 2.21.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/FAQWidgetLit.d.ts.map +1 -1
- package/dist/FAQWidgetLit.editable.d.ts +154 -0
- package/dist/FAQWidgetLit.editable.d.ts.map +1 -0
- package/dist/answerRendering.d.ts +4 -0
- package/dist/answerRendering.d.ts.map +1 -0
- package/dist/{chunk-S6WIENQP.js → chunk-KRKRB4OL.js} +22 -2
- package/dist/{chunk-S6WIENQP.js.map → chunk-KRKRB4OL.js.map} +3 -3
- package/dist/editor.d.ts +28 -3
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +1154 -163
- package/dist/editor.js.map +4 -4
- package/dist/faq-item-editor.d.ts +33 -0
- package/dist/faq-item-editor.d.ts.map +1 -0
- package/dist/runtime.js +3 -17
- package/dist/runtime.js.map +2 -2
- package/dist/schema.d.ts +116 -116
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +11 -7
- package/dist/schema.js.map +2 -2
- package/package.json +1 -1
package/dist/editor.js
CHANGED
|
@@ -7,8 +7,9 @@ import {
|
|
|
7
7
|
glowShadows,
|
|
8
8
|
overlay,
|
|
9
9
|
panel_shell_default,
|
|
10
|
+
renderAnswerHtml,
|
|
10
11
|
shadows
|
|
11
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-KRKRB4OL.js";
|
|
12
13
|
import {
|
|
13
14
|
__commonJS,
|
|
14
15
|
__toESM
|
|
@@ -2779,6 +2780,236 @@ function itemCardHeader(opts) {
|
|
|
2779
2780
|
`;
|
|
2780
2781
|
}
|
|
2781
2782
|
|
|
2783
|
+
// ../../shared-editor-ui/dist/components/TileChromeEditorLit.js
|
|
2784
|
+
import { css, html as html2, LitElement, nothing as nothing2 } from "lit";
|
|
2785
|
+
var EMOJI_LIST = [
|
|
2786
|
+
"\u{1F4B5}",
|
|
2787
|
+
"\u{1F4B0}",
|
|
2788
|
+
"\u{1F3DB}\uFE0F",
|
|
2789
|
+
"\u23ED\uFE0F",
|
|
2790
|
+
"\u27A1\uFE0F",
|
|
2791
|
+
"\u{1F4A1}",
|
|
2792
|
+
"\u{1F4CB}",
|
|
2793
|
+
"\u2705",
|
|
2794
|
+
"\u26A0\uFE0F",
|
|
2795
|
+
"\u{1F6E1}\uFE0F",
|
|
2796
|
+
"\u{1F4C8}",
|
|
2797
|
+
"\u{1F52C}",
|
|
2798
|
+
"\u{1F48A}",
|
|
2799
|
+
"\u{1F4C4}",
|
|
2800
|
+
"\u{1F9EA}",
|
|
2801
|
+
"\u{1F501}",
|
|
2802
|
+
"\u{1F9E0}",
|
|
2803
|
+
"\u{1F319}",
|
|
2804
|
+
"\u{1F4E6}",
|
|
2805
|
+
"\u{1F69A}",
|
|
2806
|
+
"\u{1F331}",
|
|
2807
|
+
"\u26A1",
|
|
2808
|
+
"\u{1F525}",
|
|
2809
|
+
"\u{1F333}",
|
|
2810
|
+
"\u{1F33F}",
|
|
2811
|
+
"\u2753",
|
|
2812
|
+
"\u{1F9ED}",
|
|
2813
|
+
"\u{1F4DD}",
|
|
2814
|
+
"\u{1F3AF}",
|
|
2815
|
+
"\u{1F3C6}",
|
|
2816
|
+
"\u2728",
|
|
2817
|
+
"\u{1F4AC}",
|
|
2818
|
+
"\u{1F3AE}",
|
|
2819
|
+
"\u23F1\uFE0F",
|
|
2820
|
+
"\u{1F4D6}",
|
|
2821
|
+
"\u{1F514}",
|
|
2822
|
+
"\u{1F393}",
|
|
2823
|
+
"\u23F0",
|
|
2824
|
+
"\u{1F504}",
|
|
2825
|
+
"\u{1F464}",
|
|
2826
|
+
"\u{1F3E0}",
|
|
2827
|
+
"\u{1F6D2}",
|
|
2828
|
+
"\u{1F4CA}",
|
|
2829
|
+
"\u{1F4C9}",
|
|
2830
|
+
"\u{1F967}",
|
|
2831
|
+
"\u{1F4B9}",
|
|
2832
|
+
"\u{1F321}\uFE0F"
|
|
2833
|
+
];
|
|
2834
|
+
var TileChromeEditorLit = class extends LitElement {
|
|
2835
|
+
constructor() {
|
|
2836
|
+
super(...arguments);
|
|
2837
|
+
this.tileMeta = { title: "", subtitle: "", icon: "" };
|
|
2838
|
+
this.onChange = () => {
|
|
2839
|
+
};
|
|
2840
|
+
this._pickerOpen = false;
|
|
2841
|
+
}
|
|
2842
|
+
_patch(field, value) {
|
|
2843
|
+
const updated = { ...this.tileMeta, [field]: value };
|
|
2844
|
+
this.tileMeta = updated;
|
|
2845
|
+
this.onChange(updated);
|
|
2846
|
+
}
|
|
2847
|
+
_selectEmoji(emoji) {
|
|
2848
|
+
const value = this.tileMeta.icon === emoji ? "" : emoji;
|
|
2849
|
+
this._patch("icon", value);
|
|
2850
|
+
}
|
|
2851
|
+
render() {
|
|
2852
|
+
return html2`
|
|
2853
|
+
<form @submit=${(e) => e.preventDefault()}>
|
|
2854
|
+
<label>
|
|
2855
|
+
<span>Title</span>
|
|
2856
|
+
<input
|
|
2857
|
+
name="title"
|
|
2858
|
+
type="text"
|
|
2859
|
+
.value=${this.tileMeta.title}
|
|
2860
|
+
@input=${(e) => this._patch("title", e.target.value)}
|
|
2861
|
+
/>
|
|
2862
|
+
</label>
|
|
2863
|
+
|
|
2864
|
+
<label>
|
|
2865
|
+
<span>Subtitle</span>
|
|
2866
|
+
<input
|
|
2867
|
+
name="subtitle"
|
|
2868
|
+
type="text"
|
|
2869
|
+
.value=${this.tileMeta.subtitle}
|
|
2870
|
+
placeholder="Optional"
|
|
2871
|
+
@input=${(e) => this._patch("subtitle", e.target.value)}
|
|
2872
|
+
/>
|
|
2873
|
+
</label>
|
|
2874
|
+
|
|
2875
|
+
<div class="icon-section">
|
|
2876
|
+
<span>Icon</span>
|
|
2877
|
+
<button
|
|
2878
|
+
type="button"
|
|
2879
|
+
class="icon-toggle"
|
|
2880
|
+
data-emoji-toggle
|
|
2881
|
+
@click=${() => {
|
|
2882
|
+
this._pickerOpen = !this._pickerOpen;
|
|
2883
|
+
}}
|
|
2884
|
+
>
|
|
2885
|
+
${this.tileMeta.icon ? html2`<span style="font-size: 20px">${this.tileMeta.icon}</span>` : html2`<span style="color: var(--syntro-text-tertiary, #87919f)">Choose icon…</span>`}
|
|
2886
|
+
</button>
|
|
2887
|
+
|
|
2888
|
+
${this._pickerOpen ? html2`
|
|
2889
|
+
<div data-emoji-grid class="emoji-grid">
|
|
2890
|
+
${EMOJI_LIST.map((emoji) => html2`
|
|
2891
|
+
<button
|
|
2892
|
+
type="button"
|
|
2893
|
+
data-emoji=${emoji}
|
|
2894
|
+
class=${this.tileMeta.icon === emoji ? "selected" : ""}
|
|
2895
|
+
@click=${() => this._selectEmoji(emoji)}
|
|
2896
|
+
title=${emoji}
|
|
2897
|
+
>${emoji}</button>
|
|
2898
|
+
`)}
|
|
2899
|
+
</div>
|
|
2900
|
+
` : nothing2}
|
|
2901
|
+
</div>
|
|
2902
|
+
</form>
|
|
2903
|
+
`;
|
|
2904
|
+
}
|
|
2905
|
+
};
|
|
2906
|
+
TileChromeEditorLit.styles = css`
|
|
2907
|
+
:host {
|
|
2908
|
+
display: block;
|
|
2909
|
+
width: 100%;
|
|
2910
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
2911
|
+
}
|
|
2912
|
+
form {
|
|
2913
|
+
display: flex;
|
|
2914
|
+
flex-direction: column;
|
|
2915
|
+
gap: 16px;
|
|
2916
|
+
}
|
|
2917
|
+
label {
|
|
2918
|
+
display: flex;
|
|
2919
|
+
flex-direction: column;
|
|
2920
|
+
gap: 6px;
|
|
2921
|
+
}
|
|
2922
|
+
label > span {
|
|
2923
|
+
font-size: 13px;
|
|
2924
|
+
font-weight: 500;
|
|
2925
|
+
color: var(--syntro-text-secondary, #a8afba);
|
|
2926
|
+
}
|
|
2927
|
+
input[type='text'] {
|
|
2928
|
+
width: 100%;
|
|
2929
|
+
box-sizing: border-box;
|
|
2930
|
+
padding: 8px 12px;
|
|
2931
|
+
border-radius: 6px;
|
|
2932
|
+
border: 1px solid var(--syntro-input-field-border-default, #2b333f);
|
|
2933
|
+
background: var(--syntro-input-field-bg-default, #0e1114);
|
|
2934
|
+
color: var(--syntro-text-primary, #cbd0d7);
|
|
2935
|
+
font-size: 14px;
|
|
2936
|
+
font-family: inherit;
|
|
2937
|
+
outline: none;
|
|
2938
|
+
}
|
|
2939
|
+
input[type='text']:focus {
|
|
2940
|
+
border-color: var(--syntro-input-field-border-selected, #b72e2a);
|
|
2941
|
+
box-shadow: var(--syntro-focus-ring-primary, 0 0 0 4px rgba(221, 109, 105, 0.25));
|
|
2942
|
+
}
|
|
2943
|
+
.icon-section {
|
|
2944
|
+
display: flex;
|
|
2945
|
+
flex-direction: column;
|
|
2946
|
+
gap: 6px;
|
|
2947
|
+
}
|
|
2948
|
+
.icon-section > span {
|
|
2949
|
+
font-size: 13px;
|
|
2950
|
+
font-weight: 500;
|
|
2951
|
+
color: var(--syntro-text-secondary, #a8afba);
|
|
2952
|
+
}
|
|
2953
|
+
.icon-toggle {
|
|
2954
|
+
display: inline-flex;
|
|
2955
|
+
align-items: center;
|
|
2956
|
+
gap: 8px;
|
|
2957
|
+
padding: 8px 12px;
|
|
2958
|
+
border-radius: 6px;
|
|
2959
|
+
border: 1px solid var(--syntro-input-field-border-default, #2b333f);
|
|
2960
|
+
background: var(--syntro-input-field-bg-default, #0e1114);
|
|
2961
|
+
color: var(--syntro-text-primary, #cbd0d7);
|
|
2962
|
+
font-size: 14px;
|
|
2963
|
+
cursor: pointer;
|
|
2964
|
+
font-family: inherit;
|
|
2965
|
+
}
|
|
2966
|
+
.icon-toggle:hover {
|
|
2967
|
+
border-color: var(--syntro-input-field-border-selected, #b72e2a);
|
|
2968
|
+
}
|
|
2969
|
+
.emoji-grid {
|
|
2970
|
+
display: grid;
|
|
2971
|
+
grid-template-columns: repeat(8, 1fr);
|
|
2972
|
+
gap: 4px;
|
|
2973
|
+
padding: 8px;
|
|
2974
|
+
margin-top: 4px;
|
|
2975
|
+
background: var(--syntro-background-secondary, #07080a);
|
|
2976
|
+
border: 1px solid var(--syntro-input-field-border-default, #2b333f);
|
|
2977
|
+
border-radius: 8px;
|
|
2978
|
+
max-height: 200px;
|
|
2979
|
+
overflow-y: auto;
|
|
2980
|
+
}
|
|
2981
|
+
.emoji-grid button {
|
|
2982
|
+
display: flex;
|
|
2983
|
+
align-items: center;
|
|
2984
|
+
justify-content: center;
|
|
2985
|
+
width: 36px;
|
|
2986
|
+
height: 36px;
|
|
2987
|
+
border: 1px solid transparent;
|
|
2988
|
+
border-radius: 6px;
|
|
2989
|
+
background: transparent;
|
|
2990
|
+
font-size: 18px;
|
|
2991
|
+
cursor: pointer;
|
|
2992
|
+
padding: 0;
|
|
2993
|
+
transition: background 100ms ease, border-color 100ms ease;
|
|
2994
|
+
}
|
|
2995
|
+
.emoji-grid button:hover {
|
|
2996
|
+
background: rgba(183, 46, 42, 0.1);
|
|
2997
|
+
border-color: rgba(183, 46, 42, 0.3);
|
|
2998
|
+
}
|
|
2999
|
+
.emoji-grid button.selected {
|
|
3000
|
+
background: rgba(183, 46, 42, 0.2);
|
|
3001
|
+
border-color: var(--syntro-button-primary-bg-default, #b72e2a);
|
|
3002
|
+
}
|
|
3003
|
+
`;
|
|
3004
|
+
TileChromeEditorLit.properties = {
|
|
3005
|
+
tileMeta: { attribute: false },
|
|
3006
|
+
onChange: { attribute: false },
|
|
3007
|
+
_pickerOpen: { state: true }
|
|
3008
|
+
};
|
|
3009
|
+
if (!customElements.get("syntro-tile-chrome-editor")) {
|
|
3010
|
+
customElements.define("syntro-tile-chrome-editor", TileChromeEditorLit);
|
|
3011
|
+
}
|
|
3012
|
+
|
|
2782
3013
|
// ../../shared-editor-ui/dist/components/TriggerJourney.js
|
|
2783
3014
|
var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1);
|
|
2784
3015
|
|
|
@@ -3011,10 +3242,10 @@ var INTERACTIVE_TAGS = new Set(action_step_field_mapping_default.interactive_tag
|
|
|
3011
3242
|
var INTERACTIVE_ROLES = new Set(action_step_field_mapping_default.interactive_roles);
|
|
3012
3243
|
|
|
3013
3244
|
// src/editor.ts
|
|
3014
|
-
import { html as
|
|
3245
|
+
import { html as html14, LitElement as LitElement13, nothing as nothing9 } from "lit";
|
|
3015
3246
|
|
|
3016
3247
|
// ../../shared-editor-ui/src/components/AnchorPickerLit.ts
|
|
3017
|
-
import { html as
|
|
3248
|
+
import { html as html3, LitElement as LitElement2, render as litRender, nothing as nothing3 } from "lit";
|
|
3018
3249
|
import { styleMap } from "lit/directives/style-map.js";
|
|
3019
3250
|
|
|
3020
3251
|
// ../../shared-editor-ui/src/utils/selectorGenerator.ts
|
|
@@ -3133,7 +3364,7 @@ function isDynamicClass(className) {
|
|
|
3133
3364
|
var HIGHLIGHT_COLOR = colors_default.blue[4];
|
|
3134
3365
|
var HIGHLIGHT_BG = "rgba(25, 105, 254, 0.1)";
|
|
3135
3366
|
var DEFAULT_EXCLUDE_SELECTOR = "[data-syntro-editor-panel], [data-shadow-canvas-id], .syntro-tooltip, .syntro-modal, .syntro-highlight, [data-syntro-anchor-picker]";
|
|
3136
|
-
var AnchorPickerLit = class extends
|
|
3367
|
+
var AnchorPickerLit = class extends LitElement2 {
|
|
3137
3368
|
constructor() {
|
|
3138
3369
|
super(...arguments);
|
|
3139
3370
|
this.isActive = false;
|
|
@@ -3259,7 +3490,7 @@ var AnchorPickerLit = class extends LitElement {
|
|
|
3259
3490
|
}
|
|
3260
3491
|
_destroyPortal() {
|
|
3261
3492
|
if (this._portalDiv) {
|
|
3262
|
-
litRender(
|
|
3493
|
+
litRender(nothing3, this._portalDiv);
|
|
3263
3494
|
this._portalDiv.remove();
|
|
3264
3495
|
this._portalDiv = null;
|
|
3265
3496
|
this._overlayEl = null;
|
|
@@ -3295,13 +3526,13 @@ var AnchorPickerLit = class extends LitElement {
|
|
|
3295
3526
|
// The component itself renders nothing — all overlay HTML lives in _portalDiv
|
|
3296
3527
|
// (a div appended to document.body), managed by _syncPortal().
|
|
3297
3528
|
render() {
|
|
3298
|
-
return
|
|
3529
|
+
return nothing3;
|
|
3299
3530
|
}
|
|
3300
3531
|
_overlayTemplate() {
|
|
3301
|
-
if (!this.isActive) return
|
|
3532
|
+
if (!this.isActive) return nothing3;
|
|
3302
3533
|
const hovered = this._hoveredElement;
|
|
3303
3534
|
const rect = hovered?.getBoundingClientRect() ?? null;
|
|
3304
|
-
return
|
|
3535
|
+
return html3`
|
|
3305
3536
|
<div
|
|
3306
3537
|
data-syntro-anchor-picker
|
|
3307
3538
|
style=${styleMap({
|
|
@@ -3323,7 +3554,7 @@ var AnchorPickerLit = class extends LitElement {
|
|
|
3323
3554
|
></div>
|
|
3324
3555
|
|
|
3325
3556
|
<!-- Element highlight -->
|
|
3326
|
-
${hovered && rect ?
|
|
3557
|
+
${hovered && rect ? html3`<div
|
|
3327
3558
|
style=${styleMap({
|
|
3328
3559
|
position: "fixed",
|
|
3329
3560
|
left: `${rect.left - 2}px`,
|
|
@@ -3337,10 +3568,10 @@ var AnchorPickerLit = class extends LitElement {
|
|
|
3337
3568
|
pointerEvents: "none",
|
|
3338
3569
|
transition: "all 0.1s ease-out"
|
|
3339
3570
|
})}
|
|
3340
|
-
></div>` :
|
|
3571
|
+
></div>` : nothing3}
|
|
3341
3572
|
|
|
3342
3573
|
<!-- Element info tooltip near hovered element -->
|
|
3343
|
-
${hovered && rect ?
|
|
3574
|
+
${hovered && rect ? html3`<div
|
|
3344
3575
|
class="se-text-xs"
|
|
3345
3576
|
style=${styleMap({
|
|
3346
3577
|
position: "fixed",
|
|
@@ -3389,7 +3620,7 @@ var AnchorPickerLit = class extends LitElement {
|
|
|
3389
3620
|
>
|
|
3390
3621
|
${getElementDescription2(hovered)}
|
|
3391
3622
|
</div>
|
|
3392
|
-
</div>` :
|
|
3623
|
+
</div>` : nothing3}
|
|
3393
3624
|
</div>
|
|
3394
3625
|
`;
|
|
3395
3626
|
}
|
|
@@ -3407,8 +3638,8 @@ if (!customElements.get("se-anchor-picker")) {
|
|
|
3407
3638
|
}
|
|
3408
3639
|
|
|
3409
3640
|
// ../../shared-editor-ui/src/components/AnchorPillLit.ts
|
|
3410
|
-
import { html as
|
|
3411
|
-
var AnchorPillLit = class extends
|
|
3641
|
+
import { html as html4, LitElement as LitElement3 } from "lit";
|
|
3642
|
+
var AnchorPillLit = class extends LitElement3 {
|
|
3412
3643
|
constructor() {
|
|
3413
3644
|
super(...arguments);
|
|
3414
3645
|
this.state = "missing";
|
|
@@ -3447,7 +3678,7 @@ var AnchorPillLit = class extends LitElement2 {
|
|
|
3447
3678
|
const redCls = "se-border-red-4/60 se-bg-red-4/10 se-text-red-5 se-cursor-not-allowed";
|
|
3448
3679
|
const testid = `${this.testidPrefix}-${this.testidKey}`;
|
|
3449
3680
|
if (this.state === "locate") {
|
|
3450
|
-
return
|
|
3681
|
+
return html4`<button
|
|
3451
3682
|
type="button"
|
|
3452
3683
|
data-testid=${testid}
|
|
3453
3684
|
data-state="locate"
|
|
@@ -3459,7 +3690,7 @@ var AnchorPillLit = class extends LitElement2 {
|
|
|
3459
3690
|
</button>`;
|
|
3460
3691
|
}
|
|
3461
3692
|
if (this.state === "navigate" && this.route) {
|
|
3462
|
-
return
|
|
3693
|
+
return html4`<button
|
|
3463
3694
|
type="button"
|
|
3464
3695
|
data-testid=${testid}
|
|
3465
3696
|
data-state="navigate"
|
|
@@ -3470,7 +3701,7 @@ var AnchorPillLit = class extends LitElement2 {
|
|
|
3470
3701
|
Go to ${this.route}
|
|
3471
3702
|
</button>`;
|
|
3472
3703
|
}
|
|
3473
|
-
return
|
|
3704
|
+
return html4`<span
|
|
3474
3705
|
data-testid=${testid}
|
|
3475
3706
|
data-state="missing"
|
|
3476
3707
|
title="Anchor not available on this page"
|
|
@@ -3494,8 +3725,8 @@ if (!customElements.get("se-anchor-pill")) {
|
|
|
3494
3725
|
}
|
|
3495
3726
|
|
|
3496
3727
|
// ../../shared-editor-ui/src/components/EditorCardLit.ts
|
|
3497
|
-
import { html as
|
|
3498
|
-
var EditorCardLit = class extends
|
|
3728
|
+
import { html as html5, LitElement as LitElement4 } from "lit";
|
|
3729
|
+
var EditorCardLit = class extends LitElement4 {
|
|
3499
3730
|
constructor() {
|
|
3500
3731
|
super(...arguments);
|
|
3501
3732
|
this.itemKey = "";
|
|
@@ -3543,7 +3774,7 @@ var EditorCardLit = class extends LitElement3 {
|
|
|
3543
3774
|
const bgCls = "bg-white/[0.02]";
|
|
3544
3775
|
const colorCls = "text-slate-200";
|
|
3545
3776
|
const interactiveCls = this.clickable ? "cursor-pointer hover:border-white/20 hover:bg-white/[0.04] transition-colors" : "";
|
|
3546
|
-
return
|
|
3777
|
+
return html5`
|
|
3547
3778
|
<style>
|
|
3548
3779
|
:host { display: block; }
|
|
3549
3780
|
.card {
|
|
@@ -3595,7 +3826,7 @@ if (!customElements.get("se-editor-card")) {
|
|
|
3595
3826
|
}
|
|
3596
3827
|
|
|
3597
3828
|
// ../../shared-editor-ui/src/components/EditorPanelShellLit.ts
|
|
3598
|
-
import { html as
|
|
3829
|
+
import { html as html6, LitElement as LitElement5, nothing as nothing4 } from "lit";
|
|
3599
3830
|
import { styleMap as styleMap2 } from "lit/directives/style-map.js";
|
|
3600
3831
|
var STORAGE_KEY = "syntro:editor-panel";
|
|
3601
3832
|
var MIN_WIDTH2 = panel_shell_default.behavior.minWidth;
|
|
@@ -3755,7 +3986,7 @@ var RESIZE_HANDLES2 = [
|
|
|
3755
3986
|
cursor: "nesw-resize"
|
|
3756
3987
|
}
|
|
3757
3988
|
];
|
|
3758
|
-
var syntroLogoSvg =
|
|
3989
|
+
var syntroLogoSvg = html6`<svg
|
|
3759
3990
|
aria-hidden="true"
|
|
3760
3991
|
width="28"
|
|
3761
3992
|
height="18"
|
|
@@ -3775,7 +4006,7 @@ var syntroLogoSvg = html5`<svg
|
|
|
3775
4006
|
</clipPath>
|
|
3776
4007
|
</defs>
|
|
3777
4008
|
</svg>`;
|
|
3778
|
-
var EditorPanelShellLit = class extends
|
|
4009
|
+
var EditorPanelShellLit = class extends LitElement5 {
|
|
3779
4010
|
constructor() {
|
|
3780
4011
|
super(...arguments);
|
|
3781
4012
|
this.isOpen = false;
|
|
@@ -4017,17 +4248,17 @@ var EditorPanelShellLit = class extends LitElement4 {
|
|
|
4017
4248
|
}
|
|
4018
4249
|
// ---- RENDER ----
|
|
4019
4250
|
render() {
|
|
4020
|
-
return
|
|
4021
|
-
${this.isOpen ?
|
|
4251
|
+
return html6`
|
|
4252
|
+
${this.isOpen ? html6`<div
|
|
4022
4253
|
data-syntro-editor-panel
|
|
4023
4254
|
data-syntro-editor-ui="panel"
|
|
4024
4255
|
class=${this._getPanelClasses()}
|
|
4025
4256
|
style=${styleMap2(this._getPanelStyles())}
|
|
4026
|
-
${this.panelId ?
|
|
4027
|
-
id=${this.panelId ??
|
|
4257
|
+
${this.panelId ? html6`` : nothing4}
|
|
4258
|
+
id=${this.panelId ?? nothing4}
|
|
4028
4259
|
>
|
|
4029
4260
|
${RESIZE_HANDLES2.map(
|
|
4030
|
-
(h) =>
|
|
4261
|
+
(h) => html6`<div
|
|
4031
4262
|
data-syntro-editor-ui="resize-${h.dir}"
|
|
4032
4263
|
data-resize-dir=${h.dir}
|
|
4033
4264
|
@pointerdown=${this._handleResizePointerDown}
|
|
@@ -4043,7 +4274,7 @@ var EditorPanelShellLit = class extends LitElement4 {
|
|
|
4043
4274
|
></div>`
|
|
4044
4275
|
)}
|
|
4045
4276
|
<slot></slot>
|
|
4046
|
-
</div>` :
|
|
4277
|
+
</div>` : nothing4}
|
|
4047
4278
|
|
|
4048
4279
|
<div
|
|
4049
4280
|
class="syntro-editor-scope"
|
|
@@ -4076,9 +4307,9 @@ if (!customElements.get("se-editor-panel-shell")) {
|
|
|
4076
4307
|
}
|
|
4077
4308
|
|
|
4078
4309
|
// ../../shared-editor-ui/src/components/EditorTextareaLit.ts
|
|
4079
|
-
import { html as
|
|
4310
|
+
import { html as html7, LitElement as LitElement6 } from "lit";
|
|
4080
4311
|
var _textareaIdCounter = 0;
|
|
4081
|
-
var EditorTextareaLit = class extends
|
|
4312
|
+
var EditorTextareaLit = class extends LitElement6 {
|
|
4082
4313
|
constructor() {
|
|
4083
4314
|
super();
|
|
4084
4315
|
this.disabled = false;
|
|
@@ -4131,9 +4362,9 @@ var EditorTextareaLit = class extends LitElement5 {
|
|
|
4131
4362
|
"disabled:se-bg-input-field-bg-disabled disabled:se-cursor-not-allowed disabled:se-opacity-50",
|
|
4132
4363
|
this.textareaClass || ""
|
|
4133
4364
|
].filter(Boolean).join(" ");
|
|
4134
|
-
return
|
|
4365
|
+
return html7`
|
|
4135
4366
|
<div>
|
|
4136
|
-
${this.label ?
|
|
4367
|
+
${this.label ? html7`<label
|
|
4137
4368
|
for=${id}
|
|
4138
4369
|
class="se-text-sm se-font-medium se-text-input-field-text-label se-mb-1 se-block"
|
|
4139
4370
|
>${this.label}</label>` : ""}
|
|
@@ -4170,9 +4401,9 @@ if (!customElements.get("se-editor-textarea")) {
|
|
|
4170
4401
|
}
|
|
4171
4402
|
|
|
4172
4403
|
// ../../shared-editor-ui/src/components/ElementHighlightLit.ts
|
|
4173
|
-
import { html as
|
|
4404
|
+
import { html as html8, LitElement as LitElement7, nothing as nothing5 } from "lit";
|
|
4174
4405
|
import { styleMap as styleMap3 } from "lit/directives/style-map.js";
|
|
4175
|
-
var ElementHighlightLit = class extends
|
|
4406
|
+
var ElementHighlightLit = class extends LitElement7 {
|
|
4176
4407
|
constructor() {
|
|
4177
4408
|
super(...arguments);
|
|
4178
4409
|
this.element = null;
|
|
@@ -4279,7 +4510,7 @@ var ElementHighlightLit = class extends LitElement6 {
|
|
|
4279
4510
|
// ---- RENDER ----
|
|
4280
4511
|
render() {
|
|
4281
4512
|
const rect = this._rect;
|
|
4282
|
-
if (!rect) return
|
|
4513
|
+
if (!rect) return nothing5;
|
|
4283
4514
|
const el = this.element;
|
|
4284
4515
|
const hasInteraction = this.interactive || this.showRemove;
|
|
4285
4516
|
let dimensionsLabel = null;
|
|
@@ -4291,14 +4522,14 @@ var ElementHighlightLit = class extends LitElement6 {
|
|
|
4291
4522
|
}
|
|
4292
4523
|
const displayLabel = this.label || dimensionsLabel;
|
|
4293
4524
|
const labelBg = this.showDimensions ? `${this.color.replace(")", ",0.85)").replace("rgb(", "rgba(")}` : this.color;
|
|
4294
|
-
return
|
|
4525
|
+
return html8`
|
|
4295
4526
|
<div
|
|
4296
4527
|
data-syntro-highlight
|
|
4297
4528
|
data-syntro-editor-ui="highlight"
|
|
4298
|
-
role=${this.interactive ? "button" :
|
|
4299
|
-
tabindex=${this.interactive ? "0" :
|
|
4300
|
-
@click=${this.interactive ? this._handleClick :
|
|
4301
|
-
@keydown=${this.interactive ? this._handleKeyDown :
|
|
4529
|
+
role=${this.interactive ? "button" : nothing5}
|
|
4530
|
+
tabindex=${this.interactive ? "0" : nothing5}
|
|
4531
|
+
@click=${this.interactive ? this._handleClick : nothing5}
|
|
4532
|
+
@keydown=${this.interactive ? this._handleKeyDown : nothing5}
|
|
4302
4533
|
style=${styleMap3({
|
|
4303
4534
|
position: "fixed",
|
|
4304
4535
|
top: `${rect.top - this.padding}px`,
|
|
@@ -4315,7 +4546,7 @@ var ElementHighlightLit = class extends LitElement6 {
|
|
|
4315
4546
|
boxSizing: "border-box"
|
|
4316
4547
|
})}
|
|
4317
4548
|
>
|
|
4318
|
-
${displayLabel ?
|
|
4549
|
+
${displayLabel ? html8`<div
|
|
4319
4550
|
data-syntro-highlight-label
|
|
4320
4551
|
data-syntro-editor-ui="highlight-label"
|
|
4321
4552
|
class="se-text-xs"
|
|
@@ -4338,7 +4569,7 @@ var ElementHighlightLit = class extends LitElement6 {
|
|
|
4338
4569
|
>
|
|
4339
4570
|
<slot name="label-icon"></slot>
|
|
4340
4571
|
${displayLabel}
|
|
4341
|
-
${this.showRemove ?
|
|
4572
|
+
${this.showRemove ? html8`<button
|
|
4342
4573
|
type="button"
|
|
4343
4574
|
class="se-text-xs"
|
|
4344
4575
|
data-syntro-highlight-remove
|
|
@@ -4360,8 +4591,8 @@ var ElementHighlightLit = class extends LitElement6 {
|
|
|
4360
4591
|
})}
|
|
4361
4592
|
>
|
|
4362
4593
|
\u00d7
|
|
4363
|
-
</button>` :
|
|
4364
|
-
</div>` :
|
|
4594
|
+
</button>` : nothing5}
|
|
4595
|
+
</div>` : nothing5}
|
|
4365
4596
|
</div>
|
|
4366
4597
|
`;
|
|
4367
4598
|
}
|
|
@@ -4386,8 +4617,8 @@ if (!customElements.get("se-element-highlight")) {
|
|
|
4386
4617
|
}
|
|
4387
4618
|
|
|
4388
4619
|
// ../../shared-editor-ui/src/components/EmptyStateLit.ts
|
|
4389
|
-
import { html as
|
|
4390
|
-
var EmptyStateLit = class extends
|
|
4620
|
+
import { html as html9, LitElement as LitElement8 } from "lit";
|
|
4621
|
+
var EmptyStateLit = class extends LitElement8 {
|
|
4391
4622
|
constructor() {
|
|
4392
4623
|
super(...arguments);
|
|
4393
4624
|
this.message = "";
|
|
@@ -4396,7 +4627,7 @@ var EmptyStateLit = class extends LitElement7 {
|
|
|
4396
4627
|
return this;
|
|
4397
4628
|
}
|
|
4398
4629
|
render() {
|
|
4399
|
-
return
|
|
4630
|
+
return html9`
|
|
4400
4631
|
<div class="se-text-center se-py-8 se-px-4 se-text-text-secondary se-text-sm">
|
|
4401
4632
|
${this.message}
|
|
4402
4633
|
</div>
|
|
@@ -4411,8 +4642,8 @@ if (!customElements.get("se-empty-state")) {
|
|
|
4411
4642
|
}
|
|
4412
4643
|
|
|
4413
4644
|
// ../../shared-editor-ui/src/components/GroupHeaderLit.ts
|
|
4414
|
-
import { html as
|
|
4415
|
-
var GroupHeaderLit = class extends
|
|
4645
|
+
import { html as html10, LitElement as LitElement9 } from "lit";
|
|
4646
|
+
var GroupHeaderLit = class extends LitElement9 {
|
|
4416
4647
|
constructor() {
|
|
4417
4648
|
super(...arguments);
|
|
4418
4649
|
this.label = "";
|
|
@@ -4426,7 +4657,7 @@ var GroupHeaderLit = class extends LitElement8 {
|
|
|
4426
4657
|
"se-text-xs se-font-bold se-text-text-primary se-uppercase se-tracking-wide se-py-1 se-pb-2 se-flex se-items-center se-justify-between",
|
|
4427
4658
|
this.headerClass || ""
|
|
4428
4659
|
].filter(Boolean).join(" ");
|
|
4429
|
-
return
|
|
4660
|
+
return html10`
|
|
4430
4661
|
<div class=${classes}>
|
|
4431
4662
|
<span>${this.label}</span>
|
|
4432
4663
|
<span class="se-text-xs se-text-text-secondary se-bg-badge-slate-bg se-px-1.5 se-py-0.5 se-rounded-lg">
|
|
@@ -4445,6 +4676,383 @@ if (!customElements.get("se-group-header")) {
|
|
|
4445
4676
|
customElements.define("se-group-header", GroupHeaderLit);
|
|
4446
4677
|
}
|
|
4447
4678
|
|
|
4679
|
+
// ../../shared-editor-ui/src/components/TileChromeEditorLit.ts
|
|
4680
|
+
import { css as css2, html as html11, LitElement as LitElement10, nothing as nothing6 } from "lit";
|
|
4681
|
+
var EMOJI_LIST2 = [
|
|
4682
|
+
"\u{1F4B5}",
|
|
4683
|
+
"\u{1F4B0}",
|
|
4684
|
+
"\u{1F3DB}\uFE0F",
|
|
4685
|
+
"\u23ED\uFE0F",
|
|
4686
|
+
"\u27A1\uFE0F",
|
|
4687
|
+
"\u{1F4A1}",
|
|
4688
|
+
"\u{1F4CB}",
|
|
4689
|
+
"\u2705",
|
|
4690
|
+
"\u26A0\uFE0F",
|
|
4691
|
+
"\u{1F6E1}\uFE0F",
|
|
4692
|
+
"\u{1F4C8}",
|
|
4693
|
+
"\u{1F52C}",
|
|
4694
|
+
"\u{1F48A}",
|
|
4695
|
+
"\u{1F4C4}",
|
|
4696
|
+
"\u{1F9EA}",
|
|
4697
|
+
"\u{1F501}",
|
|
4698
|
+
"\u{1F9E0}",
|
|
4699
|
+
"\u{1F319}",
|
|
4700
|
+
"\u{1F4E6}",
|
|
4701
|
+
"\u{1F69A}",
|
|
4702
|
+
"\u{1F331}",
|
|
4703
|
+
"\u26A1",
|
|
4704
|
+
"\u{1F525}",
|
|
4705
|
+
"\u{1F333}",
|
|
4706
|
+
"\u{1F33F}",
|
|
4707
|
+
"\u2753",
|
|
4708
|
+
"\u{1F9ED}",
|
|
4709
|
+
"\u{1F4DD}",
|
|
4710
|
+
"\u{1F3AF}",
|
|
4711
|
+
"\u{1F3C6}",
|
|
4712
|
+
"\u2728",
|
|
4713
|
+
"\u{1F4AC}",
|
|
4714
|
+
"\u{1F3AE}",
|
|
4715
|
+
"\u23F1\uFE0F",
|
|
4716
|
+
"\u{1F4D6}",
|
|
4717
|
+
"\u{1F514}",
|
|
4718
|
+
"\u{1F393}",
|
|
4719
|
+
"\u23F0",
|
|
4720
|
+
"\u{1F504}",
|
|
4721
|
+
"\u{1F464}",
|
|
4722
|
+
"\u{1F3E0}",
|
|
4723
|
+
"\u{1F6D2}",
|
|
4724
|
+
"\u{1F4CA}",
|
|
4725
|
+
"\u{1F4C9}",
|
|
4726
|
+
"\u{1F967}",
|
|
4727
|
+
"\u{1F4B9}",
|
|
4728
|
+
"\u{1F321}\uFE0F"
|
|
4729
|
+
];
|
|
4730
|
+
var TileChromeEditorLit2 = class extends LitElement10 {
|
|
4731
|
+
constructor() {
|
|
4732
|
+
super(...arguments);
|
|
4733
|
+
this.tileMeta = { title: "", subtitle: "", icon: "" };
|
|
4734
|
+
this.onChange = () => {
|
|
4735
|
+
};
|
|
4736
|
+
this._pickerOpen = false;
|
|
4737
|
+
}
|
|
4738
|
+
_patch(field, value) {
|
|
4739
|
+
const updated = { ...this.tileMeta, [field]: value };
|
|
4740
|
+
this.tileMeta = updated;
|
|
4741
|
+
this.onChange(updated);
|
|
4742
|
+
}
|
|
4743
|
+
_selectEmoji(emoji) {
|
|
4744
|
+
const value = this.tileMeta.icon === emoji ? "" : emoji;
|
|
4745
|
+
this._patch("icon", value);
|
|
4746
|
+
}
|
|
4747
|
+
render() {
|
|
4748
|
+
return html11`
|
|
4749
|
+
<form @submit=${(e) => e.preventDefault()}>
|
|
4750
|
+
<label>
|
|
4751
|
+
<span>Title</span>
|
|
4752
|
+
<input
|
|
4753
|
+
name="title"
|
|
4754
|
+
type="text"
|
|
4755
|
+
.value=${this.tileMeta.title}
|
|
4756
|
+
@input=${(e) => this._patch("title", e.target.value)}
|
|
4757
|
+
/>
|
|
4758
|
+
</label>
|
|
4759
|
+
|
|
4760
|
+
<label>
|
|
4761
|
+
<span>Subtitle</span>
|
|
4762
|
+
<input
|
|
4763
|
+
name="subtitle"
|
|
4764
|
+
type="text"
|
|
4765
|
+
.value=${this.tileMeta.subtitle}
|
|
4766
|
+
placeholder="Optional"
|
|
4767
|
+
@input=${(e) => this._patch("subtitle", e.target.value)}
|
|
4768
|
+
/>
|
|
4769
|
+
</label>
|
|
4770
|
+
|
|
4771
|
+
<div class="icon-section">
|
|
4772
|
+
<span>Icon</span>
|
|
4773
|
+
<button
|
|
4774
|
+
type="button"
|
|
4775
|
+
class="icon-toggle"
|
|
4776
|
+
data-emoji-toggle
|
|
4777
|
+
@click=${() => {
|
|
4778
|
+
this._pickerOpen = !this._pickerOpen;
|
|
4779
|
+
}}
|
|
4780
|
+
>
|
|
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>`}
|
|
4782
|
+
</button>
|
|
4783
|
+
|
|
4784
|
+
${this._pickerOpen ? html11`
|
|
4785
|
+
<div data-emoji-grid class="emoji-grid">
|
|
4786
|
+
${EMOJI_LIST2.map(
|
|
4787
|
+
(emoji) => html11`
|
|
4788
|
+
<button
|
|
4789
|
+
type="button"
|
|
4790
|
+
data-emoji=${emoji}
|
|
4791
|
+
class=${this.tileMeta.icon === emoji ? "selected" : ""}
|
|
4792
|
+
@click=${() => this._selectEmoji(emoji)}
|
|
4793
|
+
title=${emoji}
|
|
4794
|
+
>${emoji}</button>
|
|
4795
|
+
`
|
|
4796
|
+
)}
|
|
4797
|
+
</div>
|
|
4798
|
+
` : nothing6}
|
|
4799
|
+
</div>
|
|
4800
|
+
</form>
|
|
4801
|
+
`;
|
|
4802
|
+
}
|
|
4803
|
+
};
|
|
4804
|
+
TileChromeEditorLit2.styles = css2`
|
|
4805
|
+
:host {
|
|
4806
|
+
display: block;
|
|
4807
|
+
width: 100%;
|
|
4808
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
4809
|
+
}
|
|
4810
|
+
form {
|
|
4811
|
+
display: flex;
|
|
4812
|
+
flex-direction: column;
|
|
4813
|
+
gap: 16px;
|
|
4814
|
+
}
|
|
4815
|
+
label {
|
|
4816
|
+
display: flex;
|
|
4817
|
+
flex-direction: column;
|
|
4818
|
+
gap: 6px;
|
|
4819
|
+
}
|
|
4820
|
+
label > span {
|
|
4821
|
+
font-size: 13px;
|
|
4822
|
+
font-weight: 500;
|
|
4823
|
+
color: var(--syntro-text-secondary, #a8afba);
|
|
4824
|
+
}
|
|
4825
|
+
input[type='text'] {
|
|
4826
|
+
width: 100%;
|
|
4827
|
+
box-sizing: border-box;
|
|
4828
|
+
padding: 8px 12px;
|
|
4829
|
+
border-radius: 6px;
|
|
4830
|
+
border: 1px solid var(--syntro-input-field-border-default, #2b333f);
|
|
4831
|
+
background: var(--syntro-input-field-bg-default, #0e1114);
|
|
4832
|
+
color: var(--syntro-text-primary, #cbd0d7);
|
|
4833
|
+
font-size: 14px;
|
|
4834
|
+
font-family: inherit;
|
|
4835
|
+
outline: none;
|
|
4836
|
+
}
|
|
4837
|
+
input[type='text']:focus {
|
|
4838
|
+
border-color: var(--syntro-input-field-border-selected, #b72e2a);
|
|
4839
|
+
box-shadow: var(--syntro-focus-ring-primary, 0 0 0 4px rgba(221, 109, 105, 0.25));
|
|
4840
|
+
}
|
|
4841
|
+
.icon-section {
|
|
4842
|
+
display: flex;
|
|
4843
|
+
flex-direction: column;
|
|
4844
|
+
gap: 6px;
|
|
4845
|
+
}
|
|
4846
|
+
.icon-section > span {
|
|
4847
|
+
font-size: 13px;
|
|
4848
|
+
font-weight: 500;
|
|
4849
|
+
color: var(--syntro-text-secondary, #a8afba);
|
|
4850
|
+
}
|
|
4851
|
+
.icon-toggle {
|
|
4852
|
+
display: inline-flex;
|
|
4853
|
+
align-items: center;
|
|
4854
|
+
gap: 8px;
|
|
4855
|
+
padding: 8px 12px;
|
|
4856
|
+
border-radius: 6px;
|
|
4857
|
+
border: 1px solid var(--syntro-input-field-border-default, #2b333f);
|
|
4858
|
+
background: var(--syntro-input-field-bg-default, #0e1114);
|
|
4859
|
+
color: var(--syntro-text-primary, #cbd0d7);
|
|
4860
|
+
font-size: 14px;
|
|
4861
|
+
cursor: pointer;
|
|
4862
|
+
font-family: inherit;
|
|
4863
|
+
}
|
|
4864
|
+
.icon-toggle:hover {
|
|
4865
|
+
border-color: var(--syntro-input-field-border-selected, #b72e2a);
|
|
4866
|
+
}
|
|
4867
|
+
.emoji-grid {
|
|
4868
|
+
display: grid;
|
|
4869
|
+
grid-template-columns: repeat(8, 1fr);
|
|
4870
|
+
gap: 4px;
|
|
4871
|
+
padding: 8px;
|
|
4872
|
+
margin-top: 4px;
|
|
4873
|
+
background: var(--syntro-background-secondary, #07080a);
|
|
4874
|
+
border: 1px solid var(--syntro-input-field-border-default, #2b333f);
|
|
4875
|
+
border-radius: 8px;
|
|
4876
|
+
max-height: 200px;
|
|
4877
|
+
overflow-y: auto;
|
|
4878
|
+
}
|
|
4879
|
+
.emoji-grid button {
|
|
4880
|
+
display: flex;
|
|
4881
|
+
align-items: center;
|
|
4882
|
+
justify-content: center;
|
|
4883
|
+
width: 36px;
|
|
4884
|
+
height: 36px;
|
|
4885
|
+
border: 1px solid transparent;
|
|
4886
|
+
border-radius: 6px;
|
|
4887
|
+
background: transparent;
|
|
4888
|
+
font-size: 18px;
|
|
4889
|
+
cursor: pointer;
|
|
4890
|
+
padding: 0;
|
|
4891
|
+
transition: background 100ms ease, border-color 100ms ease;
|
|
4892
|
+
}
|
|
4893
|
+
.emoji-grid button:hover {
|
|
4894
|
+
background: rgba(183, 46, 42, 0.1);
|
|
4895
|
+
border-color: rgba(183, 46, 42, 0.3);
|
|
4896
|
+
}
|
|
4897
|
+
.emoji-grid button.selected {
|
|
4898
|
+
background: rgba(183, 46, 42, 0.2);
|
|
4899
|
+
border-color: var(--syntro-button-primary-bg-default, #b72e2a);
|
|
4900
|
+
}
|
|
4901
|
+
`;
|
|
4902
|
+
TileChromeEditorLit2.properties = {
|
|
4903
|
+
tileMeta: { attribute: false },
|
|
4904
|
+
onChange: { attribute: false },
|
|
4905
|
+
_pickerOpen: { state: true }
|
|
4906
|
+
};
|
|
4907
|
+
if (!customElements.get("syntro-tile-chrome-editor")) {
|
|
4908
|
+
customElements.define("syntro-tile-chrome-editor", TileChromeEditorLit2);
|
|
4909
|
+
}
|
|
4910
|
+
|
|
4911
|
+
// src/faq-item-editor.ts
|
|
4912
|
+
import { css as css3, html as html12, LitElement as LitElement11, nothing as nothing7 } from "lit";
|
|
4913
|
+
var getAnswerText = (answer) => {
|
|
4914
|
+
if (typeof answer === "string") return answer;
|
|
4915
|
+
if (answer.type === "rich") return answer.html;
|
|
4916
|
+
return answer.content;
|
|
4917
|
+
};
|
|
4918
|
+
var FAQItemEditorLit = class extends LitElement11 {
|
|
4919
|
+
constructor() {
|
|
4920
|
+
super(...arguments);
|
|
4921
|
+
this.itemId = "";
|
|
4922
|
+
this.appConfig = {
|
|
4923
|
+
expandBehavior: "single",
|
|
4924
|
+
searchable: false,
|
|
4925
|
+
theme: "auto",
|
|
4926
|
+
actions: []
|
|
4927
|
+
};
|
|
4928
|
+
this.onChange = () => {
|
|
4929
|
+
};
|
|
4930
|
+
}
|
|
4931
|
+
_findItem() {
|
|
4932
|
+
return this.appConfig.actions.find((a) => a.config.id === this.itemId);
|
|
4933
|
+
}
|
|
4934
|
+
_patchField(field, value) {
|
|
4935
|
+
const next = {
|
|
4936
|
+
...this.appConfig,
|
|
4937
|
+
actions: this.appConfig.actions.map(
|
|
4938
|
+
(a) => a.config.id === this.itemId ? { ...a, config: { ...a.config, [field]: value } } : a
|
|
4939
|
+
)
|
|
4940
|
+
};
|
|
4941
|
+
this.onChange(next);
|
|
4942
|
+
}
|
|
4943
|
+
render() {
|
|
4944
|
+
const item = this._findItem();
|
|
4945
|
+
if (!item) {
|
|
4946
|
+
return html12`<p>Item not found</p>`;
|
|
4947
|
+
}
|
|
4948
|
+
const q = item;
|
|
4949
|
+
const answerText = getAnswerText(q.config.answer);
|
|
4950
|
+
return html12`
|
|
4951
|
+
<form @submit=${(e) => e.preventDefault()}>
|
|
4952
|
+
<div>
|
|
4953
|
+
<label>
|
|
4954
|
+
<span>Question</span>
|
|
4955
|
+
<input
|
|
4956
|
+
name="question"
|
|
4957
|
+
type="text"
|
|
4958
|
+
.value=${q.config.question ?? ""}
|
|
4959
|
+
@input=${(e) => this._patchField("question", e.target.value)}
|
|
4960
|
+
/>
|
|
4961
|
+
</label>
|
|
4962
|
+
</div>
|
|
4963
|
+
|
|
4964
|
+
<div>
|
|
4965
|
+
<label>
|
|
4966
|
+
<span>Answer</span>
|
|
4967
|
+
<textarea
|
|
4968
|
+
name="answer"
|
|
4969
|
+
rows="4"
|
|
4970
|
+
.value=${answerText}
|
|
4971
|
+
@input=${(e) => this._patchField("answer", e.target.value)}
|
|
4972
|
+
></textarea>
|
|
4973
|
+
</label>
|
|
4974
|
+
</div>
|
|
4975
|
+
|
|
4976
|
+
<div>
|
|
4977
|
+
<label>
|
|
4978
|
+
<span>Category</span>
|
|
4979
|
+
<input
|
|
4980
|
+
name="category"
|
|
4981
|
+
type="text"
|
|
4982
|
+
.value=${q.config.category ?? ""}
|
|
4983
|
+
placeholder="e.g., Billing, Account"
|
|
4984
|
+
@input=${(e) => this._patchField("category", e.target.value)}
|
|
4985
|
+
/>
|
|
4986
|
+
</label>
|
|
4987
|
+
</div>
|
|
4988
|
+
|
|
4989
|
+
${q.rationale ? html12`
|
|
4990
|
+
<div>
|
|
4991
|
+
<span>AI Rationale</span>
|
|
4992
|
+
<div data-rationale>${q.rationale.why}</div>
|
|
4993
|
+
</div>
|
|
4994
|
+
` : nothing7}
|
|
4995
|
+
</form>
|
|
4996
|
+
`;
|
|
4997
|
+
}
|
|
4998
|
+
};
|
|
4999
|
+
FAQItemEditorLit.styles = css3`
|
|
5000
|
+
:host {
|
|
5001
|
+
display: block;
|
|
5002
|
+
width: 100%;
|
|
5003
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
5004
|
+
}
|
|
5005
|
+
form {
|
|
5006
|
+
display: flex;
|
|
5007
|
+
flex-direction: column;
|
|
5008
|
+
gap: 16px;
|
|
5009
|
+
}
|
|
5010
|
+
label {
|
|
5011
|
+
display: flex;
|
|
5012
|
+
flex-direction: column;
|
|
5013
|
+
gap: 6px;
|
|
5014
|
+
}
|
|
5015
|
+
label > span {
|
|
5016
|
+
font-size: 13px;
|
|
5017
|
+
font-weight: 500;
|
|
5018
|
+
color: var(--syntro-text-secondary, #a8afba);
|
|
5019
|
+
}
|
|
5020
|
+
input,
|
|
5021
|
+
textarea {
|
|
5022
|
+
width: 100%;
|
|
5023
|
+
box-sizing: border-box;
|
|
5024
|
+
padding: 8px 12px;
|
|
5025
|
+
border-radius: 6px;
|
|
5026
|
+
border: 1px solid var(--syntro-input-field-border-default, #2b333f);
|
|
5027
|
+
background: var(--syntro-input-field-bg-default, #0e1114);
|
|
5028
|
+
color: var(--syntro-text-primary, #cbd0d7);
|
|
5029
|
+
font-size: 14px;
|
|
5030
|
+
font-family: inherit;
|
|
5031
|
+
outline: none;
|
|
5032
|
+
}
|
|
5033
|
+
input:focus,
|
|
5034
|
+
textarea:focus {
|
|
5035
|
+
border-color: var(--syntro-input-field-border-selected, #b72e2a);
|
|
5036
|
+
box-shadow: var(--syntro-focus-ring-primary, 0 0 0 4px rgba(221, 109, 105, 0.25));
|
|
5037
|
+
}
|
|
5038
|
+
textarea {
|
|
5039
|
+
resize: vertical;
|
|
5040
|
+
}
|
|
5041
|
+
[data-rationale] {
|
|
5042
|
+
font-size: 13px;
|
|
5043
|
+
color: var(--syntro-text-tertiary, #87919f);
|
|
5044
|
+
padding: 8px 12px;
|
|
5045
|
+
background: var(--syntro-background-secondary, #07080a);
|
|
5046
|
+
border-radius: 6px;
|
|
5047
|
+
}
|
|
5048
|
+
`;
|
|
5049
|
+
FAQItemEditorLit.properties = {
|
|
5050
|
+
itemId: { type: String, attribute: "item-id" },
|
|
5051
|
+
appConfig: { attribute: false },
|
|
5052
|
+
onChange: { attribute: false }
|
|
5053
|
+
};
|
|
5054
|
+
customElements.define("syntro-faq-item-editor", FAQItemEditorLit);
|
|
5055
|
+
|
|
4448
5056
|
// src/summarize.ts
|
|
4449
5057
|
var MAX_Q_LEN = 50;
|
|
4450
5058
|
var MAX_A_LEN = 40;
|
|
@@ -4452,8 +5060,8 @@ function truncate(text, max) {
|
|
|
4452
5060
|
if (text.length <= max) return text;
|
|
4453
5061
|
return `${text.slice(0, max).trimEnd()}...`;
|
|
4454
5062
|
}
|
|
4455
|
-
function stripHtml(
|
|
4456
|
-
return
|
|
5063
|
+
function stripHtml(html15) {
|
|
5064
|
+
return html15.replace(/<[^>]*>/g, "").trim();
|
|
4457
5065
|
}
|
|
4458
5066
|
function getAnswerPreview(answer) {
|
|
4459
5067
|
if (typeof answer === "string") return answer;
|
|
@@ -4475,12 +5083,392 @@ function isOwnAction(action) {
|
|
|
4475
5083
|
return action.kind.startsWith(`${ACTION_NAMESPACE}:`);
|
|
4476
5084
|
}
|
|
4477
5085
|
|
|
4478
|
-
// src/
|
|
4479
|
-
|
|
4480
|
-
|
|
4481
|
-
|
|
4482
|
-
|
|
5086
|
+
// src/FAQWidgetLit.editable.ts
|
|
5087
|
+
import { html as html13, LitElement as LitElement12, nothing as nothing8 } from "lit";
|
|
5088
|
+
import { styleMap as styleMap4 } from "lit/directives/style-map.js";
|
|
5089
|
+
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
5090
|
+
function sm(styles) {
|
|
5091
|
+
return styles;
|
|
5092
|
+
}
|
|
5093
|
+
var ADAPTIVE_ID = "adaptive-faq:accordion";
|
|
5094
|
+
var SORTABLE_STYLE_ID = "syntro-sortable-drag-styles";
|
|
5095
|
+
function ensureSortableStyles() {
|
|
5096
|
+
if (document.getElementById(SORTABLE_STYLE_ID)) return;
|
|
5097
|
+
const style = document.createElement("style");
|
|
5098
|
+
style.id = SORTABLE_STYLE_ID;
|
|
5099
|
+
style.textContent = `
|
|
5100
|
+
.syntro-sortable-dragging {
|
|
5101
|
+
opacity: 0.4;
|
|
5102
|
+
background: rgba(106, 89, 206, 0.08) !important;
|
|
5103
|
+
box-shadow: inset 0 0 0 1px rgba(106, 89, 206, 0.2);
|
|
5104
|
+
transition: opacity 150ms ease, background 150ms ease;
|
|
5105
|
+
}
|
|
5106
|
+
.syntro-sortable-drag-over {
|
|
5107
|
+
background: rgba(106, 89, 206, 0.04) !important;
|
|
5108
|
+
transition: background 150ms ease;
|
|
5109
|
+
}
|
|
5110
|
+
.syntro-sortable-active [data-drag-handle] {
|
|
5111
|
+
cursor: grabbing;
|
|
5112
|
+
}
|
|
5113
|
+
`;
|
|
5114
|
+
document.head.appendChild(style);
|
|
5115
|
+
}
|
|
5116
|
+
var ROW_STYLE = {
|
|
5117
|
+
position: "relative",
|
|
5118
|
+
display: "flex",
|
|
5119
|
+
flexWrap: "wrap",
|
|
5120
|
+
alignItems: "center",
|
|
5121
|
+
padding: "12px 16px",
|
|
5122
|
+
cursor: "default",
|
|
5123
|
+
userSelect: "none",
|
|
5124
|
+
borderBottom: "1px solid rgba(0, 0, 0, 0.06)",
|
|
5125
|
+
transition: "background 0.15s ease"
|
|
5126
|
+
};
|
|
5127
|
+
var ROW_HOVER_STYLE = {
|
|
5128
|
+
...ROW_STYLE,
|
|
5129
|
+
background: "rgba(106, 89, 206, 0.06)"
|
|
5130
|
+
};
|
|
5131
|
+
var QUESTION_STYLE = {
|
|
5132
|
+
flex: "1",
|
|
5133
|
+
fontWeight: "500",
|
|
5134
|
+
fontSize: "14px",
|
|
5135
|
+
lineHeight: "1.4",
|
|
5136
|
+
color: "inherit",
|
|
5137
|
+
cursor: "pointer"
|
|
5138
|
+
};
|
|
5139
|
+
var ANSWER_STYLE = {
|
|
5140
|
+
width: "100%",
|
|
5141
|
+
padding: "4px 16px 8px",
|
|
5142
|
+
fontSize: "13px",
|
|
5143
|
+
lineHeight: "1.5",
|
|
5144
|
+
color: "rgba(0, 0, 0, 0.6)"
|
|
5145
|
+
};
|
|
5146
|
+
var PENCIL_STYLE = {
|
|
5147
|
+
flexShrink: "0",
|
|
5148
|
+
marginLeft: "8px",
|
|
5149
|
+
padding: "4px 6px",
|
|
5150
|
+
background: "transparent",
|
|
5151
|
+
border: "1px solid rgba(106, 89, 206, 0.3)",
|
|
5152
|
+
borderRadius: "4px",
|
|
5153
|
+
cursor: "pointer",
|
|
5154
|
+
fontSize: "12px",
|
|
5155
|
+
opacity: "0",
|
|
5156
|
+
transition: "opacity 0.15s ease",
|
|
5157
|
+
color: "rgb(106, 89, 206)",
|
|
5158
|
+
display: "flex",
|
|
5159
|
+
alignItems: "center",
|
|
5160
|
+
justifyContent: "center"
|
|
5161
|
+
};
|
|
5162
|
+
var PENCIL_VISIBLE_STYLE = {
|
|
5163
|
+
...PENCIL_STYLE,
|
|
5164
|
+
opacity: "1"
|
|
4483
5165
|
};
|
|
5166
|
+
var DRAG_HANDLE_STYLE = {
|
|
5167
|
+
flexShrink: "0",
|
|
5168
|
+
marginRight: "8px",
|
|
5169
|
+
cursor: "grab",
|
|
5170
|
+
fontSize: "14px",
|
|
5171
|
+
color: "rgba(0, 0, 0, 0.3)",
|
|
5172
|
+
lineHeight: "1"
|
|
5173
|
+
};
|
|
5174
|
+
var CONTAINER_STYLE = {
|
|
5175
|
+
borderRadius: "8px",
|
|
5176
|
+
overflow: "hidden",
|
|
5177
|
+
border: "1px solid rgba(0, 0, 0, 0.08)",
|
|
5178
|
+
background: "#fff"
|
|
5179
|
+
};
|
|
5180
|
+
var EMPTY_STYLE = {
|
|
5181
|
+
padding: "16px",
|
|
5182
|
+
color: "rgba(0, 0, 0, 0.4)",
|
|
5183
|
+
fontSize: "13px",
|
|
5184
|
+
textAlign: "center"
|
|
5185
|
+
};
|
|
5186
|
+
var TILE_EDIT_BTN_STYLE = {
|
|
5187
|
+
position: "absolute",
|
|
5188
|
+
top: "8px",
|
|
5189
|
+
right: "8px",
|
|
5190
|
+
padding: "4px 6px",
|
|
5191
|
+
background: "transparent",
|
|
5192
|
+
border: "1px solid rgba(106, 89, 206, 0.3)",
|
|
5193
|
+
borderRadius: "4px",
|
|
5194
|
+
cursor: "pointer",
|
|
5195
|
+
fontSize: "12px",
|
|
5196
|
+
opacity: "0",
|
|
5197
|
+
transition: "opacity 0.15s ease",
|
|
5198
|
+
color: "rgb(106, 89, 206)",
|
|
5199
|
+
display: "flex",
|
|
5200
|
+
alignItems: "center",
|
|
5201
|
+
justifyContent: "center",
|
|
5202
|
+
zIndex: "1"
|
|
5203
|
+
};
|
|
5204
|
+
var TILE_EDIT_BTN_VISIBLE_STYLE = {
|
|
5205
|
+
...TILE_EDIT_BTN_STYLE,
|
|
5206
|
+
opacity: "1"
|
|
5207
|
+
};
|
|
5208
|
+
var FAQAccordionEditableElement = class extends LitElement12 {
|
|
5209
|
+
constructor() {
|
|
5210
|
+
super(...arguments);
|
|
5211
|
+
// -------------------------------------------------------------------------
|
|
5212
|
+
// Property declarations
|
|
5213
|
+
// -------------------------------------------------------------------------
|
|
5214
|
+
this.faqConfig = {
|
|
5215
|
+
expandBehavior: "single",
|
|
5216
|
+
searchable: false,
|
|
5217
|
+
theme: "auto",
|
|
5218
|
+
actions: []
|
|
5219
|
+
};
|
|
5220
|
+
/** Null when loaded without an editor context — renders read-only accordion. */
|
|
5221
|
+
this.controller = null;
|
|
5222
|
+
/**
|
|
5223
|
+
* Host tile id, threaded in via the mountable's `instanceId`. Scopes every
|
|
5224
|
+
* controller call so the right tile is targeted when the canvas has more
|
|
5225
|
+
* than one FAQ tile (per-route FAQs). Empty string when unknown.
|
|
5226
|
+
*/
|
|
5227
|
+
this.tileId = "";
|
|
5228
|
+
/**
|
|
5229
|
+
* The `makeSortable` factory to use. Injected by FAQWidgetLitEditableMountable
|
|
5230
|
+
* from the editor-sdk bootstrap so there is no direct import from editor-sdk
|
|
5231
|
+
* into this package (which would create a circular dependency).
|
|
5232
|
+
*
|
|
5233
|
+
* Null when running without the editor context (read-only mode).
|
|
5234
|
+
*/
|
|
5235
|
+
this.sortable = null;
|
|
5236
|
+
/**
|
|
5237
|
+
* Shared aria-live region from the modal host, threaded in via mount config.
|
|
5238
|
+
* Falls back to a detached element when running outside the editor context.
|
|
5239
|
+
*
|
|
5240
|
+
* TODO(phase-2-a11y): wire shared live region from modal host for real a11y.
|
|
5241
|
+
*/
|
|
5242
|
+
this.liveRegion = null;
|
|
5243
|
+
this._hoveredId = null;
|
|
5244
|
+
this._expandedId = null;
|
|
5245
|
+
this._containerHovered = false;
|
|
5246
|
+
// -------------------------------------------------------------------------
|
|
5247
|
+
// Private sortable state
|
|
5248
|
+
// -------------------------------------------------------------------------
|
|
5249
|
+
this._sortableHandle = null;
|
|
5250
|
+
}
|
|
5251
|
+
// -------------------------------------------------------------------------
|
|
5252
|
+
// Light DOM — inherits host-page CSS variables
|
|
5253
|
+
// -------------------------------------------------------------------------
|
|
5254
|
+
createRenderRoot() {
|
|
5255
|
+
return this;
|
|
5256
|
+
}
|
|
5257
|
+
connectedCallback() {
|
|
5258
|
+
super.connectedCallback();
|
|
5259
|
+
ensureSortableStyles();
|
|
5260
|
+
}
|
|
5261
|
+
// -------------------------------------------------------------------------
|
|
5262
|
+
// Lifecycle — sortable wiring
|
|
5263
|
+
// -------------------------------------------------------------------------
|
|
5264
|
+
/**
|
|
5265
|
+
* Wire (or re-wire) the sortable whenever the properties it depends on change.
|
|
5266
|
+
* `updated()` fires after every render, including the first, so we don't need
|
|
5267
|
+
* a separate `firstUpdated()` call — using `updated()` alone avoids a double
|
|
5268
|
+
* attach on mount (firstUpdated + updated both fire on first render).
|
|
5269
|
+
*/
|
|
5270
|
+
updated(changed) {
|
|
5271
|
+
if (changed.has("controller") || changed.has("faqConfig") || changed.has("sortable")) {
|
|
5272
|
+
this._sortableHandle?.destroy();
|
|
5273
|
+
this._sortableHandle = null;
|
|
5274
|
+
this._attachSortable();
|
|
5275
|
+
}
|
|
5276
|
+
}
|
|
5277
|
+
disconnectedCallback() {
|
|
5278
|
+
super.disconnectedCallback();
|
|
5279
|
+
this._sortableHandle?.destroy();
|
|
5280
|
+
this._sortableHandle = null;
|
|
5281
|
+
}
|
|
5282
|
+
_attachSortable() {
|
|
5283
|
+
if (!this.controller) return;
|
|
5284
|
+
if (!this.sortable) return;
|
|
5285
|
+
if ((this.faqConfig.actions ?? []).length < 2) return;
|
|
5286
|
+
const liveRegion = this.liveRegion ?? document.createElement("div");
|
|
5287
|
+
this._sortableHandle = this.sortable(this, {
|
|
5288
|
+
itemSelector: "[data-faq-editable-row]",
|
|
5289
|
+
handleSelector: "[data-drag-handle]",
|
|
5290
|
+
getItems: () => (this.faqConfig.actions ?? []).map((a) => a.config.id),
|
|
5291
|
+
onReorder: (newOrder) => this.controller.reorderItems(ADAPTIVE_ID, newOrder, this.tileId || void 0),
|
|
5292
|
+
liveRegion
|
|
5293
|
+
});
|
|
5294
|
+
}
|
|
5295
|
+
// -------------------------------------------------------------------------
|
|
5296
|
+
// Handlers
|
|
5297
|
+
// -------------------------------------------------------------------------
|
|
5298
|
+
_handleEdit(itemId) {
|
|
5299
|
+
if (!this.controller) return;
|
|
5300
|
+
if (this.controller.isModalOpen()) return;
|
|
5301
|
+
this.controller.editItem(ADAPTIVE_ID, itemId, this.tileId || void 0);
|
|
5302
|
+
}
|
|
5303
|
+
_handlePencilClick(e, itemId) {
|
|
5304
|
+
e.stopPropagation();
|
|
5305
|
+
this._handleEdit(itemId);
|
|
5306
|
+
}
|
|
5307
|
+
_handleContainerEdit() {
|
|
5308
|
+
if (!this.controller) return;
|
|
5309
|
+
if (this.controller.isModalOpen()) return;
|
|
5310
|
+
this.controller.editContainer(ADAPTIVE_ID, this.tileId || void 0);
|
|
5311
|
+
}
|
|
5312
|
+
_toggleExpand(itemId) {
|
|
5313
|
+
this._expandedId = this._expandedId === itemId ? null : itemId;
|
|
5314
|
+
}
|
|
5315
|
+
// -------------------------------------------------------------------------
|
|
5316
|
+
// Render helpers
|
|
5317
|
+
// -------------------------------------------------------------------------
|
|
5318
|
+
_renderRow(item, showHandles) {
|
|
5319
|
+
const isHovered = this._hoveredId === item.config.id;
|
|
5320
|
+
const isExpanded = this._expandedId === item.config.id;
|
|
5321
|
+
const rowStyle = isHovered ? ROW_HOVER_STYLE : ROW_STYLE;
|
|
5322
|
+
const pencilStyle = isHovered ? PENCIL_VISIBLE_STYLE : PENCIL_STYLE;
|
|
5323
|
+
return html13`
|
|
5324
|
+
<div
|
|
5325
|
+
data-faq-editable-row
|
|
5326
|
+
data-item-id=${item.config.id}
|
|
5327
|
+
style=${styleMap4(sm(rowStyle))}
|
|
5328
|
+
@mouseenter=${() => {
|
|
5329
|
+
this._hoveredId = item.config.id;
|
|
5330
|
+
}}
|
|
5331
|
+
@mouseleave=${() => {
|
|
5332
|
+
this._hoveredId = null;
|
|
5333
|
+
}}
|
|
5334
|
+
>
|
|
5335
|
+
${showHandles ? html13`
|
|
5336
|
+
<span
|
|
5337
|
+
data-drag-handle
|
|
5338
|
+
style=${styleMap4(sm(DRAG_HANDLE_STYLE))}
|
|
5339
|
+
title="Drag to reorder"
|
|
5340
|
+
aria-hidden="true"
|
|
5341
|
+
>⠿</span>
|
|
5342
|
+
` : nothing8}
|
|
5343
|
+
|
|
5344
|
+
<span
|
|
5345
|
+
style=${styleMap4(sm(QUESTION_STYLE))}
|
|
5346
|
+
@click=${() => this._toggleExpand(item.config.id)}
|
|
5347
|
+
>${item.config.question}</span>
|
|
5348
|
+
|
|
5349
|
+
<button
|
|
5350
|
+
type="button"
|
|
5351
|
+
data-edit-pencil
|
|
5352
|
+
data-item-id=${item.config.id}
|
|
5353
|
+
style=${styleMap4(sm(pencilStyle))}
|
|
5354
|
+
title="Edit this item"
|
|
5355
|
+
aria-label="Edit ${item.config.question}"
|
|
5356
|
+
@click=${(e) => this._handlePencilClick(e, item.config.id)}
|
|
5357
|
+
>✏️</button>
|
|
5358
|
+
|
|
5359
|
+
${isExpanded && item.config.answer ? html13`<div data-faq-answer style=${styleMap4(sm(ANSWER_STYLE))}>${unsafeHTML(renderAnswerHtml(item.config.answer))}</div>` : nothing8}
|
|
5360
|
+
</div>
|
|
5361
|
+
`;
|
|
5362
|
+
}
|
|
5363
|
+
// -------------------------------------------------------------------------
|
|
5364
|
+
// Render
|
|
5365
|
+
// -------------------------------------------------------------------------
|
|
5366
|
+
render() {
|
|
5367
|
+
const items = this.faqConfig.actions ?? [];
|
|
5368
|
+
const hasController = this.controller !== null;
|
|
5369
|
+
const showHandles = hasController && items.length >= 2;
|
|
5370
|
+
if (items.length === 0) {
|
|
5371
|
+
return html13`
|
|
5372
|
+
<div
|
|
5373
|
+
style=${styleMap4(sm(CONTAINER_STYLE))}
|
|
5374
|
+
data-adaptive-id="faq-editable"
|
|
5375
|
+
data-adaptive-type="adaptive-faq"
|
|
5376
|
+
>
|
|
5377
|
+
<div style=${styleMap4(sm(EMPTY_STYLE))}>
|
|
5378
|
+
No FAQ items yet. Add items in the editor panel.
|
|
5379
|
+
</div>
|
|
5380
|
+
</div>
|
|
5381
|
+
`;
|
|
5382
|
+
}
|
|
5383
|
+
if (hasController) {
|
|
5384
|
+
const editBtnStyle = this._containerHovered ? TILE_EDIT_BTN_VISIBLE_STYLE : TILE_EDIT_BTN_STYLE;
|
|
5385
|
+
return html13`
|
|
5386
|
+
<div
|
|
5387
|
+
style=${styleMap4(sm({ ...CONTAINER_STYLE, position: "relative" }))}
|
|
5388
|
+
data-adaptive-id="faq-editable"
|
|
5389
|
+
data-adaptive-type="adaptive-faq"
|
|
5390
|
+
@mouseenter=${() => {
|
|
5391
|
+
this._containerHovered = true;
|
|
5392
|
+
}}
|
|
5393
|
+
@mouseleave=${() => {
|
|
5394
|
+
this._containerHovered = false;
|
|
5395
|
+
}}
|
|
5396
|
+
>
|
|
5397
|
+
<button
|
|
5398
|
+
type="button"
|
|
5399
|
+
data-settings-btn
|
|
5400
|
+
style=${styleMap4(sm(editBtnStyle))}
|
|
5401
|
+
title="Edit tile settings"
|
|
5402
|
+
aria-label="Edit tile settings"
|
|
5403
|
+
@click=${() => this._handleContainerEdit()}
|
|
5404
|
+
>✏️</button>
|
|
5405
|
+
${items.map((item) => this._renderRow(item, showHandles))}
|
|
5406
|
+
</div>
|
|
5407
|
+
`;
|
|
5408
|
+
}
|
|
5409
|
+
return html13`
|
|
5410
|
+
<div
|
|
5411
|
+
style=${styleMap4(sm(CONTAINER_STYLE))}
|
|
5412
|
+
data-adaptive-id="faq-editable"
|
|
5413
|
+
data-adaptive-type="adaptive-faq"
|
|
5414
|
+
>
|
|
5415
|
+
${items.map(
|
|
5416
|
+
(item) => html13`
|
|
5417
|
+
<div
|
|
5418
|
+
style=${styleMap4(sm(ROW_STYLE))}
|
|
5419
|
+
data-faq-item-id=${item.config.id}
|
|
5420
|
+
>
|
|
5421
|
+
<span style=${styleMap4(sm(QUESTION_STYLE))}>${item.config.question}</span>
|
|
5422
|
+
</div>
|
|
5423
|
+
`
|
|
5424
|
+
)}
|
|
5425
|
+
</div>
|
|
5426
|
+
`;
|
|
5427
|
+
}
|
|
5428
|
+
};
|
|
5429
|
+
// -------------------------------------------------------------------------
|
|
5430
|
+
// Reactive properties
|
|
5431
|
+
// -------------------------------------------------------------------------
|
|
5432
|
+
FAQAccordionEditableElement.properties = {
|
|
5433
|
+
faqConfig: { attribute: false },
|
|
5434
|
+
controller: { attribute: false },
|
|
5435
|
+
tileId: { attribute: false },
|
|
5436
|
+
// Internal hover state per item id
|
|
5437
|
+
_hoveredId: { state: true },
|
|
5438
|
+
_expandedId: { state: true },
|
|
5439
|
+
_containerHovered: { state: true }
|
|
5440
|
+
};
|
|
5441
|
+
if (!customElements.get("syntro-faq-accordion-editable")) {
|
|
5442
|
+
customElements.define("syntro-faq-accordion-editable", FAQAccordionEditableElement);
|
|
5443
|
+
}
|
|
5444
|
+
var FAQWidgetLitEditableMountable = {
|
|
5445
|
+
mount(container, config) {
|
|
5446
|
+
const {
|
|
5447
|
+
instanceId = "",
|
|
5448
|
+
controller = null,
|
|
5449
|
+
sortable = null,
|
|
5450
|
+
liveRegion = null,
|
|
5451
|
+
...faqConfig
|
|
5452
|
+
} = config ?? {
|
|
5453
|
+
expandBehavior: "single",
|
|
5454
|
+
searchable: false,
|
|
5455
|
+
theme: "auto",
|
|
5456
|
+
actions: []
|
|
5457
|
+
};
|
|
5458
|
+
const el = document.createElement("syntro-faq-accordion-editable");
|
|
5459
|
+
Object.assign(el, {
|
|
5460
|
+
faqConfig,
|
|
5461
|
+
controller,
|
|
5462
|
+
sortable,
|
|
5463
|
+
liveRegion,
|
|
5464
|
+
tileId: instanceId
|
|
5465
|
+
});
|
|
5466
|
+
container.appendChild(el);
|
|
5467
|
+
return () => el.remove();
|
|
5468
|
+
}
|
|
5469
|
+
};
|
|
5470
|
+
|
|
5471
|
+
// src/editor.ts
|
|
4484
5472
|
var summarizeTriggerWhen = (triggerWhen) => {
|
|
4485
5473
|
if (!triggerWhen || typeof triggerWhen !== "object") return "";
|
|
4486
5474
|
const t = triggerWhen;
|
|
@@ -4533,26 +5521,16 @@ function buildFlatItem(key, groupIdx, itemIdx, q) {
|
|
|
4533
5521
|
question: q
|
|
4534
5522
|
};
|
|
4535
5523
|
}
|
|
4536
|
-
var FAQEditorLit = class extends
|
|
5524
|
+
var FAQEditorLit = class extends LitElement13 {
|
|
4537
5525
|
constructor() {
|
|
4538
5526
|
super(...arguments);
|
|
4539
5527
|
this.config = null;
|
|
4540
5528
|
this.onChange = null;
|
|
4541
5529
|
this._editingKey = null;
|
|
4542
5530
|
// ---- Actions ----
|
|
4543
|
-
this._handleBack = () => {
|
|
4544
|
-
if (this._editingKey !== null) {
|
|
4545
|
-
this._editingKey = null;
|
|
4546
|
-
} else {
|
|
4547
|
-
this.dispatchEvent(new CustomEvent("navigate-home", { bubbles: true }));
|
|
4548
|
-
}
|
|
4549
|
-
};
|
|
4550
5531
|
this._handleItemClick = (key) => {
|
|
4551
5532
|
this._editingKey = key;
|
|
4552
5533
|
};
|
|
4553
|
-
this._handleFieldChange = (item, field, value) => {
|
|
4554
|
-
this._emitFieldChange(item, field, value);
|
|
4555
|
-
};
|
|
4556
5534
|
this._handleDelete = (item, e) => {
|
|
4557
5535
|
e.stopPropagation();
|
|
4558
5536
|
if (!this.config || !this.onChange) return;
|
|
@@ -4579,59 +5557,17 @@ var FAQEditorLit = class extends LitElement9 {
|
|
|
4579
5557
|
if (this._editingKey === item.key) this._editingKey = null;
|
|
4580
5558
|
this.dispatchEvent(new CustomEvent("dirty-change", { detail: { dirty: true }, bubbles: true }));
|
|
4581
5559
|
};
|
|
4582
|
-
// ---- Render ----
|
|
4583
5560
|
this._renderEditMode = (item) => {
|
|
4584
|
-
const
|
|
4585
|
-
return
|
|
4586
|
-
<
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
<div class="se-mb-3">
|
|
4593
|
-
<label class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">Question</label>
|
|
4594
|
-
<input
|
|
4595
|
-
type="text"
|
|
4596
|
-
.value=${q.config.question}
|
|
4597
|
-
@input=${(e) => this._handleFieldChange(item, "question", e.target.value)}
|
|
4598
|
-
class="se-w-full se-p-2 se-rounded se-border se-border-border-primary se-bg-input-field-bg se-text-text-primary se-text-sm"
|
|
4599
|
-
/>
|
|
4600
|
-
</div>
|
|
4601
|
-
|
|
4602
|
-
<div class="se-mb-3">
|
|
4603
|
-
<label class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">Answer</label>
|
|
4604
|
-
<textarea
|
|
4605
|
-
.value=${getAnswerText(q.config.answer)}
|
|
4606
|
-
@input=${(e) => this._handleFieldChange(item, "answer", e.target.value)}
|
|
4607
|
-
rows="4"
|
|
4608
|
-
class="se-w-full se-p-2 se-rounded se-border se-border-border-primary se-bg-input-field-bg se-text-text-primary se-text-sm se-resize-none"
|
|
4609
|
-
></textarea>
|
|
4610
|
-
</div>
|
|
4611
|
-
|
|
4612
|
-
<div class="se-mb-3">
|
|
4613
|
-
<label class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">Category</label>
|
|
4614
|
-
<input
|
|
4615
|
-
type="text"
|
|
4616
|
-
.value=${q.config.category || ""}
|
|
4617
|
-
placeholder="e.g., Billing, Account"
|
|
4618
|
-
@input=${(e) => this._handleFieldChange(item, "category", e.target.value)}
|
|
4619
|
-
class="se-w-full se-p-2 se-rounded se-border se-border-border-primary se-bg-input-field-bg se-text-text-primary se-text-sm"
|
|
4620
|
-
/>
|
|
4621
|
-
</div>
|
|
4622
|
-
|
|
4623
|
-
${q.rationale ? html10`
|
|
4624
|
-
<div>
|
|
4625
|
-
<span class="se-text-[11px] se-font-semibold se-text-text-secondary se-mb-1 se-block">AI Rationale</span>
|
|
4626
|
-
<div class="se-p-2 se-rounded se-border se-border-dashed se-border-border-primary se-bg-card-bg se-text-text-secondary se-text-xs se-mb-2">
|
|
4627
|
-
${q.rationale.why}
|
|
4628
|
-
</div>
|
|
4629
|
-
</div>
|
|
4630
|
-
` : nothing5}
|
|
4631
|
-
</div>
|
|
5561
|
+
const { appConfig, onChange } = this._buildInnerProps(item);
|
|
5562
|
+
return html14`
|
|
5563
|
+
<syntro-faq-item-editor
|
|
5564
|
+
.itemId=${item.question.config.id}
|
|
5565
|
+
.appConfig=${appConfig}
|
|
5566
|
+
.onChange=${onChange}
|
|
5567
|
+
></syntro-faq-item-editor>
|
|
4632
5568
|
`;
|
|
4633
5569
|
};
|
|
4634
|
-
this._renderItemCard = (item) =>
|
|
5570
|
+
this._renderItemCard = (item) => html14`
|
|
4635
5571
|
<div
|
|
4636
5572
|
data-item-key=${item.key}
|
|
4637
5573
|
data-card-body
|
|
@@ -4644,32 +5580,32 @@ var FAQEditorLit = class extends LitElement9 {
|
|
|
4644
5580
|
deleteTestid: `delete-faq-${item.key}`,
|
|
4645
5581
|
deleteLabel: "Delete question"
|
|
4646
5582
|
})}
|
|
4647
|
-
${item.description ?
|
|
5583
|
+
${item.description ? html14`<div
|
|
4648
5584
|
data-testid=${`faq-description-${item.key}`}
|
|
4649
5585
|
class="se-text-[11px] se-text-text-secondary se-mt-1.5 se-line-clamp-2"
|
|
4650
|
-
>${item.description}</div>` :
|
|
4651
|
-
${item.triggerSummary ?
|
|
5586
|
+
>${item.description}</div>` : nothing9}
|
|
5587
|
+
${item.triggerSummary ? html14`<div
|
|
4652
5588
|
data-testid=${`faq-trigger-${item.key}`}
|
|
4653
5589
|
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"
|
|
4654
5590
|
>
|
|
4655
5591
|
<span>📍</span>
|
|
4656
5592
|
<span>When: ${item.triggerSummary}</span>
|
|
4657
|
-
</div>` :
|
|
4658
|
-
${item.validation && item.validation.length > 0 ?
|
|
5593
|
+
</div>` : nothing9}
|
|
5594
|
+
${item.validation && item.validation.length > 0 ? html14`<div
|
|
4659
5595
|
data-testid=${`faq-validation-${item.key}`}
|
|
4660
5596
|
class="se-mt-1.5 se-flex se-flex-col se-gap-0.5"
|
|
4661
5597
|
>
|
|
4662
5598
|
${item.validation.map(
|
|
4663
|
-
(line) =>
|
|
5599
|
+
(line) => html14`<div
|
|
4664
5600
|
class="se-text-[10px] se-text-text-tertiary se-flex se-items-start se-gap-1"
|
|
4665
5601
|
><span class="se-text-text-tertiary">✓</span><span>${line}</span></div>`
|
|
4666
5602
|
)}
|
|
4667
|
-
</div>` :
|
|
4668
|
-
${item.question.rationale ?
|
|
5603
|
+
</div>` : nothing9}
|
|
5604
|
+
${item.question.rationale ? html14`
|
|
4669
5605
|
<div class="se-text-[10px] se-text-text-tertiary se-mt-1">
|
|
4670
5606
|
WHY: ${item.question.rationale.why}
|
|
4671
5607
|
</div>
|
|
4672
|
-
` :
|
|
5608
|
+
` : nothing9}
|
|
4673
5609
|
</div>
|
|
4674
5610
|
`;
|
|
4675
5611
|
this._handleNavigateFromPill = (e) => {
|
|
@@ -4685,7 +5621,7 @@ var FAQEditorLit = class extends LitElement9 {
|
|
|
4685
5621
|
this._renderGroupHeader = (section, count) => {
|
|
4686
5622
|
const navRoute = section.routes[0];
|
|
4687
5623
|
const testidSuffix = section.tileId ?? String(section.groupIdx);
|
|
4688
|
-
return
|
|
5624
|
+
return html14`
|
|
4689
5625
|
<div
|
|
4690
5626
|
data-faq-group-header
|
|
4691
5627
|
data-faq-group-tile-id=${section.tileId ?? ""}
|
|
@@ -4697,13 +5633,13 @@ var FAQEditorLit = class extends LitElement9 {
|
|
|
4697
5633
|
>
|
|
4698
5634
|
${section.title}
|
|
4699
5635
|
</span>
|
|
4700
|
-
${navRoute ?
|
|
5636
|
+
${navRoute ? html14`<se-anchor-pill
|
|
4701
5637
|
.state=${"navigate"}
|
|
4702
5638
|
.route=${navRoute}
|
|
4703
5639
|
testid-prefix="goto-faq-group"
|
|
4704
5640
|
testid-key=${testidSuffix}
|
|
4705
5641
|
@se-anchor-navigate=${this._handleNavigateFromPill}
|
|
4706
|
-
></se-anchor-pill>` :
|
|
5642
|
+
></se-anchor-pill>` : nothing9}
|
|
4707
5643
|
</div>
|
|
4708
5644
|
<span class="se-text-text-tertiary se-text-[11px] se-font-normal">${count}</span>
|
|
4709
5645
|
</div>
|
|
@@ -4711,21 +5647,21 @@ var FAQEditorLit = class extends LitElement9 {
|
|
|
4711
5647
|
};
|
|
4712
5648
|
this._renderListMode = (sections, items) => {
|
|
4713
5649
|
if (items.length === 0) {
|
|
4714
|
-
return
|
|
5650
|
+
return html14`<div class="se-text-center se-py-8 se-px-4 se-text-text-secondary se-text-sm">
|
|
4715
5651
|
No FAQ questions configured.
|
|
4716
5652
|
</div>`;
|
|
4717
5653
|
}
|
|
4718
5654
|
if (sections.length === 1 && sections[0].groupIdx === -1) {
|
|
4719
|
-
return
|
|
5655
|
+
return html14`
|
|
4720
5656
|
<div class="se-text-[11px] se-font-semibold se-uppercase se-tracking-wider se-text-text-secondary se-mb-2 se-px-1">
|
|
4721
5657
|
FAQ <span class="se-text-text-tertiary se-font-normal">${items.length}</span>
|
|
4722
5658
|
</div>
|
|
4723
5659
|
${items.map(this._renderItemCard)}
|
|
4724
5660
|
`;
|
|
4725
5661
|
}
|
|
4726
|
-
return
|
|
5662
|
+
return html14`${sections.map((section) => {
|
|
4727
5663
|
const sectionItems = items.filter((it) => it.groupIdx === section.groupIdx);
|
|
4728
|
-
return
|
|
5664
|
+
return html14`
|
|
4729
5665
|
${this._renderGroupHeader(section, sectionItems.length)}
|
|
4730
5666
|
${sectionItems.map(this._renderItemCard)}
|
|
4731
5667
|
`;
|
|
@@ -4735,40 +5671,66 @@ var FAQEditorLit = class extends LitElement9 {
|
|
|
4735
5671
|
createRenderRoot() {
|
|
4736
5672
|
return this;
|
|
4737
5673
|
}
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
5674
|
+
// ---- Render ----
|
|
5675
|
+
/**
|
|
5676
|
+
* Build the FAQConfig slice and onChange handler to pass to <syntro-faq-item-editor>.
|
|
5677
|
+
*
|
|
5678
|
+
* For flat configs the full config is passed directly.
|
|
5679
|
+
* For grouped configs a synthetic FAQConfig is built from the item's group actions so the
|
|
5680
|
+
* inner element can find the item by ID. When onChange fires the patched flat actions are
|
|
5681
|
+
* spliced back into the correct group of the grouped config before bubbling to the panel's
|
|
5682
|
+
* own onChange.
|
|
5683
|
+
*/
|
|
5684
|
+
_buildInnerProps(item) {
|
|
5685
|
+
if (!this.config) {
|
|
5686
|
+
const noop = () => {
|
|
5687
|
+
};
|
|
5688
|
+
return {
|
|
5689
|
+
appConfig: { expandBehavior: "single", searchable: false, theme: "auto", actions: [] },
|
|
5690
|
+
onChange: noop
|
|
5691
|
+
};
|
|
5692
|
+
}
|
|
4745
5693
|
if (isGroupedFAQConfig(this.config)) {
|
|
4746
|
-
const
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
}
|
|
4753
|
-
const
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
5694
|
+
const group = this.config.groups[item.groupIdx];
|
|
5695
|
+
const appConfig = {
|
|
5696
|
+
expandBehavior: "single",
|
|
5697
|
+
searchable: false,
|
|
5698
|
+
theme: "auto",
|
|
5699
|
+
actions: group ? group.actions.filter(isOwnAction) : []
|
|
5700
|
+
};
|
|
5701
|
+
const onChange2 = (patchedFlat) => {
|
|
5702
|
+
if (!this.config || !isGroupedFAQConfig(this.config)) return;
|
|
5703
|
+
const groups = this.config.groups.map((g, gIdx) => {
|
|
5704
|
+
if (gIdx !== item.groupIdx) return g;
|
|
5705
|
+
const nonOwn = g.actions.filter((a) => !isOwnAction(a));
|
|
5706
|
+
return { ...g, actions: [...nonOwn, ...patchedFlat.actions] };
|
|
5707
|
+
});
|
|
5708
|
+
const updated = { ...this.config, groups };
|
|
5709
|
+
this.config = updated;
|
|
5710
|
+
this.onChange?.(updated);
|
|
5711
|
+
this.dispatchEvent(
|
|
5712
|
+
new CustomEvent("dirty-change", { detail: { dirty: true }, bubbles: true })
|
|
5713
|
+
);
|
|
5714
|
+
};
|
|
5715
|
+
return { appConfig, onChange: onChange2 };
|
|
4762
5716
|
}
|
|
4763
|
-
|
|
5717
|
+
const flat = this.config;
|
|
5718
|
+
const onChange = (next) => {
|
|
5719
|
+
this.config = next;
|
|
5720
|
+
this.onChange?.(next);
|
|
5721
|
+
this.dispatchEvent(
|
|
5722
|
+
new CustomEvent("dirty-change", { detail: { dirty: true }, bubbles: true })
|
|
5723
|
+
);
|
|
5724
|
+
};
|
|
5725
|
+
return { appConfig: flat, onChange };
|
|
4764
5726
|
}
|
|
4765
5727
|
render() {
|
|
4766
5728
|
if (!this.config) {
|
|
4767
|
-
return
|
|
5729
|
+
return html14`<div class="se-p-8 se-text-center se-text-text-secondary se-text-sm">Loading...</div>`;
|
|
4768
5730
|
}
|
|
4769
5731
|
const { sections, items } = flattenConfig(this.config);
|
|
4770
5732
|
const editItem = this._editingKey !== null ? items.find((it) => it.key === this._editingKey) : null;
|
|
4771
|
-
return
|
|
5733
|
+
return html14`
|
|
4772
5734
|
<div class="se-flex se-flex-col se-h-full">
|
|
4773
5735
|
<!-- Header (no Back button — panel provides that) -->
|
|
4774
5736
|
<div class="se-px-4 se-pt-3 se-pb-1">
|
|
@@ -4779,7 +5741,7 @@ var FAQEditorLit = class extends LitElement9 {
|
|
|
4779
5741
|
</div>
|
|
4780
5742
|
|
|
4781
5743
|
<div class="se-flex-1 se-overflow-auto se-p-4">
|
|
4782
|
-
${editItem ?
|
|
5744
|
+
${editItem ? html14`
|
|
4783
5745
|
<button type="button" @click=${() => {
|
|
4784
5746
|
this._editingKey = null;
|
|
4785
5747
|
}}
|
|
@@ -4798,8 +5760,37 @@ FAQEditorLit.properties = {
|
|
|
4798
5760
|
_editingKey: { state: true }
|
|
4799
5761
|
};
|
|
4800
5762
|
customElements.define("se-faq-editor", FAQEditorLit);
|
|
5763
|
+
function registerFaqEditorFactories(modalHost) {
|
|
5764
|
+
modalHost.registerEditorFactory("adaptive-faq:accordion", {
|
|
5765
|
+
item: ({ itemId, appConfig, onChange }) => {
|
|
5766
|
+
const el = document.createElement("syntro-faq-item-editor");
|
|
5767
|
+
el.itemId = itemId;
|
|
5768
|
+
el.appConfig = appConfig;
|
|
5769
|
+
el.onChange = onChange;
|
|
5770
|
+
return el;
|
|
5771
|
+
},
|
|
5772
|
+
container: ({ appConfig, onChange }) => {
|
|
5773
|
+
const meta = appConfig._tileMeta;
|
|
5774
|
+
const tileMeta = {
|
|
5775
|
+
title: meta?.title ?? "",
|
|
5776
|
+
subtitle: meta?.subtitle ?? "",
|
|
5777
|
+
icon: meta?.icon ?? ""
|
|
5778
|
+
};
|
|
5779
|
+
const el = document.createElement("syntro-tile-chrome-editor");
|
|
5780
|
+
el.tileMeta = tileMeta;
|
|
5781
|
+
el.onChange = (next) => {
|
|
5782
|
+
onChange({ ...appConfig, _tileMeta: next });
|
|
5783
|
+
};
|
|
5784
|
+
return el;
|
|
5785
|
+
}
|
|
5786
|
+
});
|
|
5787
|
+
}
|
|
4801
5788
|
export {
|
|
4802
|
-
|
|
5789
|
+
FAQAccordionEditableElement,
|
|
5790
|
+
FAQEditorLit,
|
|
5791
|
+
FAQItemEditorLit,
|
|
5792
|
+
FAQWidgetLitEditableMountable,
|
|
5793
|
+
registerFaqEditorFactories
|
|
4803
5794
|
};
|
|
4804
5795
|
/*! Bundled license information:
|
|
4805
5796
|
|