@wix/himalaya-cli 0.1407.0 → 0.1408.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/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/dev-server/src/builder.d.ts +1 -0
- package/dist/authoring-runtime/node_modules/@wix/himalaya/dist/_types/core/ts/src/schema.d.ts +4 -0
- package/dist/cli.mjs +41 -30
- package/dist/preview-assets.generated.bin +0 -0
- package/guides/component-reference.json +1 -1
- package/guides/component-reference.md +4 -0
- package/package.json +2 -2
- package/templates/beauty-salon-owner/dev/index.ts +49 -30
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/beauty-salon-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/community-club-owner/dev/index.ts +49 -30
- package/templates/community-club-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/community-club-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/community-club-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/events-meetups-owner/dev/index.ts +49 -30
- package/templates/events-meetups-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/events-meetups-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/events-meetups-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/gym-fitness-owner/dev/index.ts +49 -30
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/gym-fitness-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/nonprofit-cause-owner/dev/index.ts +49 -30
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/nonprofit-cause-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/owner-lite/dev/index.ts +49 -30
- package/templates/owner-lite/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/owner-lite/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/owner-lite/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/podcast-creator-owner/dev/index.ts +49 -30
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/podcast-creator-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/portfolio-creative-owner/dev/index.ts +49 -30
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/portfolio-creative-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/restaurant-owner/dev/index.ts +49 -30
- package/templates/restaurant-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/restaurant-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/restaurant-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/retail-store-owner/dev/index.ts +49 -30
- package/templates/retail-store-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/retail-store-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/retail-store-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
- package/templates/yoga-studio-owner/dev/index.ts +49 -30
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-chat.ts +8 -6
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-widget-model.ts +84 -1
- package/templates/yoga-studio-owner/tier5-src/_shared/aria-widget-view.ts +34 -13
|
@@ -57680,7 +57680,7 @@ const SCREENS = runtimeSetting({
|
|
|
57680
57680
|
"height": 44,
|
|
57681
57681
|
"shape": "rounded",
|
|
57682
57682
|
"contentMode": "fill",
|
|
57683
|
-
"contentDescription": "$item.
|
|
57683
|
+
"contentDescription": "$item.label"
|
|
57684
57684
|
}
|
|
57685
57685
|
},
|
|
57686
57686
|
"modifiers": {
|
|
@@ -57688,6 +57688,7 @@ const SCREENS = runtimeSetting({
|
|
|
57688
57688
|
}
|
|
57689
57689
|
},
|
|
57690
57690
|
"title": "$item.title",
|
|
57691
|
+
"markdown": true,
|
|
57691
57692
|
"subtitle": "$item.subtitle",
|
|
57692
57693
|
"trailing": {
|
|
57693
57694
|
"id": "himi_owner_lite_aria.widget.SINGLE_SELECT.pick_$item.id",
|
|
@@ -57952,7 +57953,7 @@ const SCREENS = runtimeSetting({
|
|
|
57952
57953
|
}
|
|
57953
57954
|
},
|
|
57954
57955
|
"modifiers": {
|
|
57955
|
-
"accessibilityLabel": "$item.
|
|
57956
|
+
"accessibilityLabel": "$item.label"
|
|
57956
57957
|
}
|
|
57957
57958
|
},
|
|
57958
57959
|
{
|
|
@@ -57966,7 +57967,7 @@ const SCREENS = runtimeSetting({
|
|
|
57966
57967
|
"height": 36,
|
|
57967
57968
|
"shape": "rounded",
|
|
57968
57969
|
"contentMode": "fill",
|
|
57969
|
-
"contentDescription": "$item.
|
|
57970
|
+
"contentDescription": "$item.label"
|
|
57970
57971
|
}
|
|
57971
57972
|
},
|
|
57972
57973
|
"modifiers": {
|
|
@@ -57989,7 +57990,8 @@ const SCREENS = runtimeSetting({
|
|
|
57989
57990
|
"props": {
|
|
57990
57991
|
"text": "$item.title",
|
|
57991
57992
|
"style": "body",
|
|
57992
|
-
"maxLines": 2
|
|
57993
|
+
"maxLines": 2,
|
|
57994
|
+
"markdown": true
|
|
57993
57995
|
}
|
|
57994
57996
|
}
|
|
57995
57997
|
},
|
|
@@ -58002,7 +58004,8 @@ const SCREENS = runtimeSetting({
|
|
|
58002
58004
|
"text": "$item.subtitle",
|
|
58003
58005
|
"style": "footnote",
|
|
58004
58006
|
"color": "textSecondary",
|
|
58005
|
-
"maxLines": 2
|
|
58007
|
+
"maxLines": 2,
|
|
58008
|
+
"markdown": true
|
|
58006
58009
|
}
|
|
58007
58010
|
},
|
|
58008
58011
|
"modifiers": {
|
|
@@ -58070,7 +58073,7 @@ const SCREENS = runtimeSetting({
|
|
|
58070
58073
|
"aspectRatio": 1,
|
|
58071
58074
|
"shape": "rounded",
|
|
58072
58075
|
"contentMode": "fill",
|
|
58073
|
-
"contentDescription": "$item.
|
|
58076
|
+
"contentDescription": "$item.label"
|
|
58074
58077
|
}
|
|
58075
58078
|
},
|
|
58076
58079
|
"modifiers": {
|
|
@@ -58102,7 +58105,7 @@ const SCREENS = runtimeSetting({
|
|
|
58102
58105
|
}
|
|
58103
58106
|
},
|
|
58104
58107
|
"modifiers": {
|
|
58105
|
-
"accessibilityLabel": "$item.
|
|
58108
|
+
"accessibilityLabel": "$item.label"
|
|
58106
58109
|
}
|
|
58107
58110
|
},
|
|
58108
58111
|
{
|
|
@@ -58121,7 +58124,8 @@ const SCREENS = runtimeSetting({
|
|
|
58121
58124
|
"props": {
|
|
58122
58125
|
"text": "$item.title",
|
|
58123
58126
|
"style": "body",
|
|
58124
|
-
"maxLines": 2
|
|
58127
|
+
"maxLines": 2,
|
|
58128
|
+
"markdown": true
|
|
58125
58129
|
}
|
|
58126
58130
|
}
|
|
58127
58131
|
},
|
|
@@ -58134,7 +58138,8 @@ const SCREENS = runtimeSetting({
|
|
|
58134
58138
|
"text": "$item.subtitle",
|
|
58135
58139
|
"style": "footnote",
|
|
58136
58140
|
"color": "textSecondary",
|
|
58137
|
-
"maxLines": 2
|
|
58141
|
+
"maxLines": 2,
|
|
58142
|
+
"markdown": true
|
|
58138
58143
|
}
|
|
58139
58144
|
},
|
|
58140
58145
|
"modifiers": {
|
|
@@ -58585,7 +58590,7 @@ const SCREENS = runtimeSetting({
|
|
|
58585
58590
|
}
|
|
58586
58591
|
},
|
|
58587
58592
|
"modifiers": {
|
|
58588
|
-
"accessibilityLabel": "$item.
|
|
58593
|
+
"accessibilityLabel": "$item.label"
|
|
58589
58594
|
}
|
|
58590
58595
|
},
|
|
58591
58596
|
{
|
|
@@ -58599,7 +58604,7 @@ const SCREENS = runtimeSetting({
|
|
|
58599
58604
|
"height": 36,
|
|
58600
58605
|
"shape": "rounded",
|
|
58601
58606
|
"contentMode": "fill",
|
|
58602
|
-
"contentDescription": "$item.
|
|
58607
|
+
"contentDescription": "$item.label"
|
|
58603
58608
|
}
|
|
58604
58609
|
},
|
|
58605
58610
|
"modifiers": {
|
|
@@ -58622,7 +58627,8 @@ const SCREENS = runtimeSetting({
|
|
|
58622
58627
|
"props": {
|
|
58623
58628
|
"text": "$item.title",
|
|
58624
58629
|
"style": "body",
|
|
58625
|
-
"maxLines": 2
|
|
58630
|
+
"maxLines": 2,
|
|
58631
|
+
"markdown": true
|
|
58626
58632
|
}
|
|
58627
58633
|
}
|
|
58628
58634
|
},
|
|
@@ -58635,7 +58641,8 @@ const SCREENS = runtimeSetting({
|
|
|
58635
58641
|
"text": "$item.subtitle",
|
|
58636
58642
|
"style": "footnote",
|
|
58637
58643
|
"color": "textSecondary",
|
|
58638
|
-
"maxLines": 2
|
|
58644
|
+
"maxLines": 2,
|
|
58645
|
+
"markdown": true
|
|
58639
58646
|
}
|
|
58640
58647
|
},
|
|
58641
58648
|
"modifiers": {
|
|
@@ -58874,7 +58881,8 @@ const SCREENS = runtimeSetting({
|
|
|
58874
58881
|
"props": {
|
|
58875
58882
|
"text": "$item.title",
|
|
58876
58883
|
"style": "bodyEmphasis",
|
|
58877
|
-
"maxLines": 2
|
|
58884
|
+
"maxLines": 2,
|
|
58885
|
+
"markdown": true
|
|
58878
58886
|
}
|
|
58879
58887
|
}
|
|
58880
58888
|
},
|
|
@@ -58886,7 +58894,8 @@ const SCREENS = runtimeSetting({
|
|
|
58886
58894
|
"props": {
|
|
58887
58895
|
"text": "$item.subtitle",
|
|
58888
58896
|
"style": "title3",
|
|
58889
|
-
"maxLines": 1
|
|
58897
|
+
"maxLines": 1,
|
|
58898
|
+
"markdown": true
|
|
58890
58899
|
}
|
|
58891
58900
|
},
|
|
58892
58901
|
"modifiers": {
|
|
@@ -58971,7 +58980,8 @@ const SCREENS = runtimeSetting({
|
|
|
58971
58980
|
"props": {
|
|
58972
58981
|
"text": "$item.text",
|
|
58973
58982
|
"style": "footnote",
|
|
58974
|
-
"maxLines": 8
|
|
58983
|
+
"maxLines": 8,
|
|
58984
|
+
"markdown": true
|
|
58975
58985
|
}
|
|
58976
58986
|
},
|
|
58977
58987
|
"modifiers": {
|
|
@@ -59416,7 +59426,7 @@ const SCREENS = runtimeSetting({
|
|
|
59416
59426
|
"fillWidth": true,
|
|
59417
59427
|
"aspectRatio": 1.5,
|
|
59418
59428
|
"contentMode": "fill",
|
|
59419
|
-
"contentDescription": "$item.
|
|
59429
|
+
"contentDescription": "$item.label"
|
|
59420
59430
|
}
|
|
59421
59431
|
},
|
|
59422
59432
|
"modifiers": {
|
|
@@ -59477,7 +59487,8 @@ const SCREENS = runtimeSetting({
|
|
|
59477
59487
|
"type": "Text",
|
|
59478
59488
|
"props": {
|
|
59479
59489
|
"text": "$item.title",
|
|
59480
|
-
"style": "bodyEmphasis"
|
|
59490
|
+
"style": "bodyEmphasis",
|
|
59491
|
+
"markdown": true
|
|
59481
59492
|
}
|
|
59482
59493
|
}
|
|
59483
59494
|
},
|
|
@@ -59489,7 +59500,8 @@ const SCREENS = runtimeSetting({
|
|
|
59489
59500
|
"props": {
|
|
59490
59501
|
"text": "$item.subtitle",
|
|
59491
59502
|
"style": "body",
|
|
59492
|
-
"color": "textSecondary"
|
|
59503
|
+
"color": "textSecondary",
|
|
59504
|
+
"markdown": true
|
|
59493
59505
|
}
|
|
59494
59506
|
},
|
|
59495
59507
|
"modifiers": {
|
|
@@ -59503,7 +59515,8 @@ const SCREENS = runtimeSetting({
|
|
|
59503
59515
|
"type": "Text",
|
|
59504
59516
|
"props": {
|
|
59505
59517
|
"text": "$item.text",
|
|
59506
|
-
"style": "body"
|
|
59518
|
+
"style": "body",
|
|
59519
|
+
"markdown": true
|
|
59507
59520
|
}
|
|
59508
59521
|
},
|
|
59509
59522
|
"modifiers": {
|
|
@@ -59517,7 +59530,8 @@ const SCREENS = runtimeSetting({
|
|
|
59517
59530
|
"type": "Text",
|
|
59518
59531
|
"props": {
|
|
59519
59532
|
"text": "$item.listText",
|
|
59520
|
-
"style": "body"
|
|
59533
|
+
"style": "body",
|
|
59534
|
+
"markdown": true
|
|
59521
59535
|
}
|
|
59522
59536
|
},
|
|
59523
59537
|
"modifiers": {
|
|
@@ -59725,7 +59739,7 @@ const SCREENS = runtimeSetting({
|
|
|
59725
59739
|
"height": 36,
|
|
59726
59740
|
"shape": "rounded",
|
|
59727
59741
|
"contentMode": "fill",
|
|
59728
|
-
"contentDescription": "$item.
|
|
59742
|
+
"contentDescription": "$item.label"
|
|
59729
59743
|
}
|
|
59730
59744
|
},
|
|
59731
59745
|
"modifiers": {
|
|
@@ -59733,6 +59747,7 @@ const SCREENS = runtimeSetting({
|
|
|
59733
59747
|
}
|
|
59734
59748
|
},
|
|
59735
59749
|
"title": "$item.title",
|
|
59750
|
+
"markdown": true,
|
|
59736
59751
|
"subtitle": "$item.subtitle",
|
|
59737
59752
|
"onTap": {
|
|
59738
59753
|
"actionId": "tier5.himiOwnerLiteAria.widgetPick",
|
|
@@ -59976,7 +59991,7 @@ const SCREENS = runtimeSetting({
|
|
|
59976
59991
|
}
|
|
59977
59992
|
},
|
|
59978
59993
|
"modifiers": {
|
|
59979
|
-
"accessibilityLabel": "$item.
|
|
59994
|
+
"accessibilityLabel": "$item.label"
|
|
59980
59995
|
}
|
|
59981
59996
|
},
|
|
59982
59997
|
{
|
|
@@ -59990,7 +60005,7 @@ const SCREENS = runtimeSetting({
|
|
|
59990
60005
|
"height": 36,
|
|
59991
60006
|
"shape": "rounded",
|
|
59992
60007
|
"contentMode": "fill",
|
|
59993
|
-
"contentDescription": "$item.
|
|
60008
|
+
"contentDescription": "$item.label"
|
|
59994
60009
|
}
|
|
59995
60010
|
},
|
|
59996
60011
|
"modifiers": {
|
|
@@ -60334,7 +60349,7 @@ const SCREENS = runtimeSetting({
|
|
|
60334
60349
|
}
|
|
60335
60350
|
},
|
|
60336
60351
|
"modifiers": {
|
|
60337
|
-
"accessibilityLabel": "$item.
|
|
60352
|
+
"accessibilityLabel": "$item.label"
|
|
60338
60353
|
}
|
|
60339
60354
|
},
|
|
60340
60355
|
{
|
|
@@ -60353,7 +60368,8 @@ const SCREENS = runtimeSetting({
|
|
|
60353
60368
|
"props": {
|
|
60354
60369
|
"text": "$item.title",
|
|
60355
60370
|
"style": "body",
|
|
60356
|
-
"maxLines": 2
|
|
60371
|
+
"maxLines": 2,
|
|
60372
|
+
"markdown": true
|
|
60357
60373
|
}
|
|
60358
60374
|
}
|
|
60359
60375
|
},
|
|
@@ -60366,7 +60382,8 @@ const SCREENS = runtimeSetting({
|
|
|
60366
60382
|
"text": "$item.subtitle",
|
|
60367
60383
|
"style": "footnote",
|
|
60368
60384
|
"color": "textSecondary",
|
|
60369
|
-
"maxLines": 2
|
|
60385
|
+
"maxLines": 2,
|
|
60386
|
+
"markdown": true
|
|
60370
60387
|
}
|
|
60371
60388
|
},
|
|
60372
60389
|
"modifiers": {
|
|
@@ -60430,7 +60447,7 @@ const SCREENS = runtimeSetting({
|
|
|
60430
60447
|
}
|
|
60431
60448
|
},
|
|
60432
60449
|
"modifiers": {
|
|
60433
|
-
"accessibilityLabel": "$item.
|
|
60450
|
+
"accessibilityLabel": "$item.label"
|
|
60434
60451
|
}
|
|
60435
60452
|
},
|
|
60436
60453
|
{
|
|
@@ -60449,7 +60466,8 @@ const SCREENS = runtimeSetting({
|
|
|
60449
60466
|
"props": {
|
|
60450
60467
|
"text": "$item.title",
|
|
60451
60468
|
"style": "body",
|
|
60452
|
-
"maxLines": 2
|
|
60469
|
+
"maxLines": 2,
|
|
60470
|
+
"markdown": true
|
|
60453
60471
|
}
|
|
60454
60472
|
}
|
|
60455
60473
|
},
|
|
@@ -60462,7 +60480,8 @@ const SCREENS = runtimeSetting({
|
|
|
60462
60480
|
"text": "$item.subtitle",
|
|
60463
60481
|
"style": "footnote",
|
|
60464
60482
|
"color": "textSecondary",
|
|
60465
|
-
"maxLines": 2
|
|
60483
|
+
"maxLines": 2,
|
|
60484
|
+
"markdown": true
|
|
60466
60485
|
}
|
|
60467
60486
|
},
|
|
60468
60487
|
"modifiers": {
|
|
@@ -77,7 +77,7 @@ import type { FileHandle } from "@himalaya/sdk-types";
|
|
|
77
77
|
import { createAriaUploadQueue } from "./aria-upload-queue.js";
|
|
78
78
|
import { runClientToolExchange, type AriaClientTools, type ConsentMemory } from "./aria-client-tools.js";
|
|
79
79
|
import { proseOfParts, scanEnvelopes, stripHidden } from "./aria-widgets.js";
|
|
80
|
-
import { isWebUrl, stripMarkdown } from "./aria-widget-model.js";
|
|
80
|
+
import { drawnText, isWebUrl, stripMarkdown } from "./aria-widget-model.js";
|
|
81
81
|
import {
|
|
82
82
|
DEFAULT_QUESTIONNAIRE_COPY,
|
|
83
83
|
NO_WIDGET,
|
|
@@ -86,6 +86,7 @@ import {
|
|
|
86
86
|
questionnaireAnswers,
|
|
87
87
|
questionnaireSynced,
|
|
88
88
|
sameQuestionnaire,
|
|
89
|
+
withLabels,
|
|
89
90
|
type QuestionnaireCopy,
|
|
90
91
|
type SubtreeSlot,
|
|
91
92
|
type WidgetOptionRow,
|
|
@@ -2573,7 +2574,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
2573
2574
|
const withWidgetQuery = (w: WidgetView, query: string): WidgetView => {
|
|
2574
2575
|
const needle = query.toLowerCase();
|
|
2575
2576
|
const suggestions = !needle ? w.options : w.options.filter((option) =>
|
|
2576
|
-
|
|
2577
|
+
[option.title, option.subtitle, option.text].map(drawnText).join(" ").toLowerCase().includes(needle));
|
|
2577
2578
|
return { ...w, query, suggestions, suggestionsEmpty: suggestions.length === 0,
|
|
2578
2579
|
noMatches: !!needle && suggestions.length === 0 };
|
|
2579
2580
|
};
|
|
@@ -2693,7 +2694,7 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
2693
2694
|
options = items.map((item, i) => {
|
|
2694
2695
|
const pictureUrl = isWixMediaHost(hostOf(item.imageUrl)) ? item.imageUrl : "";
|
|
2695
2696
|
return {
|
|
2696
|
-
id: `o${i}`, value: item.id, title: item.title, subtitle: item.subtitle,
|
|
2697
|
+
id: `o${i}`, value: item.id, title: item.title, label: item.title, subtitle: item.subtitle,
|
|
2697
2698
|
subtitleHidden: !item.subtitle, text: "", textHidden: true, badge: "", badgeHidden: true,
|
|
2698
2699
|
pictureUrl, pictureHidden: !pictureUrl, buttonLabel: "", buttonHidden: true,
|
|
2699
2700
|
listText: "", benefits: [], listHidden: true, selected: false, respondText: "",
|
|
@@ -3599,7 +3600,8 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
3599
3600
|
// Transcript scroll — a conversation rehydrated with no send token (state persisted
|
|
3600
3601
|
// before tokens existed) still opens at its latest turn.
|
|
3601
3602
|
const opened = s.scrollSend || isGreetingOnly(messages) ? {} : openedAtLatest(s, messages);
|
|
3602
|
-
const reused: AriaChatState = { ...s, status: "ready", messages, prompts: promptsFor(messages, chipsOf(s)), ...opened
|
|
3603
|
+
const reused: AriaChatState = { ...s, status: "ready", messages, prompts: promptsFor(messages, chipsOf(s)), ...opened,
|
|
3604
|
+
...(s.widget ? { widget: withLabels(s.widget) } : {}) };
|
|
3603
3605
|
// A persisted state can be waiting on a fetch that died with the previous
|
|
3604
3606
|
// process; nothing would ever settle it, so ask again. And one minted by a
|
|
3605
3607
|
// bundle from before the suggestions existed never asked at all — the
|
|
@@ -4081,8 +4083,8 @@ export function createAriaChat(o: AriaChatOptions): AriaChatCore {
|
|
|
4081
4083
|
: questionnaire
|
|
4082
4084
|
? [questionnaireAnswers(w)].filter(Boolean)
|
|
4083
4085
|
: option && !option.selected
|
|
4084
|
-
? [option.title || option.value]
|
|
4085
|
-
: w.options.filter((o) => o.selected).map((o) => o.title || o.value);
|
|
4086
|
+
? [option.label || option.title || option.value]
|
|
4087
|
+
: w.options.filter((o) => o.selected).map((o) => o.label || o.title || o.value);
|
|
4086
4088
|
const content = substituteSelection(template, selected).trim();
|
|
4087
4089
|
if (!content) return s;
|
|
4088
4090
|
if (duplicate(s, content)) return s;
|
|
@@ -210,6 +210,88 @@ export function stripMarkdown(src: string): string {
|
|
|
210
210
|
return t.trim();
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
/** A literal `*` in prose drawn with `markdown: true`. Web and Android pair any two
|
|
214
|
+
* asterisks (`2*4 *Pine*` would italicise `4 `) and neither honours a backslash
|
|
215
|
+
* escape, so a star that is not part of emphasis is drawn as U+2217, which looks
|
|
216
|
+
* the same and parses as nothing. `drawnText` maps it back. The trailing word
|
|
217
|
+
* joiner (invisible) is what tells it apart from a U+2217 the prose already had:
|
|
218
|
+
* `emphasisMarkdown` drops a joiner that follows one in its input, so only a
|
|
219
|
+
* sentinel carries it. */
|
|
220
|
+
const LITERAL_STAR = "\u2217\u2060";
|
|
221
|
+
/** An underscore inside a code span, parked until emphasis has been read. */
|
|
222
|
+
const CODE_UNDERSCORE = "\u0005";
|
|
223
|
+
|
|
224
|
+
/** `stripMarkdown`, keeping inline emphasis.
|
|
225
|
+
*
|
|
226
|
+
* Option prose is drawn by `Text(markdown: true)` / `ListItem(markdown: true)`,
|
|
227
|
+
* so bold and italic can survive — everything else is stripped as `stripMarkdown`
|
|
228
|
+
* strips it. Emphasis is re-emitted as `**x**` / `*x*` only: web's parser has no
|
|
229
|
+
* underscore syntax and Android's needs word boundaries, so one spelling is the
|
|
230
|
+
* only one every renderer agrees on. Nested emphasis keeps its outer run only,
|
|
231
|
+
* because neither of those parsers pairs `***x***`.
|
|
232
|
+
*
|
|
233
|
+
* Nothing a renderer would turn into a link survives: links and images are
|
|
234
|
+
* unwrapped until none is left (a nested `[[a](x)](tel:…)` would otherwise
|
|
235
|
+
* rebuild one) and `<scheme:…>` autolinks lose their brackets. Every asterisk
|
|
236
|
+
* left over is a `LITERAL_STAR`, so no marker the renderers could mis-pair is
|
|
237
|
+
* ever emitted. `drawnText` of the result is the text the row shows. */
|
|
238
|
+
export function emphasisMarkdown(src: string): string {
|
|
239
|
+
if (!stripMarkdown(src)) return "";
|
|
240
|
+
const BOLD_OPEN = "\u0001", BOLD_CLOSE = "\u0002", EM_OPEN = "\u0003", EM_CLOSE = "\u0004";
|
|
241
|
+
// Inside a run, a paired nested marker is dropped (the outer run wins) and a lone star
|
|
242
|
+
// is content — it survives as a literal one. Double before single, or the inner
|
|
243
|
+
// `*x*` of `_**x**_` is read as the italic and its outer stars are left over.
|
|
244
|
+
const flat = (inner: string) => inner.replace(/[\u0001-\u0004]/g, "")
|
|
245
|
+
.replace(/\*\*([^*\n]+)\*\*/g, "$1").replace(/\*([^*\n]+)\*/g, "$1");
|
|
246
|
+
const bold = (inner: string) => `${BOLD_OPEN}${flat(inner)}${BOLD_CLOSE}`;
|
|
247
|
+
const em = (inner: string) => `${EM_OPEN}${flat(inner)}${EM_CLOSE}`;
|
|
248
|
+
let t = src.replace(/[\u0001-\u0005]/g, "").replace(/\u2217\u2060/g, "\u2217");
|
|
249
|
+
t = t.replace(/```[a-zA-Z0-9]*\n?/g, "").replace(/```/g, "");
|
|
250
|
+
// A code span is never read as emphasis: its paired markers are dropped, as
|
|
251
|
+
// `stripMarkdown` drops them, and whatever is left is parked so no prose marker
|
|
252
|
+
// can pair with it.
|
|
253
|
+
t = t.replace(/`([^`]+)`/g, (_, x: string) => x
|
|
254
|
+
.replace(/\*\*([^*]+)\*\*/g, "$1").replace(/\*([^*]+)\*/g, "$1")
|
|
255
|
+
.replace(/__([^_]+)__/g, "$1").replace(/_([^_]+)_/g, "$1")
|
|
256
|
+
.replace(/\*/g, LITERAL_STAR).replace(/_/g, CODE_UNDERSCORE));
|
|
257
|
+
for (let prev = ""; prev !== t;) {
|
|
258
|
+
prev = t;
|
|
259
|
+
t = t.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/\[([^\]]+)\]\([^)]*\)/g, "$1");
|
|
260
|
+
}
|
|
261
|
+
t = t.replace(/<([a-zA-Z][a-zA-Z0-9+.-]*:[^>\s]*)>/g, "$1");
|
|
262
|
+
// Line-level markup first, so a bullet's or a rule's `*` is gone before emphasis is read.
|
|
263
|
+
t = t.replace(/^#{1,6}\s+/gm, "");
|
|
264
|
+
t = t.replace(/^>\s?/gm, "");
|
|
265
|
+
t = t.replace(/^\s*([-*_])\1{2,}\s*$/gm, "");
|
|
266
|
+
t = t.replace(/^\s*[-*+]\s+/gm, "• ");
|
|
267
|
+
// Emphasis, strictly delimited (no space just inside a marker), parked behind control
|
|
268
|
+
// characters. Bold may contain single stars — an inner italic — which it drops.
|
|
269
|
+
// Underscores first, so an asterisk run around them absorbs them. Only at word
|
|
270
|
+
// boundaries, as CommonMark reads them: an identifier like `snake_case_name` is
|
|
271
|
+
// not italic.
|
|
272
|
+
// An underscore between two word characters is content, so `_foo_bar_` is one run.
|
|
273
|
+
t = t.replace(/(^|[^\w])__(?=\S)((?:[^_\n]|(?<=\w)_(?=\w))*?[^\s_])__(?!\w)/g, (_, pre, x) => pre + bold(x));
|
|
274
|
+
t = t.replace(/(^|[^\w])_(?=\S)((?:[^_\n]|(?<=\w)_(?=\w))*?[^\s_])_(?!\w)/g, (_, pre, x) => pre + em(x));
|
|
275
|
+
t = t.replace(/\*\*\*(?=\S)([^*\n]*?\S)\*\*\*/g, (_, x) => bold(x));
|
|
276
|
+
t = t.replace(/\*\*(?=[^\s*])((?:[^*\n]|\*(?!\*))*?[^\s*])\*\*/g, (_, x) => bold(x));
|
|
277
|
+
t = t.replace(/(^|[^\w*])\*(?=[^\s*])([^*\n]*?[^\s*])\*(?![\w*])/g, (_, pre, x) => pre + em(x));
|
|
278
|
+
t = t.replace(/\n{3,}/g, "\n\n");
|
|
279
|
+
t = t.replace(/\*/g, LITERAL_STAR).replace(new RegExp(CODE_UNDERSCORE, "g"), "_");
|
|
280
|
+
t = t.replace(/\u0001([^\u0002]*)\u0002/g, "**$1**").replace(/\u0003([^\u0004]*)\u0004/g, "*$1*");
|
|
281
|
+
// (A literal star inside a run was converted with the rest, before the run's own
|
|
282
|
+
// markers were written back.)
|
|
283
|
+
return t.trim();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/** What a row drawn with `markdown: true` shows for `emphasisMarkdown` output: the
|
|
287
|
+
* text with its `**x**` / `*x*` markers removed and literal stars restored. The
|
|
288
|
+
* accessibility name and the search haystack use this, so they say exactly what
|
|
289
|
+
* is on screen. */
|
|
290
|
+
export function drawnText(s: string): string {
|
|
291
|
+
return (s || "").replace(/\*\*([^*\n]+)\*\*/g, "$1").replace(/\*([^*\n]+)\*/g, "$1")
|
|
292
|
+
.replace(new RegExp(LITERAL_STAR, "g"), "*");
|
|
293
|
+
}
|
|
294
|
+
|
|
213
295
|
/** A display string, whether the wire wrote it bare or wrapped.
|
|
214
296
|
*
|
|
215
297
|
* QUESTIONNAIRE writes every label as `{ text: "…" }` — question titles,
|
|
@@ -323,7 +405,8 @@ export function optionsOf(o: Record<string, unknown> | null): WidgetOption[] {
|
|
|
323
405
|
const color = stringAt(spec, "color");
|
|
324
406
|
const hex = /^#[0-9a-f]{6}$/i.test(color);
|
|
325
407
|
const tint = hex ? "accentPrimary" : !name || name === "Confirm" ? "success" : "textPrimary";
|
|
326
|
-
|
|
408
|
+
// Drawn with `markdown: true`, like the option prose above it.
|
|
409
|
+
return { text: emphasisMarkdown(textOf(entry)),
|
|
327
410
|
icon: name === "Gift" ? "gift" : name === "Send" ? "paper_plane" : "check",
|
|
328
411
|
color: tint, colorHex: hex ? color : "",
|
|
329
412
|
successHidden: tint !== "success", plainHidden: tint !== "textPrimary", customHidden: tint !== "accentPrimary" };
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
// the transcript bubbles already use for their three link slots.
|
|
14
14
|
|
|
15
15
|
import type { NormalizedWidget, WidgetBenefit, WidgetKind, WidgetOption } from "./aria-widget-model.js";
|
|
16
|
-
import { SELECTED_TOKEN, VALUES_TOKEN, isWebUrl, stripMarkdown } from "./aria-widget-model.js";
|
|
16
|
+
import { SELECTED_TOKEN, VALUES_TOKEN, drawnText, emphasisMarkdown, isWebUrl, stripMarkdown } from "./aria-widget-model.js";
|
|
17
17
|
import { oauthView } from "./aria-widget-oauth.js";
|
|
18
18
|
import { composeGenericCard } from "./aria-generic-widget.js";
|
|
19
19
|
import { formatNumber } from "./engine-intl.js";
|
|
@@ -81,7 +81,11 @@ export interface WidgetRow {
|
|
|
81
81
|
export interface WidgetOptionRow {
|
|
82
82
|
id: string;
|
|
83
83
|
value: string;
|
|
84
|
+
/** Drawn prose: inline emphasis kept (`**x**` / `*x*`), parsed by `markdown: true`. */
|
|
84
85
|
title: string;
|
|
86
|
+
/** `title` stripped to plain text — the accessibility name, the search haystack,
|
|
87
|
+
* and anything echoed back as text. */
|
|
88
|
+
label: string;
|
|
85
89
|
subtitle: string;
|
|
86
90
|
subtitleHidden: boolean;
|
|
87
91
|
text: string;
|
|
@@ -400,7 +404,7 @@ export const DEFAULT_QUESTIONNAIRE_COPY: QuestionnaireCopy = {
|
|
|
400
404
|
/** A question's answer as the owner would say it: the chosen choices' titles,
|
|
401
405
|
* then anything typed. Empty when unanswered. */
|
|
402
406
|
function answerOf(q: WidgetQuestion): string {
|
|
403
|
-
const parts = q.choices.filter((c) => c.selected).map((c) => c.title || c.value);
|
|
407
|
+
const parts = q.choices.filter((c) => c.selected).map((c) => c.label || c.title || c.value);
|
|
404
408
|
const typed = q.freeText.trim();
|
|
405
409
|
if (typed) parts.push(typed);
|
|
406
410
|
return parts.join(", ");
|
|
@@ -648,23 +652,26 @@ function optionRow(
|
|
|
648
652
|
// raw `text` is still exported below for anything that wants both.
|
|
649
653
|
// "Has a title" is judged on the STRIPPED title: a title of pure markup (`***`) falls back
|
|
650
654
|
// to the option's other prose exactly as a missing one does.
|
|
651
|
-
const
|
|
652
|
-
const
|
|
653
|
-
const
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
//
|
|
658
|
-
//
|
|
659
|
-
//
|
|
660
|
-
const
|
|
661
|
-
const
|
|
655
|
+
const hasTitle = !!stripMarkdown(o.title);
|
|
656
|
+
const titleSrc = hasTitle ? o.title : (o.text || o.subtitle);
|
|
657
|
+
const subtitleSrc = hasTitle ? (o.subtitle || o.text) : (o.text && o.subtitle ? o.subtitle : "");
|
|
658
|
+
// The drawn prose keeps its inline emphasis (`**three**` is bold on
|
|
659
|
+
// every renderer, as in the native reference); the descriptor parses it with
|
|
660
|
+
// `markdown: true`. Every `*Hidden` flag and the accessibility `label` follow
|
|
661
|
+
// the STRIPPED value: prose that is only markup (`---`, `***`, an image with
|
|
662
|
+
// empty alt) strips to "" and must not paint an empty node, and a screen
|
|
663
|
+
// reader must not read `**`.
|
|
664
|
+
const rowTitle = emphasisMarkdown(titleSrc);
|
|
665
|
+
const rowSubtitle = emphasisMarkdown(subtitleSrc);
|
|
666
|
+
const text = emphasisMarkdown(o.text);
|
|
667
|
+
const listText = emphasisMarkdown(o.listText);
|
|
662
668
|
const benefits = (o.benefits ?? []).filter((b) => b.text);
|
|
663
669
|
const badge = stripMarkdown(o.badge || "");
|
|
664
670
|
return {
|
|
665
671
|
id: `o${i}`,
|
|
666
672
|
value: o.value,
|
|
667
673
|
title: rowTitle,
|
|
674
|
+
label: drawnText(rowTitle),
|
|
668
675
|
subtitle: rowSubtitle, subtitleHidden: !rowSubtitle,
|
|
669
676
|
text, textHidden: !text,
|
|
670
677
|
pictureUrl, pictureHidden: !pictureUrl,
|
|
@@ -693,6 +700,20 @@ function isDisclosedSame(disclose: Disclose, url: string): boolean {
|
|
|
693
700
|
return disclose({ label: probe, url }) === probe;
|
|
694
701
|
}
|
|
695
702
|
|
|
703
|
+
/** A widget persisted by a bundle that predates `WidgetOptionRow.label` — rows carry
|
|
704
|
+
* plain titles and no label. Rehydrating one as saved would leave every row's
|
|
705
|
+
* accessibility name empty, so its label is backfilled from the title. */
|
|
706
|
+
export function withLabels(w: WidgetView): WidgetView {
|
|
707
|
+
const fill = (rows: WidgetOptionRow[] | undefined) =>
|
|
708
|
+
rows?.map((o) => (typeof o.label === "string" ? o : { ...o, label: drawnText(o.title) }));
|
|
709
|
+
return {
|
|
710
|
+
...w,
|
|
711
|
+
options: fill(w.options) ?? w.options,
|
|
712
|
+
suggestions: fill(w.suggestions) ?? w.suggestions,
|
|
713
|
+
questions: w.questions?.map((q) => ({ ...q, choices: fill(q.choices) ?? q.choices })) ?? w.questions,
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
|
|
696
717
|
/** Re-derive an ASYNC_TOOL widget for a new job state.
|
|
697
718
|
*
|
|
698
719
|
* Separate from `viewOf` because it runs on a LIVE widget rather than a fresh
|