@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
|
@@ -57312,7 +57312,7 @@ const SCREENS = runtimeSetting({
|
|
|
57312
57312
|
"height": 44,
|
|
57313
57313
|
"shape": "rounded",
|
|
57314
57314
|
"contentMode": "fill",
|
|
57315
|
-
"contentDescription": "$item.
|
|
57315
|
+
"contentDescription": "$item.label"
|
|
57316
57316
|
}
|
|
57317
57317
|
},
|
|
57318
57318
|
"modifiers": {
|
|
@@ -57320,6 +57320,7 @@ const SCREENS = runtimeSetting({
|
|
|
57320
57320
|
}
|
|
57321
57321
|
},
|
|
57322
57322
|
"title": "$item.title",
|
|
57323
|
+
"markdown": true,
|
|
57323
57324
|
"subtitle": "$item.subtitle",
|
|
57324
57325
|
"trailing": {
|
|
57325
57326
|
"id": "himi_owner_lite_aria.widget.SINGLE_SELECT.pick_$item.id",
|
|
@@ -57584,7 +57585,7 @@ const SCREENS = runtimeSetting({
|
|
|
57584
57585
|
}
|
|
57585
57586
|
},
|
|
57586
57587
|
"modifiers": {
|
|
57587
|
-
"accessibilityLabel": "$item.
|
|
57588
|
+
"accessibilityLabel": "$item.label"
|
|
57588
57589
|
}
|
|
57589
57590
|
},
|
|
57590
57591
|
{
|
|
@@ -57598,7 +57599,7 @@ const SCREENS = runtimeSetting({
|
|
|
57598
57599
|
"height": 36,
|
|
57599
57600
|
"shape": "rounded",
|
|
57600
57601
|
"contentMode": "fill",
|
|
57601
|
-
"contentDescription": "$item.
|
|
57602
|
+
"contentDescription": "$item.label"
|
|
57602
57603
|
}
|
|
57603
57604
|
},
|
|
57604
57605
|
"modifiers": {
|
|
@@ -57621,7 +57622,8 @@ const SCREENS = runtimeSetting({
|
|
|
57621
57622
|
"props": {
|
|
57622
57623
|
"text": "$item.title",
|
|
57623
57624
|
"style": "body",
|
|
57624
|
-
"maxLines": 2
|
|
57625
|
+
"maxLines": 2,
|
|
57626
|
+
"markdown": true
|
|
57625
57627
|
}
|
|
57626
57628
|
}
|
|
57627
57629
|
},
|
|
@@ -57634,7 +57636,8 @@ const SCREENS = runtimeSetting({
|
|
|
57634
57636
|
"text": "$item.subtitle",
|
|
57635
57637
|
"style": "footnote",
|
|
57636
57638
|
"color": "textSecondary",
|
|
57637
|
-
"maxLines": 2
|
|
57639
|
+
"maxLines": 2,
|
|
57640
|
+
"markdown": true
|
|
57638
57641
|
}
|
|
57639
57642
|
},
|
|
57640
57643
|
"modifiers": {
|
|
@@ -57702,7 +57705,7 @@ const SCREENS = runtimeSetting({
|
|
|
57702
57705
|
"aspectRatio": 1,
|
|
57703
57706
|
"shape": "rounded",
|
|
57704
57707
|
"contentMode": "fill",
|
|
57705
|
-
"contentDescription": "$item.
|
|
57708
|
+
"contentDescription": "$item.label"
|
|
57706
57709
|
}
|
|
57707
57710
|
},
|
|
57708
57711
|
"modifiers": {
|
|
@@ -57734,7 +57737,7 @@ const SCREENS = runtimeSetting({
|
|
|
57734
57737
|
}
|
|
57735
57738
|
},
|
|
57736
57739
|
"modifiers": {
|
|
57737
|
-
"accessibilityLabel": "$item.
|
|
57740
|
+
"accessibilityLabel": "$item.label"
|
|
57738
57741
|
}
|
|
57739
57742
|
},
|
|
57740
57743
|
{
|
|
@@ -57753,7 +57756,8 @@ const SCREENS = runtimeSetting({
|
|
|
57753
57756
|
"props": {
|
|
57754
57757
|
"text": "$item.title",
|
|
57755
57758
|
"style": "body",
|
|
57756
|
-
"maxLines": 2
|
|
57759
|
+
"maxLines": 2,
|
|
57760
|
+
"markdown": true
|
|
57757
57761
|
}
|
|
57758
57762
|
}
|
|
57759
57763
|
},
|
|
@@ -57766,7 +57770,8 @@ const SCREENS = runtimeSetting({
|
|
|
57766
57770
|
"text": "$item.subtitle",
|
|
57767
57771
|
"style": "footnote",
|
|
57768
57772
|
"color": "textSecondary",
|
|
57769
|
-
"maxLines": 2
|
|
57773
|
+
"maxLines": 2,
|
|
57774
|
+
"markdown": true
|
|
57770
57775
|
}
|
|
57771
57776
|
},
|
|
57772
57777
|
"modifiers": {
|
|
@@ -58217,7 +58222,7 @@ const SCREENS = runtimeSetting({
|
|
|
58217
58222
|
}
|
|
58218
58223
|
},
|
|
58219
58224
|
"modifiers": {
|
|
58220
|
-
"accessibilityLabel": "$item.
|
|
58225
|
+
"accessibilityLabel": "$item.label"
|
|
58221
58226
|
}
|
|
58222
58227
|
},
|
|
58223
58228
|
{
|
|
@@ -58231,7 +58236,7 @@ const SCREENS = runtimeSetting({
|
|
|
58231
58236
|
"height": 36,
|
|
58232
58237
|
"shape": "rounded",
|
|
58233
58238
|
"contentMode": "fill",
|
|
58234
|
-
"contentDescription": "$item.
|
|
58239
|
+
"contentDescription": "$item.label"
|
|
58235
58240
|
}
|
|
58236
58241
|
},
|
|
58237
58242
|
"modifiers": {
|
|
@@ -58254,7 +58259,8 @@ const SCREENS = runtimeSetting({
|
|
|
58254
58259
|
"props": {
|
|
58255
58260
|
"text": "$item.title",
|
|
58256
58261
|
"style": "body",
|
|
58257
|
-
"maxLines": 2
|
|
58262
|
+
"maxLines": 2,
|
|
58263
|
+
"markdown": true
|
|
58258
58264
|
}
|
|
58259
58265
|
}
|
|
58260
58266
|
},
|
|
@@ -58267,7 +58273,8 @@ const SCREENS = runtimeSetting({
|
|
|
58267
58273
|
"text": "$item.subtitle",
|
|
58268
58274
|
"style": "footnote",
|
|
58269
58275
|
"color": "textSecondary",
|
|
58270
|
-
"maxLines": 2
|
|
58276
|
+
"maxLines": 2,
|
|
58277
|
+
"markdown": true
|
|
58271
58278
|
}
|
|
58272
58279
|
},
|
|
58273
58280
|
"modifiers": {
|
|
@@ -58506,7 +58513,8 @@ const SCREENS = runtimeSetting({
|
|
|
58506
58513
|
"props": {
|
|
58507
58514
|
"text": "$item.title",
|
|
58508
58515
|
"style": "bodyEmphasis",
|
|
58509
|
-
"maxLines": 2
|
|
58516
|
+
"maxLines": 2,
|
|
58517
|
+
"markdown": true
|
|
58510
58518
|
}
|
|
58511
58519
|
}
|
|
58512
58520
|
},
|
|
@@ -58518,7 +58526,8 @@ const SCREENS = runtimeSetting({
|
|
|
58518
58526
|
"props": {
|
|
58519
58527
|
"text": "$item.subtitle",
|
|
58520
58528
|
"style": "title3",
|
|
58521
|
-
"maxLines": 1
|
|
58529
|
+
"maxLines": 1,
|
|
58530
|
+
"markdown": true
|
|
58522
58531
|
}
|
|
58523
58532
|
},
|
|
58524
58533
|
"modifiers": {
|
|
@@ -58603,7 +58612,8 @@ const SCREENS = runtimeSetting({
|
|
|
58603
58612
|
"props": {
|
|
58604
58613
|
"text": "$item.text",
|
|
58605
58614
|
"style": "footnote",
|
|
58606
|
-
"maxLines": 8
|
|
58615
|
+
"maxLines": 8,
|
|
58616
|
+
"markdown": true
|
|
58607
58617
|
}
|
|
58608
58618
|
},
|
|
58609
58619
|
"modifiers": {
|
|
@@ -59048,7 +59058,7 @@ const SCREENS = runtimeSetting({
|
|
|
59048
59058
|
"fillWidth": true,
|
|
59049
59059
|
"aspectRatio": 1.5,
|
|
59050
59060
|
"contentMode": "fill",
|
|
59051
|
-
"contentDescription": "$item.
|
|
59061
|
+
"contentDescription": "$item.label"
|
|
59052
59062
|
}
|
|
59053
59063
|
},
|
|
59054
59064
|
"modifiers": {
|
|
@@ -59109,7 +59119,8 @@ const SCREENS = runtimeSetting({
|
|
|
59109
59119
|
"type": "Text",
|
|
59110
59120
|
"props": {
|
|
59111
59121
|
"text": "$item.title",
|
|
59112
|
-
"style": "bodyEmphasis"
|
|
59122
|
+
"style": "bodyEmphasis",
|
|
59123
|
+
"markdown": true
|
|
59113
59124
|
}
|
|
59114
59125
|
}
|
|
59115
59126
|
},
|
|
@@ -59121,7 +59132,8 @@ const SCREENS = runtimeSetting({
|
|
|
59121
59132
|
"props": {
|
|
59122
59133
|
"text": "$item.subtitle",
|
|
59123
59134
|
"style": "body",
|
|
59124
|
-
"color": "textSecondary"
|
|
59135
|
+
"color": "textSecondary",
|
|
59136
|
+
"markdown": true
|
|
59125
59137
|
}
|
|
59126
59138
|
},
|
|
59127
59139
|
"modifiers": {
|
|
@@ -59135,7 +59147,8 @@ const SCREENS = runtimeSetting({
|
|
|
59135
59147
|
"type": "Text",
|
|
59136
59148
|
"props": {
|
|
59137
59149
|
"text": "$item.text",
|
|
59138
|
-
"style": "body"
|
|
59150
|
+
"style": "body",
|
|
59151
|
+
"markdown": true
|
|
59139
59152
|
}
|
|
59140
59153
|
},
|
|
59141
59154
|
"modifiers": {
|
|
@@ -59149,7 +59162,8 @@ const SCREENS = runtimeSetting({
|
|
|
59149
59162
|
"type": "Text",
|
|
59150
59163
|
"props": {
|
|
59151
59164
|
"text": "$item.listText",
|
|
59152
|
-
"style": "body"
|
|
59165
|
+
"style": "body",
|
|
59166
|
+
"markdown": true
|
|
59153
59167
|
}
|
|
59154
59168
|
},
|
|
59155
59169
|
"modifiers": {
|
|
@@ -59357,7 +59371,7 @@ const SCREENS = runtimeSetting({
|
|
|
59357
59371
|
"height": 36,
|
|
59358
59372
|
"shape": "rounded",
|
|
59359
59373
|
"contentMode": "fill",
|
|
59360
|
-
"contentDescription": "$item.
|
|
59374
|
+
"contentDescription": "$item.label"
|
|
59361
59375
|
}
|
|
59362
59376
|
},
|
|
59363
59377
|
"modifiers": {
|
|
@@ -59365,6 +59379,7 @@ const SCREENS = runtimeSetting({
|
|
|
59365
59379
|
}
|
|
59366
59380
|
},
|
|
59367
59381
|
"title": "$item.title",
|
|
59382
|
+
"markdown": true,
|
|
59368
59383
|
"subtitle": "$item.subtitle",
|
|
59369
59384
|
"onTap": {
|
|
59370
59385
|
"actionId": "tier5.himiOwnerLiteAria.widgetPick",
|
|
@@ -59608,7 +59623,7 @@ const SCREENS = runtimeSetting({
|
|
|
59608
59623
|
}
|
|
59609
59624
|
},
|
|
59610
59625
|
"modifiers": {
|
|
59611
|
-
"accessibilityLabel": "$item.
|
|
59626
|
+
"accessibilityLabel": "$item.label"
|
|
59612
59627
|
}
|
|
59613
59628
|
},
|
|
59614
59629
|
{
|
|
@@ -59622,7 +59637,7 @@ const SCREENS = runtimeSetting({
|
|
|
59622
59637
|
"height": 36,
|
|
59623
59638
|
"shape": "rounded",
|
|
59624
59639
|
"contentMode": "fill",
|
|
59625
|
-
"contentDescription": "$item.
|
|
59640
|
+
"contentDescription": "$item.label"
|
|
59626
59641
|
}
|
|
59627
59642
|
},
|
|
59628
59643
|
"modifiers": {
|
|
@@ -59966,7 +59981,7 @@ const SCREENS = runtimeSetting({
|
|
|
59966
59981
|
}
|
|
59967
59982
|
},
|
|
59968
59983
|
"modifiers": {
|
|
59969
|
-
"accessibilityLabel": "$item.
|
|
59984
|
+
"accessibilityLabel": "$item.label"
|
|
59970
59985
|
}
|
|
59971
59986
|
},
|
|
59972
59987
|
{
|
|
@@ -59985,7 +60000,8 @@ const SCREENS = runtimeSetting({
|
|
|
59985
60000
|
"props": {
|
|
59986
60001
|
"text": "$item.title",
|
|
59987
60002
|
"style": "body",
|
|
59988
|
-
"maxLines": 2
|
|
60003
|
+
"maxLines": 2,
|
|
60004
|
+
"markdown": true
|
|
59989
60005
|
}
|
|
59990
60006
|
}
|
|
59991
60007
|
},
|
|
@@ -59998,7 +60014,8 @@ const SCREENS = runtimeSetting({
|
|
|
59998
60014
|
"text": "$item.subtitle",
|
|
59999
60015
|
"style": "footnote",
|
|
60000
60016
|
"color": "textSecondary",
|
|
60001
|
-
"maxLines": 2
|
|
60017
|
+
"maxLines": 2,
|
|
60018
|
+
"markdown": true
|
|
60002
60019
|
}
|
|
60003
60020
|
},
|
|
60004
60021
|
"modifiers": {
|
|
@@ -60062,7 +60079,7 @@ const SCREENS = runtimeSetting({
|
|
|
60062
60079
|
}
|
|
60063
60080
|
},
|
|
60064
60081
|
"modifiers": {
|
|
60065
|
-
"accessibilityLabel": "$item.
|
|
60082
|
+
"accessibilityLabel": "$item.label"
|
|
60066
60083
|
}
|
|
60067
60084
|
},
|
|
60068
60085
|
{
|
|
@@ -60081,7 +60098,8 @@ const SCREENS = runtimeSetting({
|
|
|
60081
60098
|
"props": {
|
|
60082
60099
|
"text": "$item.title",
|
|
60083
60100
|
"style": "body",
|
|
60084
|
-
"maxLines": 2
|
|
60101
|
+
"maxLines": 2,
|
|
60102
|
+
"markdown": true
|
|
60085
60103
|
}
|
|
60086
60104
|
}
|
|
60087
60105
|
},
|
|
@@ -60094,7 +60112,8 @@ const SCREENS = runtimeSetting({
|
|
|
60094
60112
|
"text": "$item.subtitle",
|
|
60095
60113
|
"style": "footnote",
|
|
60096
60114
|
"color": "textSecondary",
|
|
60097
|
-
"maxLines": 2
|
|
60115
|
+
"maxLines": 2,
|
|
60116
|
+
"markdown": true
|
|
60098
60117
|
}
|
|
60099
60118
|
},
|
|
60100
60119
|
"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
|