@eifi1/ui-kit 0.35.0 → 0.37.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/README.md +35 -5
- package/dist/admin/role-select.d.ts +3 -2
- package/dist/admin/role-select.js +2 -0
- package/dist/admin/role-select.js.map +1 -1
- package/dist/components/amount-input.d.ts +2 -2
- package/dist/components/amount-input.js.map +1 -1
- package/dist/components/autocomplete.d.ts +2 -2
- package/dist/components/autocomplete.js +2 -1
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/button-look.d.ts +1 -1
- package/dist/components/button-look.js +9 -4
- package/dist/components/button-look.js.map +1 -1
- package/dist/components/checkbox-group.d.ts +5 -2
- package/dist/components/checkbox-group.js +15 -4
- package/dist/components/checkbox-group.js.map +1 -1
- package/dist/components/column-mapper.d.ts +5 -3
- package/dist/components/column-mapper.js +2 -0
- package/dist/components/column-mapper.js.map +1 -1
- package/dist/components/combobox.d.ts +2 -2
- package/dist/components/combobox.js +2 -1
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/country-select.d.ts +3 -3
- package/dist/components/country-select.js +3 -0
- package/dist/components/country-select.js.map +1 -1
- package/dist/components/currency-select.d.ts +3 -2
- package/dist/components/currency-select.js +10 -1
- package/dist/components/currency-select.js.map +1 -1
- package/dist/components/date-field.d.ts +2 -1
- package/dist/components/date-field.js.map +1 -1
- package/dist/components/date-picker.js +3 -0
- package/dist/components/date-picker.js.map +1 -1
- package/dist/components/date-range-picker.js +3 -0
- package/dist/components/date-range-picker.js.map +1 -1
- package/dist/components/entity-combobox.d.ts +2 -2
- package/dist/components/entity-combobox.js +2 -1
- package/dist/components/entity-combobox.js.map +1 -1
- package/dist/components/field-parts.d.ts +66 -11
- package/dist/components/field-parts.js +32 -10
- package/dist/components/field-parts.js.map +1 -1
- package/dist/components/field-strip.d.ts +3 -2
- package/dist/components/field-strip.js +2 -1
- package/dist/components/field-strip.js.map +1 -1
- package/dist/components/field.d.ts +3 -2
- package/dist/components/field.js +24 -15
- package/dist/components/field.js.map +1 -1
- package/dist/components/help-popover.d.ts +9 -7
- package/dist/components/help-popover.js.map +1 -1
- package/dist/components/icon-picker.d.ts +3 -2
- package/dist/components/icon-picker.js +3 -0
- package/dist/components/icon-picker.js.map +1 -1
- package/dist/components/inline-entity-combobox.d.ts +2 -2
- package/dist/components/inline-entity-combobox.js +2 -1
- package/dist/components/inline-entity-combobox.js.map +1 -1
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +2 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/month-picker.d.ts +2 -1
- package/dist/components/month-picker.js +8 -1
- package/dist/components/month-picker.js.map +1 -1
- package/dist/components/multi-entity-combobox.d.ts +2 -2
- package/dist/components/multi-entity-combobox.js +2 -1
- package/dist/components/multi-entity-combobox.js.map +1 -1
- package/dist/components/multi-select.d.ts +2 -2
- package/dist/components/multi-select.js +3 -0
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/number-input.d.ts +2 -2
- package/dist/components/number-input.js.map +1 -1
- package/dist/components/numeric-field.d.ts +5 -2
- package/dist/components/numeric-field.js +4 -1
- package/dist/components/numeric-field.js.map +1 -1
- package/dist/components/one-time-code-input.d.ts +2 -1
- package/dist/components/one-time-code-input.js +2 -1
- package/dist/components/one-time-code-input.js.map +1 -1
- package/dist/components/phone-input.d.ts +1 -1
- package/dist/components/phone-input.js +4 -0
- package/dist/components/phone-input.js.map +1 -1
- package/dist/components/popover.js +1 -1
- package/dist/components/popover.js.map +1 -1
- package/dist/components/select.d.ts +4 -3
- package/dist/components/select.js +2 -1
- package/dist/components/select.js.map +1 -1
- package/dist/components/slider.d.ts +3 -2
- package/dist/components/slider.js +7 -1
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stat-tile.js +2 -11
- package/dist/components/stat-tile.js.map +1 -1
- package/dist/components/swatch-picker.d.ts +3 -2
- package/dist/components/swatch-picker.js +3 -0
- package/dist/components/swatch-picker.js.map +1 -1
- package/dist/components/text-link.js +3 -1
- package/dist/components/text-link.js.map +1 -1
- package/dist/components/textarea.d.ts +2 -1
- package/dist/components/textarea.js +9 -3
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +7 -3
- package/dist/components/toggle-group.js.map +1 -1
- package/dist/eslint/index.js +1 -1
- package/dist/eslint/role-utilities.d.ts +34 -2
- package/dist/eslint/role-utilities.js +30 -9
- package/dist/eslint/role-utilities.js.map +1 -1
- package/dist/i18n/defaults.js +5 -1
- package/dist/i18n/defaults.js.map +1 -1
- package/dist/i18n/german.js +97 -1
- package/dist/i18n/german.js.map +1 -1
- package/dist/i18n/kit-labels.d.ts +16 -0
- package/dist/i18n/kit-labels.js +21 -1
- package/dist/i18n/kit-labels.js.map +1 -1
- package/dist/i18n/locales/en.js +103 -2
- package/dist/i18n/locales/en.js.map +3 -3
- package/dist/i18n/locales/es.js +95 -1
- package/dist/i18n/locales/es.js.map +1 -1
- package/dist/i18n/locales/fr.js +96 -1
- package/dist/i18n/locales/fr.js.map +1 -1
- package/dist/i18n/locales/hu.js +95 -1
- package/dist/i18n/locales/hu.js.map +1 -1
- package/dist/i18n/locales/it.js +96 -1
- package/dist/i18n/locales/it.js.map +1 -1
- package/dist/i18n/locales/zh.js +95 -1
- package/dist/i18n/locales/zh.js.map +1 -1
- package/dist/i18n/review.js +13 -0
- package/dist/i18n/review.js.map +1 -1
- package/dist/i18n/shared-labels.js +3 -1
- package/dist/i18n/shared-labels.js.map +1 -1
- package/dist/index.d.ts +21 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/device-settings.d.ts +72 -0
- package/dist/lib/device-settings.js +64 -0
- package/dist/lib/device-settings.js.map +1 -0
- package/dist/lib/plain-text.d.ts +11 -0
- package/dist/lib/plain-text.js +16 -0
- package/dist/lib/plain-text.js.map +1 -0
- package/dist/lib/safe-storage.d.ts +6 -0
- package/dist/lib/safe-storage.js +11 -0
- package/dist/lib/safe-storage.js.map +1 -1
- package/dist/notifications/notification-parts.d.ts +39 -0
- package/dist/notifications/notification-parts.js +47 -0
- package/dist/notifications/notification-parts.js.map +1 -0
- package/dist/notifications/notification-types-setting.d.ts +62 -0
- package/dist/notifications/notification-types-setting.js +192 -0
- package/dist/notifications/notification-types-setting.js.map +1 -0
- package/dist/notifications/notification-types.d.ts +75 -0
- package/dist/notifications/notification-types.js +2 -0
- package/dist/notifications/notification-types.js.map +1 -0
- package/dist/notifications/notifications-labels.d.ts +131 -0
- package/dist/notifications/notifications-labels.js +83 -0
- package/dist/notifications/notifications-labels.js.map +1 -0
- package/dist/notifications/push-device-setting.d.ts +37 -0
- package/dist/notifications/push-device-setting.js +164 -0
- package/dist/notifications/push-device-setting.js.map +1 -0
- package/dist/notifications/push-devices-setting.d.ts +44 -0
- package/dist/notifications/push-devices-setting.js +203 -0
- package/dist/notifications/push-devices-setting.js.map +1 -0
- package/dist/notifications/quiet-hours-setting.d.ts +47 -0
- package/dist/notifications/quiet-hours-setting.js +131 -0
- package/dist/notifications/quiet-hours-setting.js.map +1 -0
- package/dist/notifications/time-zone-select.d.ts +50 -0
- package/dist/notifications/time-zone-select.js +76 -0
- package/dist/notifications/time-zone-select.js.map +1 -0
- package/dist/notifications/unsubscribe-panel.d.ts +53 -0
- package/dist/notifications/unsubscribe-panel.js +139 -0
- package/dist/notifications/unsubscribe-panel.js.map +1 -0
- package/dist/notifications/use-push-device.d.ts +122 -0
- package/dist/notifications/use-push-device.js +230 -0
- package/dist/notifications/use-push-device.js.map +1 -0
- package/dist/rhf/fields.d.ts +26 -19
- package/dist/rhf/fields.js +51 -22
- package/dist/rhf/fields.js.map +1 -1
- package/dist/settings/device-reset-setting-labels.d.ts +3 -0
- package/dist/settings/device-reset-setting-labels.js +15 -0
- package/dist/settings/device-reset-setting-labels.js.map +1 -0
- package/dist/settings/device-reset-setting.d.ts +58 -0
- package/dist/settings/device-reset-setting.js +51 -0
- package/dist/settings/device-reset-setting.js.map +1 -0
- package/dist/shell/app-shell.js +5 -0
- package/dist/shell/app-shell.js.map +1 -1
- package/dist/theme/contrast-tokens.d.ts +42 -4
- package/dist/theme/contrast-tokens.js +56 -9
- package/dist/theme/contrast-tokens.js.map +1 -1
- package/dist/theme/contrast.d.ts +4 -2
- package/dist/theme/contrast.js +13 -0
- package/dist/theme/contrast.js.map +1 -1
- package/dist/theme/palette-derive.d.ts +15 -1
- package/dist/theme/palette-derive.js +37 -8
- package/dist/theme/palette-derive.js.map +1 -1
- package/dist/theme/palette-presets.d.ts +2 -1
- package/dist/theme/palette-presets.js +5 -5
- package/dist/theme/palette-presets.js.map +1 -1
- package/dist/theme/palette-store.js +6 -0
- package/dist/theme/palette-store.js.map +1 -1
- package/dist/theme/text-size.js +6 -0
- package/dist/theme/text-size.js.map +1 -1
- package/dist/theme/theme-store.js +6 -0
- package/dist/theme/theme-store.js.map +1 -1
- package/package.json +1 -1
- package/src/admin/role-select.tsx +4 -1
- package/src/components/amount-input.tsx +2 -1
- package/src/components/autocomplete.tsx +5 -2
- package/src/components/button-look.ts +15 -5
- package/src/components/checkbox-group.tsx +22 -4
- package/src/components/column-mapper.tsx +6 -2
- package/src/components/combobox.tsx +5 -2
- package/src/components/country-select.tsx +6 -1
- package/src/components/currency-select.tsx +12 -3
- package/src/components/date-field.tsx +2 -2
- package/src/components/date-picker.tsx +3 -0
- package/src/components/date-range-picker.tsx +3 -0
- package/src/components/entity-combobox.tsx +5 -2
- package/src/components/field-parts.tsx +107 -19
- package/src/components/field-strip.tsx +4 -3
- package/src/components/field.tsx +28 -15
- package/src/components/help-popover.tsx +9 -7
- package/src/components/icon-picker.tsx +8 -3
- package/src/components/inline-entity-combobox.tsx +5 -2
- package/src/components/input.tsx +4 -2
- package/src/components/month-picker.tsx +10 -3
- package/src/components/multi-entity-combobox.tsx +5 -2
- package/src/components/multi-select.tsx +6 -1
- package/src/components/number-input.tsx +2 -2
- package/src/components/numeric-field.ts +10 -2
- package/src/components/one-time-code-input.tsx +5 -3
- package/src/components/phone-input.tsx +4 -0
- package/src/components/popover.tsx +3 -1
- package/src/components/select.tsx +6 -3
- package/src/components/slider.tsx +10 -3
- package/src/components/stat-tile.tsx +3 -18
- package/src/components/swatch-picker.tsx +9 -4
- package/src/components/text-link.tsx +3 -1
- package/src/components/textarea.tsx +11 -4
- package/src/components/toggle-group.tsx +21 -5
- package/src/eslint/role-utilities.ts +67 -11
- package/src/i18n/defaults.ts +4 -0
- package/src/i18n/german.ts +113 -0
- package/src/i18n/kit-labels.tsx +52 -1
- package/src/i18n/locales/en.ts +6 -0
- package/src/i18n/locales/es.ts +106 -0
- package/src/i18n/locales/fr.ts +106 -0
- package/src/i18n/locales/hu.ts +104 -0
- package/src/i18n/locales/it.ts +105 -0
- package/src/i18n/locales/zh.ts +96 -0
- package/src/i18n/review.ts +13 -0
- package/src/i18n/shared-labels.ts +2 -0
- package/src/index.ts +50 -0
- package/src/lib/device-settings.ts +146 -0
- package/src/lib/plain-text.ts +22 -0
- package/src/lib/safe-storage.ts +16 -0
- package/src/notifications/notification-parts.tsx +83 -0
- package/src/notifications/notification-types-setting.tsx +309 -0
- package/src/notifications/notification-types.ts +80 -0
- package/src/notifications/notifications-labels.ts +238 -0
- package/src/notifications/push-device-setting.tsx +224 -0
- package/src/notifications/push-devices-setting.tsx +306 -0
- package/src/notifications/quiet-hours-setting.tsx +185 -0
- package/src/notifications/time-zone-select.tsx +126 -0
- package/src/notifications/unsubscribe-panel.tsx +203 -0
- package/src/notifications/use-push-device.ts +392 -0
- package/src/rhf/fields.tsx +77 -29
- package/src/settings/device-reset-setting-labels.ts +20 -0
- package/src/settings/device-reset-setting.tsx +119 -0
- package/src/shell/app-shell.tsx +8 -0
- package/src/theme/contrast-tokens.ts +106 -12
- package/src/theme/contrast.ts +30 -4
- package/src/theme/palette-derive.ts +68 -7
- package/src/theme/palette-presets.ts +9 -6
- package/src/theme/palette-store.ts +12 -0
- package/src/theme/text-size.ts +8 -0
- package/src/theme/theme-store.ts +10 -0
- package/tokens.css +38 -4
package/src/i18n/locales/zh.ts
CHANGED
|
@@ -249,6 +249,8 @@ export function uiKitLabelsZh(numberLocale = "zh-CN"): UiKitLabels {
|
|
|
249
249
|
// Full-width colon, no space after it.
|
|
250
250
|
fieldValue: (field, value) => `${field}:${value}`,
|
|
251
251
|
opensInNewTab: "在新标签页中打开",
|
|
252
|
+
aboutField: (field) => `关于“${field}”`,
|
|
253
|
+
help: "帮助",
|
|
252
254
|
},
|
|
253
255
|
dataTable: {
|
|
254
256
|
columns: "列",
|
|
@@ -1018,6 +1020,87 @@ export function uiKitLabelsZh(numberLocale = "zh-CN"): UiKitLabels {
|
|
|
1018
1020
|
rateLimited,
|
|
1019
1021
|
failed: "操作未成功,请重试。",
|
|
1020
1022
|
},
|
|
1023
|
+
// 0.36.0 — docs/notifications-harmonization.md §4.2: the notification cards.
|
|
1024
|
+
notifications: {
|
|
1025
|
+
typesTitle: "通知我以下内容",
|
|
1026
|
+
typesDescription: "选择要接收哪些通知,以及接收方式。",
|
|
1027
|
+
byEmail: "通过电子邮件",
|
|
1028
|
+
emailUnverified: "请先确认您的邮箱地址,才能收到这些邮件。",
|
|
1029
|
+
digestCadence: "频率",
|
|
1030
|
+
digestWeekly: "每周",
|
|
1031
|
+
digestMonthly: "每月",
|
|
1032
|
+
typesLoading: "正在加载通知设置…",
|
|
1033
|
+
typesEmpty: "此账户没有可用的通知。",
|
|
1034
|
+
quietTitle: "免打扰时段",
|
|
1035
|
+
quietDescription: (inbox) =>
|
|
1036
|
+
inbox ? "此时段内不发送推送通知。通知仍会进入您的收件箱。" : "此时段内不发送推送通知。",
|
|
1037
|
+
quietFrom: "从",
|
|
1038
|
+
quietUntil: "到",
|
|
1039
|
+
quietIncomplete: "请同时设置开始和结束时间。两者都设置后,免打扰时段才会生效。",
|
|
1040
|
+
timeZone: "时区",
|
|
1041
|
+
deviceZone: (zone) => `此设备位于 ${zone} 时区。`,
|
|
1042
|
+
useDeviceZone: "使用此时区",
|
|
1043
|
+
regions: {
|
|
1044
|
+
Africa: "非洲",
|
|
1045
|
+
America: "美洲",
|
|
1046
|
+
Antarctica: "南极洲",
|
|
1047
|
+
Arctic: "北极",
|
|
1048
|
+
Asia: "亚洲",
|
|
1049
|
+
Atlantic: "大西洋",
|
|
1050
|
+
Australia: "澳大利亚",
|
|
1051
|
+
Europe: "欧洲",
|
|
1052
|
+
Indian: "印度洋",
|
|
1053
|
+
Pacific: "太平洋",
|
|
1054
|
+
},
|
|
1055
|
+
pushTitle: "推送通知",
|
|
1056
|
+
pushDescription: "在此设备上接收通知,即使应用已关闭。",
|
|
1057
|
+
unsupported: "此浏览器不支持推送通知。",
|
|
1058
|
+
iosInstall: (app) => `在 iPhone 或 iPad 上,请先将 ${app} 添加到主屏幕:iOS 只向已安装的应用发送通知。`,
|
|
1059
|
+
notConfigured: "此服务器尚未设置推送通知。",
|
|
1060
|
+
blocked: "此浏览器的设置已阻止通知。",
|
|
1061
|
+
on: "此设备的通知已开启。",
|
|
1062
|
+
off: "此设备的通知已关闭。",
|
|
1063
|
+
otherAccount: "此浏览器正在接收另一个账户的通知。在此开启,即可接收您当前登录账户的通知。",
|
|
1064
|
+
enable: "开启通知",
|
|
1065
|
+
disable: "关闭",
|
|
1066
|
+
sendTest: "发送测试",
|
|
1067
|
+
enableFailed: "无法开启通知。",
|
|
1068
|
+
noServiceWorker: "无法连接应用的 Service Worker。请重新加载页面后重试。",
|
|
1069
|
+
pushTimeout: "浏览器的推送服务没有响应。请检查网络连接后重试。",
|
|
1070
|
+
testSent: (count) => `测试已发送到 ${n(count)} 台设备`,
|
|
1071
|
+
testNone: "没有设备接收此测试。请先为此设备开启通知。",
|
|
1072
|
+
testFailed: "无法发送测试通知。",
|
|
1073
|
+
explainerTitle: "开启通知?",
|
|
1074
|
+
explainerBody: (app) => `${app} 只会就您选择的内容发送通知,您可以随时关闭。`,
|
|
1075
|
+
explainerHint: "接下来浏览器会请求您的许可。",
|
|
1076
|
+
explainerContinue: "继续",
|
|
1077
|
+
devicesTitle: "通知设备",
|
|
1078
|
+
devicesDescription: "为您的账户接收推送通知的所有设备。请移除不再使用的设备。",
|
|
1079
|
+
devicesLoading: "正在加载设备…",
|
|
1080
|
+
devicesEmpty: "还没有设备接收通知。",
|
|
1081
|
+
unknownDevice: "未知设备",
|
|
1082
|
+
thisDevice: "此设备",
|
|
1083
|
+
added: (date) => `添加于 ${date}`,
|
|
1084
|
+
lastDelivery: (date) => `上次送达:${date}`,
|
|
1085
|
+
noDelivery: "尚未送达",
|
|
1086
|
+
failures: (count) => `连续 ${n(count)} 次送达失败`,
|
|
1087
|
+
remove: "移除",
|
|
1088
|
+
// Starts with `remove`, the button's visible text, for voice control.
|
|
1089
|
+
removeItem: (device) => `移除:${device}`,
|
|
1090
|
+
removePrompt: "停止向此设备发送通知?",
|
|
1091
|
+
unsubscribeTitle: "电子邮件通知",
|
|
1092
|
+
unsubscribeAbout: (type) => `您会收到有关以下内容的邮件:${type}。`,
|
|
1093
|
+
unsubscribeGeneric: "您会收到通知邮件。",
|
|
1094
|
+
stopThese: "停止接收这些邮件",
|
|
1095
|
+
stopAll: (app) => `停止接收来自 ${app} 的所有通知邮件`,
|
|
1096
|
+
stoppedThese: "已完成。您将不再收到这些邮件。",
|
|
1097
|
+
stoppedAll: (app) => `已完成。您将不再收到来自 ${app} 的通知邮件。`,
|
|
1098
|
+
accountMail: "有关您账户的邮件仍会照常发送。",
|
|
1099
|
+
turnBackOn: "您可以随时在“设置”中重新开启。",
|
|
1100
|
+
openSettings: "打开设置",
|
|
1101
|
+
invalidLink: "此链接已失效。您可以改为在“设置”中关闭这些邮件。",
|
|
1102
|
+
failed: "操作未成功,请重试。",
|
|
1103
|
+
},
|
|
1021
1104
|
sessions: {
|
|
1022
1105
|
title: "会话",
|
|
1023
1106
|
description: "在不再使用或不信任的设备上登录过?请在所有设备上退出登录。",
|
|
@@ -1521,6 +1604,19 @@ export function uiKitLabelsZh(numberLocale = "zh-CN"): UiKitLabels {
|
|
|
1521
1604
|
contrastModes: { system: "跟随系统", standard: "标准", more: "增强" },
|
|
1522
1605
|
saveFailed: "无法保存到您的账户。此设备上仍然生效。",
|
|
1523
1606
|
},
|
|
1607
|
+
// 0.36.0 — docs/settings-harmonization.md §11.3: resetting this device's settings, the
|
|
1608
|
+
// last card of "外观".
|
|
1609
|
+
deviceReset: {
|
|
1610
|
+
title: "重置此设备",
|
|
1611
|
+
description: "将此设备的外观,以及表格和面板上次留下的状态,恢复为默认值。您的账户、数据和登录状态不受影响。",
|
|
1612
|
+
action: "重置此设备的设置",
|
|
1613
|
+
confirmTitle: "要重置此设备的设置吗?",
|
|
1614
|
+
confirmBody:
|
|
1615
|
+
"主题、颜色、文字大小、对比度和语言将在此设备上恢复为默认值,表格和面板会像第一次打开时那样显示。如果您的账户设置了语言、文字大小或对比度,此设备会重新沿用这些设置。您的账户和其他设备保持不变。",
|
|
1616
|
+
confirmAction: "重置",
|
|
1617
|
+
done: "此设备的设置已恢复为默认值。",
|
|
1618
|
+
keywords: "重置 默认 设备 恢复 外观 表格 布局",
|
|
1619
|
+
},
|
|
1524
1620
|
rowActions: {
|
|
1525
1621
|
actions: "操作",
|
|
1526
1622
|
actionsFor: (name) => `${name} 的操作`,
|
package/src/i18n/review.ts
CHANGED
|
@@ -119,6 +119,7 @@ const operatorSample = [[LEGAL_OPERATOR_SAMPLE]] as const;
|
|
|
119
119
|
*/
|
|
120
120
|
export const KIT_LABEL_SAMPLES: Readonly<Record<string, readonly (readonly unknown[])[]>> = {
|
|
121
121
|
"common.fieldValue": [["{{field}}", "{{value}}"]],
|
|
122
|
+
"common.aboutField": [["{{field}}"]],
|
|
122
123
|
"dataTable.filterResults": [
|
|
123
124
|
[1, 1],
|
|
124
125
|
[3, 12],
|
|
@@ -324,6 +325,18 @@ export const KIT_LABEL_SAMPLES: Readonly<Record<string, readonly (readonly unkno
|
|
|
324
325
|
"sessions.lastActive": [["{{when}}"]],
|
|
325
326
|
"sessions.ip": [["{{address}}"]],
|
|
326
327
|
"sessions.revokeItem": [["{{device}}"]],
|
|
328
|
+
"notifications.quietDescription": [[false], [true]],
|
|
329
|
+
"notifications.deviceZone": [["{{zone}}"]],
|
|
330
|
+
"notifications.iosInstall": [["{{app}}"]],
|
|
331
|
+
"notifications.testSent": one,
|
|
332
|
+
"notifications.explainerBody": [["{{app}}"]],
|
|
333
|
+
"notifications.added": [["{{date}}"]],
|
|
334
|
+
"notifications.lastDelivery": [["{{date}}"]],
|
|
335
|
+
"notifications.failures": one,
|
|
336
|
+
"notifications.removeItem": [["{{device}}"]],
|
|
337
|
+
"notifications.unsubscribeAbout": [["{{type}}"]],
|
|
338
|
+
"notifications.stopAll": [["{{app}}"]],
|
|
339
|
+
"notifications.stoppedAll": [["{{app}}"]],
|
|
327
340
|
"deleteAccount.afterDays": [[1], [30]],
|
|
328
341
|
"deleteAccount.handOver": [[1], [3]],
|
|
329
342
|
"deleteAccount.lastAdminOf": [["{{companies}}"]],
|
|
@@ -37,6 +37,8 @@ export const DEFAULT_COMMON_LABELS: CommonLabels = {
|
|
|
37
37
|
fieldValue: (field, value) => `${field}: ${value}`,
|
|
38
38
|
dismiss: "Dismiss",
|
|
39
39
|
opensInNewTab: "opens in a new tab",
|
|
40
|
+
aboutField: (field) => `About “${field}”`,
|
|
41
|
+
help: "Help",
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
export const DEFAULT_DATE_PICKER_LABELS: DatePickerLabels = {
|
package/src/index.ts
CHANGED
|
@@ -856,6 +856,13 @@ export type { PlanLimitToastOptions } from "./billing/plan-limit-toast";
|
|
|
856
856
|
// come with `./shell` above (also `@eifi1/ui-kit/shell`).
|
|
857
857
|
export { DEFAULT_SETTINGS_LABELS, useSettingsLabels } from "./settings/settings-labels";
|
|
858
858
|
export type { SettingsLabels, SettingsGroupLabels, SettingsCoreGroup } from "./settings/settings-labels";
|
|
859
|
+
// 0.36.0 (§11): "Reset this device's settings" — the registry the kit's stores, provider
|
|
860
|
+
// and shell join on their own and an app adds its own device keys to, and the card, the
|
|
861
|
+
// appearance group's last.
|
|
862
|
+
export { registerDeviceSetting, deviceSettings, resetDeviceSettings } from "./lib/device-settings";
|
|
863
|
+
export type { DeviceSetting, DeviceSettingKind } from "./lib/device-settings";
|
|
864
|
+
export { DeviceResetSetting, DEVICE_RESET_ANCHOR, DEFAULT_DEVICE_RESET_LABELS } from "./settings/device-reset-setting";
|
|
865
|
+
export type { DeviceResetSettingProps, DeviceResetLabels } from "./settings/device-reset-setting";
|
|
859
866
|
// The language follows the account (§6.2); since 0.32 so do the text size and the
|
|
860
867
|
// contrast (useAccountAppearance below, docs/text-size-harmonization.md §6).
|
|
861
868
|
export { useAccountLanguage, resolveAccountLanguage, matchOfferedLanguage } from "./settings/use-account-language";
|
|
@@ -877,6 +884,49 @@ export type {
|
|
|
877
884
|
AccountAppearance,
|
|
878
885
|
} from "./settings/use-account-appearance";
|
|
879
886
|
|
|
887
|
+
// ── notifications ────────────────────────────────────────────────────────────
|
|
888
|
+
// 0.36.0 (docs/notifications-harmonization.md §4.2): the notification cards — the types
|
|
889
|
+
// the server answers (the kit keeps no list of its own), quiet hours with the zone picker,
|
|
890
|
+
// this device's push on its hook, the device list — and the signed-out unsubscribe page.
|
|
891
|
+
// Each card takes the app's request functions; the kit makes no request itself.
|
|
892
|
+
export { DEFAULT_NOTIFICATIONS_LABELS } from "./notifications/notifications-labels";
|
|
893
|
+
export type { NotificationsLabels, NotificationRegionLabels } from "./notifications/notifications-labels";
|
|
894
|
+
export type {
|
|
895
|
+
DigestCadence,
|
|
896
|
+
NotificationSwitches,
|
|
897
|
+
NotificationTypesValue,
|
|
898
|
+
NotificationTypeEntry,
|
|
899
|
+
NotificationTypeGroup,
|
|
900
|
+
NotificationSettingsPatch,
|
|
901
|
+
PushDeviceItem,
|
|
902
|
+
} from "./notifications/notification-types";
|
|
903
|
+
export { NotificationTypesSetting } from "./notifications/notification-types-setting";
|
|
904
|
+
export type { NotificationTypesSettingProps } from "./notifications/notification-types-setting";
|
|
905
|
+
export { QuietHoursSetting } from "./notifications/quiet-hours-setting";
|
|
906
|
+
export type { QuietHoursSettingProps } from "./notifications/quiet-hours-setting";
|
|
907
|
+
export { TimeZoneSelect, timeZoneOptions, deviceTimeZone } from "./notifications/time-zone-select";
|
|
908
|
+
export type { TimeZoneSelectProps } from "./notifications/time-zone-select";
|
|
909
|
+
export {
|
|
910
|
+
usePushDevice,
|
|
911
|
+
PUSH_SUBSCRIPTION_CHANGED,
|
|
912
|
+
notifyPushSubscriptionChanged,
|
|
913
|
+
pushSupported,
|
|
914
|
+
PushDeviceError,
|
|
915
|
+
} from "./notifications/use-push-device";
|
|
916
|
+
export type {
|
|
917
|
+
PushDevice,
|
|
918
|
+
UsePushDeviceOptions,
|
|
919
|
+
PushSubscriptionInput,
|
|
920
|
+
PushPermission,
|
|
921
|
+
PushDeviceErrorCode,
|
|
922
|
+
} from "./notifications/use-push-device";
|
|
923
|
+
export { PushDeviceSetting } from "./notifications/push-device-setting";
|
|
924
|
+
export type { PushDeviceSettingProps, PushDeviceAction } from "./notifications/push-device-setting";
|
|
925
|
+
export { PushDevicesSetting, describeUserAgent } from "./notifications/push-devices-setting";
|
|
926
|
+
export type { PushDevicesSettingProps } from "./notifications/push-devices-setting";
|
|
927
|
+
export { UnsubscribePanel, unsubscribeTokenType } from "./notifications/unsubscribe-panel";
|
|
928
|
+
export type { UnsubscribePanelProps } from "./notifications/unsubscribe-panel";
|
|
929
|
+
|
|
880
930
|
// ── landing ──────────────────────────────────────────────────────────────────
|
|
881
931
|
// 0.31.0 (docs/landing-demo-harmonization.md): the public landing page. Its router-aware parts — the header and the resume (RootEntry,
|
|
882
932
|
// RedirectIfAuthed, the last-visited page) — come with `./shell` above.
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { readSessionStored, readStored, removeStored, storedKeys, writeSessionStored } from "./safe-storage";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* What this device keeps of how it shows the app, and the one action that puts it all
|
|
5
|
+
* back: "Reset this device's settings" (docs/settings-harmonization.md §11).
|
|
6
|
+
*
|
|
7
|
+
* A registry, because no one part knows every key. The kit's own stores and components
|
|
8
|
+
* join it themselves — the theme, palette, text-size and contrast stores when they are
|
|
9
|
+
* created, `UiKitProvider` (the prefix its tables keep their views under) and `AppShell`
|
|
10
|
+
* (the sidebar's folded state) while they are mounted — and an app adds its own keys
|
|
11
|
+
* beside the store or accessor that owns each (keksdose's date format, kastlan's
|
|
12
|
+
* language, Kurvenschmiede's curve channels). {@link resetDeviceSettings} then clears
|
|
13
|
+
* exactly what joined, and nothing else: the sign-in, the session, what waits to be sent
|
|
14
|
+
* and the account never join (§11.2 decision 2), so a key nobody registered survives.
|
|
15
|
+
*
|
|
16
|
+
* No React and no router: a store joins at module scope, when it is created. Here in
|
|
17
|
+
* `src/lib` beside `safe-storage.ts`, which the stores and the shell already import, so
|
|
18
|
+
* `src/theme` and `src/shell` do not import `src/settings`. One module instance, one
|
|
19
|
+
* module-level list.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** What a reset of this device's settings clears (§11.2 decision 1): how the app looks
|
|
23
|
+
* here, and how its tables and panels were left. An app's own list may add a third kind
|
|
24
|
+
* of its own for what never goes (Kurvenschmiede's "never"). */
|
|
25
|
+
export type DeviceSettingKind = "appearance" | "view";
|
|
26
|
+
|
|
27
|
+
export interface DeviceSetting {
|
|
28
|
+
/** The storage key; with `prefix`, every key that starts with it. */
|
|
29
|
+
key: string;
|
|
30
|
+
/** `true`: `key` is a prefix (a table's views, keksdose's display currency per budget).
|
|
31
|
+
* It matches by `startsWith`: `budget.displayCurrency.` does not take the legacy
|
|
32
|
+
* `budget.displayCurrency`. */
|
|
33
|
+
prefix?: boolean;
|
|
34
|
+
/** Default `"local"`. */
|
|
35
|
+
storage?: "local" | "session";
|
|
36
|
+
kind: DeviceSettingKind;
|
|
37
|
+
/**
|
|
38
|
+
* Puts the live value back to its default through the store's own setter, the one its
|
|
39
|
+
* control calls, so whatever that setter also does still happens — never
|
|
40
|
+
* `setState(getInitialState())`, which skips it. REQUIRED for anything held in memory:
|
|
41
|
+
* every persisted zustand store (removing its key alone, it writes its value back on its
|
|
42
|
+
* next change), a mounted component's state. With `reset` the key is left to it (a
|
|
43
|
+
* persisted store writes its default itself); without, the key, or every key under the
|
|
44
|
+
* prefix, is removed — for what is read where it is next used (a table at its mount, a
|
|
45
|
+
* plain accessor).
|
|
46
|
+
*/
|
|
47
|
+
reset?: () => void;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Whoever joined one key, in join order; the last one's entry is the key's entry. */
|
|
51
|
+
type Holders = { entry: DeviceSetting }[];
|
|
52
|
+
|
|
53
|
+
/** One slot per key and storage area, in the order each was first joined. */
|
|
54
|
+
const slots = new Map<string, Holders>();
|
|
55
|
+
|
|
56
|
+
const areaOf = (entry: DeviceSetting): "local" | "session" => (entry.storage === "session" ? "session" : "local");
|
|
57
|
+
const slotOf = (entry: DeviceSetting) => `${areaOf(entry)}:${entry.key}`;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Join the registry; answers the leave function. A store joins once, at creation, and
|
|
61
|
+
* never leaves; a component joins while mounted and leaves in its effect's cleanup.
|
|
62
|
+
*
|
|
63
|
+
* **One entry per key** (and storage area): joining a key again replaces its entry and
|
|
64
|
+
* adds a holder, and a leave drops its holder — the entry goes with the last one, and
|
|
65
|
+
* until then the latest remaining holder's entry is the key's. So a module evaluated twice
|
|
66
|
+
* (a test, a hot reload) does not reset twice, and two nested providers with one prefix
|
|
67
|
+
* keep their entry until the outer one unmounts.
|
|
68
|
+
*/
|
|
69
|
+
export function registerDeviceSetting(entry: DeviceSetting): () => void {
|
|
70
|
+
const slot = slotOf(entry);
|
|
71
|
+
const holder = { entry: { ...entry } };
|
|
72
|
+
const holders = slots.get(slot);
|
|
73
|
+
if (holders) holders.push(holder);
|
|
74
|
+
else slots.set(slot, [holder]);
|
|
75
|
+
let left = false;
|
|
76
|
+
return () => {
|
|
77
|
+
if (left) return;
|
|
78
|
+
left = true;
|
|
79
|
+
// A holder that has not left is in its slot: only its own leave takes it out, and a
|
|
80
|
+
// slot goes only once it is empty.
|
|
81
|
+
const current = slots.get(slot) as Holders;
|
|
82
|
+
current.splice(current.indexOf(holder), 1);
|
|
83
|
+
if (current.length === 0) slots.delete(slot);
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** Every entry, in join order: for an app's own test (Kurvenschmiede holds it to its
|
|
88
|
+
* `STORAGE` list) or its privacy page. */
|
|
89
|
+
export function deviceSettings(): readonly DeviceSetting[] {
|
|
90
|
+
return [...slots.values()].map((holders) => holders[holders.length - 1].entry);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Is this a development build? `import.meta.env` is a Vite injection, absent under Node. */
|
|
94
|
+
function devBuild(): boolean {
|
|
95
|
+
return Boolean(import.meta.env?.DEV);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** The keys an entry covers now: a prefix's keys found under it, else its own key. */
|
|
99
|
+
function keysOf(entry: DeviceSetting): string[] {
|
|
100
|
+
return entry.prefix ? storedKeys(entry.key, areaOf(entry)) : [entry.key];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Remove what `entry` covers; answers the keys that were there. */
|
|
104
|
+
function removeEntry(entry: DeviceSetting): string[] {
|
|
105
|
+
const session = areaOf(entry) === "session";
|
|
106
|
+
const present = keysOf(entry).filter((key) => (session ? readSessionStored(key) : readStored(key)) !== null);
|
|
107
|
+
for (const key of present) {
|
|
108
|
+
if (session) writeSessionStored(key, null);
|
|
109
|
+
else removeStored(key);
|
|
110
|
+
}
|
|
111
|
+
return present;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Reset every entry, at once; answers the keys it reset or removed, prefixes expanded.
|
|
116
|
+
*
|
|
117
|
+
* Synchronous, in two passes: first every `reset`, in join order, so each live store puts
|
|
118
|
+
* its value back (and writes its default); then the keys of the entries without one. A
|
|
119
|
+
* `reset` that throws is caught (`console.error` in development), its key is removed
|
|
120
|
+
* instead, and the rest still run. It never reloads, navigates or sends a request, and
|
|
121
|
+
* never touches a key nobody registered. Where the browser refuses storage, the live
|
|
122
|
+
* values still reset and nothing throws.
|
|
123
|
+
*
|
|
124
|
+
* The answer: an entry with a `reset` lists its key (a prefix, the keys found under it);
|
|
125
|
+
* an entry without lists the keys it removed, those that were there.
|
|
126
|
+
*/
|
|
127
|
+
export function resetDeviceSettings(): string[] {
|
|
128
|
+
const keys: string[] = [];
|
|
129
|
+
const remove: DeviceSetting[] = [];
|
|
130
|
+
for (const entry of deviceSettings()) {
|
|
131
|
+
if (!entry.reset) {
|
|
132
|
+
remove.push(entry);
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const covered = keysOf(entry);
|
|
136
|
+
try {
|
|
137
|
+
entry.reset();
|
|
138
|
+
keys.push(...covered);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
if (devBuild()) console.error(`resetDeviceSettings: the reset of "${entry.key}" threw; its key is removed instead.`, error);
|
|
141
|
+
remove.push(entry);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
for (const entry of remove) keys.push(...removeEntry(entry));
|
|
145
|
+
return [...new Set(keys)];
|
|
146
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isValidElement } from "react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The text of a label node: a string or number as is, an element by its children,
|
|
6
|
+
* recursively, whitespace collapsed. A `<Tooltip label="…">Spend</Tooltip>` label yields
|
|
7
|
+
* "Spend" — the text the reader sees, not the bubble's. `undefined` when there is no text
|
|
8
|
+
* to find (an icon), so the caller falls back to a name of its own.
|
|
9
|
+
*
|
|
10
|
+
* Package-private — not re-exported from the barrel. StatTile names its sparkline by it;
|
|
11
|
+
* a field names its `help` "?" by it ("About “<label>”", round 0.36).
|
|
12
|
+
*/
|
|
13
|
+
export function plainText(node: ReactNode): string | undefined {
|
|
14
|
+
const walk = (n: ReactNode): string => {
|
|
15
|
+
if (typeof n === "string" || typeof n === "number") return String(n);
|
|
16
|
+
if (Array.isArray(n)) return n.map(walk).join("");
|
|
17
|
+
if (isValidElement<{ children?: ReactNode }>(n)) return walk(n.props.children);
|
|
18
|
+
return "";
|
|
19
|
+
};
|
|
20
|
+
const text = walk(node).replace(/\s+/g, " ").trim();
|
|
21
|
+
return text === "" ? undefined : text;
|
|
22
|
+
}
|
package/src/lib/safe-storage.ts
CHANGED
|
@@ -59,3 +59,19 @@ export function writeSessionStored(key: string, value: string | null): void {
|
|
|
59
59
|
value === null ? storage.removeItem(key) : storage.setItem(key, value),
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Every key in `area` that starts with `prefix`, or `[]` where storage refuses — for the
|
|
65
|
+
* reset of this device's settings, which removes a table's views by their prefix
|
|
66
|
+
* (docs/settings-harmonization.md §11.4). Package-private, like {@link removeStored}.
|
|
67
|
+
*/
|
|
68
|
+
export function storedKeys(prefix: string, area: "local" | "session" = "local"): string[] {
|
|
69
|
+
return guarded(area === "session" ? "sessionStorage" : "localStorage", [], (storage) => {
|
|
70
|
+
const keys: string[] = [];
|
|
71
|
+
for (let i = 0; i < storage.length; i++) {
|
|
72
|
+
const key = storage.key(i);
|
|
73
|
+
if (key !== null && key.startsWith(prefix)) keys.push(key);
|
|
74
|
+
}
|
|
75
|
+
return keys;
|
|
76
|
+
});
|
|
77
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
import { useKitLabels, type LabelOverride } from "../i18n/kit-labels";
|
|
5
|
+
import { hasContent } from "../lib/presence";
|
|
6
|
+
import { AlertBanner } from "../components/alert-banner";
|
|
7
|
+
import { DEFAULT_NOTIFICATIONS_LABELS } from "./notifications-labels";
|
|
8
|
+
import type { NotificationsLabels } from "./notifications-labels";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* What the notification cards share: their words, the failure line under a card, and
|
|
12
|
+
* the overlay a card shows while its write runs.
|
|
13
|
+
*
|
|
14
|
+
* @internal Not part of the barrel; the cards are.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/** The `notifications` namespace: English, then the provider, then the card's prop. */
|
|
18
|
+
export function useNotificationsLabels(prop?: LabelOverride<NotificationsLabels>): NotificationsLabels {
|
|
19
|
+
return useKitLabels("notifications", DEFAULT_NOTIFICATIONS_LABELS, prop);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** The app's words for a failure, else `fallback`. */
|
|
23
|
+
export function describeFailure(own: ReactNode | undefined, fallback: ReactNode): ReactNode {
|
|
24
|
+
return hasContent(own) ? own : fallback;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** A failure, said under the card's controls — nothing toasts (§4.2). */
|
|
28
|
+
export function FailureLine({ children }: { children: ReactNode }) {
|
|
29
|
+
if (!hasContent(children)) return null;
|
|
30
|
+
return (
|
|
31
|
+
<AlertBanner tone="danger" size="sm" role="alert">
|
|
32
|
+
{children}
|
|
33
|
+
</AlertBanner>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** What {@link useWriteOverlay} answers. */
|
|
38
|
+
export interface WriteOverlay<V> {
|
|
39
|
+
has: (key: string) => boolean;
|
|
40
|
+
get: (key: string) => V | undefined;
|
|
41
|
+
pending: (key: string) => boolean;
|
|
42
|
+
set: (key: string, value: V) => void;
|
|
43
|
+
settle: (key: string, ok: boolean) => void;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Values a card shows while its write runs, over what the server last answered.
|
|
48
|
+
*
|
|
49
|
+
* `set(key, value)` shows `value` at once; `settle(key, ok)` drops it again when the
|
|
50
|
+
* write failed (the server's value comes back) and keeps it when it succeeded, until the
|
|
51
|
+
* app hands the card a new `source` — the PATCH's answer, or a refetch — which clears
|
|
52
|
+
* every settled entry, so a card whose app does not update its query on success does not
|
|
53
|
+
* flick back to the old value in between. `pending(key)` says whether a write for `key`
|
|
54
|
+
* is still running.
|
|
55
|
+
*
|
|
56
|
+
* The reset on a new `source` is React's "adjust state while rendering" pattern, not an
|
|
57
|
+
* effect: the overlay is gone in the same render that shows the new value.
|
|
58
|
+
*/
|
|
59
|
+
export function useWriteOverlay<V>(source: unknown): WriteOverlay<V> {
|
|
60
|
+
const [entries, setEntries] = useState<ReadonlyMap<string, { value: V; running: boolean }>>(new Map());
|
|
61
|
+
const [seen, setSeen] = useState(source);
|
|
62
|
+
if (seen !== source) {
|
|
63
|
+
setSeen(source);
|
|
64
|
+
const kept = new Map([...entries].filter(([, entry]) => entry.running));
|
|
65
|
+
if (kept.size !== entries.size) setEntries(kept);
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
has: (key: string) => entries.has(key),
|
|
69
|
+
get: (key: string) => entries.get(key)?.value,
|
|
70
|
+
pending: (key: string) => entries.get(key)?.running === true,
|
|
71
|
+
set: (key: string, value: V) =>
|
|
72
|
+
setEntries((current) => new Map(current).set(key, { value, running: true })),
|
|
73
|
+
settle: (key: string, ok: boolean) =>
|
|
74
|
+
setEntries((current) => {
|
|
75
|
+
const entry = current.get(key);
|
|
76
|
+
if (!entry) return current;
|
|
77
|
+
const next = new Map(current);
|
|
78
|
+
if (ok) next.set(key, { value: entry.value, running: false });
|
|
79
|
+
else next.delete(key);
|
|
80
|
+
return next;
|
|
81
|
+
}),
|
|
82
|
+
};
|
|
83
|
+
}
|