@astryx-vue/core 0.7.27 → 0.7.28
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/AppShell/index.d.ts +1 -1
- package/dist/AppShell/index.js +1 -1
- package/dist/{AppShell-D7ik41g-.js → AppShell-CeFsQXNh.js} +8 -3
- package/dist/Avatar/index.js +1 -1
- package/dist/{Avatar-D_C9RBJb.js → Avatar-76xnfD9n.js} +3 -2
- package/dist/AvatarGroup/index.d.ts +1 -1
- package/dist/AvatarGroup/index.js +1 -1
- package/dist/{AvatarGroup-CFvNDgU-.js → AvatarGroup-Beuljwpu.js} +5 -3
- package/dist/Banner/index.d.ts +1 -1
- package/dist/Banner/index.js +1 -1
- package/dist/{Banner-C1B7DsHS.js → Banner-Dx2JtVc-.js} +3 -2
- package/dist/BottomSheet/index.d.ts +1 -1
- package/dist/Breadcrumbs/index.js +2 -2
- package/dist/{Breadcrumbs-BgiZY7un.js → Breadcrumbs-Brgi3F8q.js} +1 -1
- package/dist/Button/index.d.ts +1 -1
- package/dist/ButtonGroup/index.d.ts +1 -1
- package/dist/Calendar/index.d.ts +1 -1
- package/dist/Calendar/index.js +1 -1
- package/dist/{Calendar-Bzgi-XyF.js → Calendar-DwFAzDky.js} +4 -3
- package/dist/Card/index.d.ts +1 -1
- package/dist/Carousel/index.js +1 -1
- package/dist/{Carousel--VycM-Sa.js → Carousel-CSsQ4GHW.js} +3 -2
- package/dist/Chat/index.d.ts +1 -1
- package/dist/Chat/index.js +1 -1
- package/dist/{Chat-C1DlnlCQ.js → Chat-j2m3Exwo.js} +21 -20
- package/dist/CheckboxInput/index.d.ts +1 -1
- package/dist/CheckboxInput/index.js +1 -1
- package/dist/{CheckboxInput-uk8nuCEf.js → CheckboxInput-iCg8FgRv.js} +1 -1
- package/dist/CheckboxList/index.d.ts +1 -1
- package/dist/CheckboxList/index.js +1 -1
- package/dist/{CheckboxList-Dr4kQ-BC.js → CheckboxList-Dr40y9ME.js} +5 -4
- package/dist/Citation/index.js +1 -1
- package/dist/{Citation-BAFsn6N1.js → Citation-CSgRYxGU.js} +3 -2
- package/dist/ClickableCard/index.d.ts +1 -1
- package/dist/Code/index.d.ts +1 -1
- package/dist/Collapsible/index.d.ts +1 -1
- package/dist/CommandPalette/index.js +1 -1
- package/dist/{CommandPalette-lewtyQrO.js → CommandPalette-C1duZfmg.js} +8 -7
- package/dist/ComplexSelector/index.d.ts +1 -1
- package/dist/ComplexSelector/index.js +1 -1
- package/dist/{ComplexSelector-BUnqjeW5.js → ComplexSelector-BgnhEjIN.js} +6 -5
- package/dist/ContextMenu/index.d.ts +1 -1
- package/dist/ContextMenu/index.js +2 -2
- package/dist/{ContextMenu-IDkvorRp.js → ContextMenu-DN_nTBgW.js} +6 -5
- package/dist/DateInput/index.d.ts +1 -1
- package/dist/DateInput/index.js +1 -1
- package/dist/{DateInput-DTxxFz9-.js → DateInput-BY9qdl_H.js} +14 -9
- package/dist/DateRangeInput/index.d.ts +1 -1
- package/dist/DateRangeInput/index.js +1 -1
- package/dist/{DateRangeInput-D4Us58KW.js → DateRangeInput-C0vyG95Z.js} +13 -7
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.js +1 -1
- package/dist/{DateTimeInput-CliLnI7P.js → DateTimeInput-BmIljXWd.js} +15 -7
- package/dist/Dialog/index.d.ts +1 -1
- package/dist/Dialog/index.js +1 -1
- package/dist/{DialogHeader-Hk419KW1.js → DialogHeader-Dfegdd7v.js} +3 -2
- package/dist/Drawer/index.d.ts +1 -1
- package/dist/Drawer/index.js +1 -1
- package/dist/{Drawer-DoQ9hjKz.js → Drawer-7LLlGQcE.js} +1 -1
- package/dist/DropdownMenu/index.js +3 -3
- package/dist/{DropdownMenu-B2iga1fe.js → DropdownMenu-B6SXhr61.js} +2 -3
- package/dist/{DropdownMenu-BF2Z5T4h.js → DropdownMenu-CJxA-kJ2.js} +4 -5
- package/dist/Field/index.js +3 -3
- package/dist/{Field-if5a58LO.js → Field-Dc15m78p.js} +1 -1
- package/dist/{FieldLabel-C-IaUcP4.js → FieldLabel-CfO3zaZ5.js} +4 -3
- package/dist/FileInput/index.d.ts +1 -1
- package/dist/FileInput/index.js +1 -1
- package/dist/{FileInput-0zBWfO8h.js → FileInput-C6eX4nBl.js} +6 -5
- package/dist/Heading/index.d.ts +1 -1
- package/dist/InfoTip/index.d.ts +1 -1
- package/dist/InfoTip/index.js +1 -1
- package/dist/{InfoTip-DNQy7wqB.js → InfoTip-iKOp_vUV.js} +3 -2
- package/dist/{InputClearButton-DhvxPkK6.js → InputClearButton-DjIxNNH8.js} +4 -3
- package/dist/InputGroup/index.js +1 -1
- package/dist/{InputGroup-B1kG0rBN.js → InputGroup-CIKleAu8.js} +1 -1
- package/dist/InternationalizationProvider/index.js +1 -1
- package/dist/{InternationalizationProvider-CUEIHCf4.js → InternationalizationProvider-CcEXq6fT.js} +2 -3
- package/dist/Kbd/index.js +1 -1
- package/dist/{Kbd-DyxKNYtE.js → Kbd-D4JPY4VI.js} +3 -2
- package/dist/Lightbox/index.js +1 -1
- package/dist/{Lightbox-B8uMFPOS.js → Lightbox-rY1XJs38.js} +4 -3
- package/dist/Link/index.d.ts +1 -1
- package/dist/Link/index.js +1 -1
- package/dist/{Link-Kc2RQFHc.js → Link-k1Z20GSP.js} +3 -2
- package/dist/List/index.d.ts +1 -1
- package/dist/Markdown/index.js +1 -1
- package/dist/{Markdown-NVkHi_tk.js → Markdown-BQbchOad.js} +8 -3
- package/dist/MetadataList/index.js +1 -1
- package/dist/{MetadataList-4GnMi6s9.js → MetadataList-n3YXiP4a.js} +3 -2
- package/dist/MobileNav/index.js +1 -1
- package/dist/{MobileNavToggle-TMDrnXfG.js → MobileNavToggle-_dutVRGj.js} +4 -3
- package/dist/MoreMenu/index.d.ts +1 -1
- package/dist/MoreMenu/index.js +1 -1
- package/dist/{MoreMenu-CpGEXWCd.js → MoreMenu-C2ZrGrJ-.js} +3 -2
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.js +1 -1
- package/dist/{MultiSelector-Baca6xNx.js → MultiSelector-DWKh7ePj.js} +8 -7
- package/dist/{NavHeadingSurface-j2gzMVKt.js → NavHeadingSurface-Cjp2DHPt.js} +3 -2
- package/dist/NavItem/index.d.ts +1 -1
- package/dist/NumberInput/index.d.ts +1 -1
- package/dist/NumberInput/index.js +1 -1
- package/dist/{NumberInput-BBFGZ4Fg.js → NumberInput-Bzc9v9oU.js} +5 -4
- package/dist/Outline/index.js +1 -1
- package/dist/{Outline-BgDOI3ar.js → Outline-BXu7HCHp.js} +3 -2
- package/dist/OverflowList/index.d.ts +1 -1
- package/dist/OverflowList/index.js +1 -1
- package/dist/{OverflowList-D4fC5s_q.js → OverflowList-CJZgNVSb.js} +3 -2
- package/dist/Pagination/index.d.ts +1 -1
- package/dist/Pagination/index.js +1 -1
- package/dist/{Pagination-Do_MIlo4.js → Pagination-DOw8gHjL.js} +4 -3
- package/dist/Popover/index.d.ts +1 -1
- package/dist/Popover/index.js +1 -1
- package/dist/{Popover-Bd93LlDd.js → Popover-DaGcaKHo.js} +3 -2
- package/dist/PowerSearch/index.d.ts +1 -1
- package/dist/PowerSearch/index.js +1 -1
- package/dist/{PowerSearch-DyqItMHo.js → PowerSearch-CtC5P-zt.js} +18 -17
- package/dist/ProgressBar/index.d.ts +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/Radio/index.js +1 -1
- package/dist/{RadioGroup-Dzp4qSgm.js → RadioGroup-D3TXgdwV.js} +1 -1
- package/dist/RadioList/index.d.ts +1 -1
- package/dist/RadioList/index.js +1 -1
- package/dist/{RadioList-CAIgB1j_.js → RadioList-Boj8QfPe.js} +1 -1
- package/dist/Resizable/index.js +1 -1
- package/dist/{ResizeHandle-GAmiHb0-.js → ResizeHandle-Bon51yNV.js} +3 -2
- package/dist/ScrollableArea/index.d.ts +1 -1
- package/dist/SelectableCard/index.d.ts +1 -1
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.js +1 -1
- package/dist/{Selector-B9lINQRM.js → Selector-DCrEaxnG.js} +6 -5
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.js +1 -1
- package/dist/{SideNav-DzZ12DIq.js → SideNav-YO-fBuwR.js} +7 -6
- package/dist/Slider/index.js +1 -1
- package/dist/{Slider-Cuk2ul9w.js → Slider-BFc5GTXb.js} +1 -1
- package/dist/Spinner/index.js +1 -1
- package/dist/{Spinner-ke63bQPv.js → Spinner-DEVPDsD0.js} +3 -2
- package/dist/Stepper/index.d.ts +1 -1
- package/dist/Stepper/index.js +1 -1
- package/dist/{Stepper-C68f_iJG.js → Stepper-B_CDbhCW.js} +4 -3
- package/dist/Switch/index.d.ts +1 -1
- package/dist/Switch/index.js +1 -1
- package/dist/{Switch-bnxiN6Qe.js → Switch-B0E8cZy7.js} +4 -3
- package/dist/TabList/index.d.ts +1 -1
- package/dist/TabList/index.js +1 -1
- package/dist/{TabList-8dlO0Ws6.js → TabList-DBSXa5QT.js} +3 -2
- package/dist/Table/index.d.ts +1 -1
- package/dist/Table/index.js +1 -1
- package/dist/{Table-j_DCDbcI.js → Table-DkibnUnt.js} +23 -22
- package/dist/Text/index.d.ts +1 -1
- package/dist/TextArea/index.d.ts +1 -1
- package/dist/TextArea/index.js +1 -1
- package/dist/{TextArea-Bzz_KcKT.js → TextArea-CKg-oybo.js} +9 -4
- package/dist/TextInput/index.d.ts +1 -1
- package/dist/TextInput/index.js +1 -1
- package/dist/{TextInput-givkH9HQ.js → TextInput-QnW6aidH.js} +5 -4
- package/dist/Thumbnail/index.js +1 -1
- package/dist/{Thumbnail-CZOWP5HN.js → Thumbnail-Cqt2l_zO.js} +8 -3
- package/dist/{TimeField-ByoS5s_I.js → TimeField-2QBI5tU6.js} +9 -4
- package/dist/TimeInput/index.d.ts +1 -1
- package/dist/TimeInput/index.js +1 -1
- package/dist/{TimeInput-D9kvMQso.js → TimeInput-DYAsRNAO.js} +2 -2
- package/dist/Timer/index.d.ts +1 -1
- package/dist/Timestamp/index.d.ts +1 -1
- package/dist/Timestamp/index.js +1 -1
- package/dist/{Timestamp-CEdNhKc5.js → Timestamp-CwNc1inn.js} +4 -3
- package/dist/Toast/index.js +1 -1
- package/dist/{Toast-CnZrcU-G.js → Toast-cVNBdW-q.js} +3 -2
- package/dist/ToggleButton/index.d.ts +1 -1
- package/dist/Token/index.d.ts +1 -1
- package/dist/Token/index.js +1 -1
- package/dist/{Token-DWCDMawn.js → Token-CtG_XE6z.js} +3 -2
- package/dist/Tokenizer/index.d.ts +1 -1
- package/dist/Tokenizer/index.js +1 -1
- package/dist/{Tokenizer-R0eC1BOk.js → Tokenizer-XeyJuIJ7.js} +6 -5
- package/dist/Toolbar/index.d.ts +1 -1
- package/dist/TopNav/index.d.ts +1 -1
- package/dist/TopNav/index.js +1 -1
- package/dist/{TopNav-DHunql9h.js → TopNav-zpU9w-mH.js} +5 -4
- package/dist/TreeList/index.js +1 -1
- package/dist/{TreeList-Dg5gtkOu.js → TreeList-DeknLfbQ.js} +3 -2
- package/dist/Typeahead/index.d.ts +1 -1
- package/dist/Typeahead/index.js +2 -2
- package/dist/{Typeahead-BkmCC6DX.js → Typeahead-GOdnQXcB.js} +7 -6
- package/dist/{TypeaheadMenu-CFeJCv-6.js → TypeaheadMenu-BOzaCvSb.js} +1 -1
- package/dist/avatar-group-Dcn6i_ne.js +13 -0
- package/dist/banner-Bv76b50U.js +17 -0
- package/dist/calendar-Cs2vIPsV.js +31 -0
- package/dist/carousel-BHUqW44m.js +18 -0
- package/dist/chat-mh_siWVp.js +94 -0
- package/dist/checkbox-list-uI6q4y3V.js +13 -0
- package/dist/citation-h6fyz-JH.js +7 -0
- package/dist/command-palette-DuNs5XAd.js +34 -0
- package/dist/composables/index.js +1 -1
- package/dist/{composables-DqJzanJ5.js → composables-lCxHhZQY.js} +4 -3
- package/dist/context-B8IEFCDR.js +51 -0
- package/dist/context-menu-9i6CObx3.js +7 -0
- package/dist/date-input-Bj3KSuoJ.js +38 -0
- package/dist/date-range-input-CoCiWt9_.js +18 -0
- package/dist/dialog-CNjGcdd1.js +7 -0
- package/dist/dropdown-menu-BDu4gWwQ.js +15 -0
- package/dist/field-CehUqCe0.js +15 -0
- package/dist/file-input-C2JFODtb.js +40 -0
- package/dist/{locale-BA52q_fh.js → format-CiN0Dt_H.js} +1 -30
- package/dist/{index-C3f1zsJR.d.ts → index-9tZJgo0R.d.ts} +3 -3
- package/dist/{index-9eluGe3a.d.ts → index-BBTU-TKb.d.ts} +1 -1
- package/dist/{index-BOCb89V9.d.ts → index-BO9TY87G.d.ts} +3 -3
- package/dist/{index-rbhycKiu.d.ts → index-BtuK-muv.d.ts} +5 -5
- package/dist/{index-CL8JvxHW.d.ts → index-C1zwvxPH.d.ts} +2 -2
- package/dist/{index-_VG-Bc2K.d.ts → index-CEHqYyz5.d.ts} +4 -4
- package/dist/{index-DaXzQxos.d.ts → index-CL6DNvOo.d.ts} +3 -3
- package/dist/{index-DyALKpjX.d.ts → index-CM2L3SUw.d.ts} +4 -4
- package/dist/{index-YKCx03zD.d.ts → index-COgrQZIL.d.ts} +2 -2
- package/dist/{index-Bgk1Rj2A.d.ts → index-CTjkJP4x.d.ts} +1 -1
- package/dist/{index-Be7N3B5F.d.ts → index-CpG5Wql5.d.ts} +4 -4
- package/dist/{index-rszZajcw.d.ts → index-D1JXm7Et.d.ts} +2 -2
- package/dist/{index-D4zmrP2a.d.ts → index-D44l1Esr.d.ts} +63 -63
- package/dist/{index-B-3EGjfQ.d.ts → index-Q1oG9yIT.d.ts} +2 -2
- package/dist/{index-B1eCxBCY.d.ts → index-TXcNH86P.d.ts} +1 -1
- package/dist/{index-D21zdEgS.d.ts → index-Uh-ddE5F.d.ts} +1 -1
- package/dist/{index-DkF8wxHr.d.ts → index-Ukeoz7_9.d.ts} +6 -6
- package/dist/{index-BSlzqFzV.d.ts → index-a1jCiQP7.d.ts} +5 -5
- package/dist/{index-CM8KfpBL.d.ts → index-dWlCpnua.d.ts} +3 -3
- package/dist/{index-3t5RAfNP.d.ts → index-mkbGYz8f.d.ts} +2 -2
- package/dist/{index-BjbPK91B.d.ts → index-pACjRM0E.d.ts} +8 -2
- package/dist/{index-IfiA8CSr.d.ts → index-qayqGnJT.d.ts} +2 -2
- package/dist/{index-CtYlR9Cu.d.ts → index-rdwI-mcm.d.ts} +1 -1
- package/dist/{index-BEZ4ezJk.d.ts → index-wY6dKz6c.d.ts} +2 -2
- package/dist/{index-C89cIh4E.d.ts → index-waTkqxTz.d.ts} +1 -1
- package/dist/{index-gw92L7ZG.d.ts → index-wkeCkhTi.d.ts} +2 -2
- package/dist/index.d.ts +27 -27
- package/dist/index.js +70 -71
- package/dist/info-tip-BV42YsA4.js +7 -0
- package/dist/input-DUSvqqG_.js +17 -0
- package/dist/kbd-C-D_nOfU.js +41 -0
- package/dist/keyboard-hint-KWx0-7kD.js +7 -0
- package/dist/layout-DzxSsBe8.js +17 -0
- package/dist/lightbox-BrvPVD8I.js +32 -0
- package/dist/loadCatalog-BHlH2S6H.js +2349 -0
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +4 -4
- package/dist/{useTranslator-Q85hi4qz.js → locale-BGrZM4ow.js} +31 -3
- package/dist/markdown-JcCeKquw.js +23 -0
- package/dist/metadata-list-BEmAuMYs.js +13 -0
- package/dist/more-menu-B_dod4C-.js +7 -0
- package/dist/multi-selector-B_pe6KkZ.js +48 -0
- package/dist/nav-CoUOgByC.js +50 -0
- package/dist/number-input-Dw5NSQxh.js +18 -0
- package/dist/outline-BflaJV62.js +7 -0
- package/dist/pagination-Ds3yXCJw.js +58 -0
- package/dist/popover-DxCyd_Ua.js +7 -0
- package/dist/{searchResultMessage-CFmIy2Da.js → searchResultMessage-BEqDlHdV.js} +3 -2
- package/dist/selector-qWbffnIX.js +30 -0
- package/dist/shared-aoQdb_6V.js +23 -0
- package/dist/spinner-DVia-eDf.js +7 -0
- package/dist/stepper-BOgJs2Ht.js +32 -0
- package/dist/switch-B9xwxdOU.js +7 -0
- package/dist/tab-list-B_q2n-9d.js +7 -0
- package/dist/text-area-Co4Egt6b.js +14 -0
- package/dist/text-input-BtwGEoGv.js +8 -0
- package/dist/thumbnail-BI82Ijpj.js +15 -0
- package/dist/time-input-DL1_SV7j.js +68 -0
- package/dist/timestamp-CFBVCsHF.js +17 -0
- package/dist/toast-BvAnX6Vc.js +13 -0
- package/dist/token-DcbdjdZ2.js +7 -0
- package/dist/tokenizer-DD_UBzR7.js +29 -0
- package/dist/tree-list-NZ1EZhtd.js +7 -0
- package/dist/typeahead-BzrhssJi.js +24 -0
- package/dist/{useMenuDrillIn-C5eJCuO1.js → useMenuDrillIn-uQtOSny6.js} +9 -1
- package/package.json +1 -1
- package/dist/context-CV6TrhJY.js +0 -2080
- package/dist/loadCatalog-Bulk4H7U.js +0 -143
- package/dist/upstreamMap-DrkVNtXW.js +0 -1073
- package/dist/{index-BqhgeAT4.d.ts → index-5FGt4HsB.d.ts} +1 -1
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { c as astryxMessages, l as formatIcu, u as icuPlaceholderNames } from "./context-CV6TrhJY.js";
|
|
2
|
-
import { t as upstreamMessageMap } from "./upstreamMap-DrkVNtXW.js";
|
|
3
|
-
//#region src/locale/loadCatalog.ts
|
|
4
|
-
/**
|
|
5
|
-
* 把一份原版 Astryx locale JSON 映射成 `AstryxMessages`。
|
|
6
|
-
* 内置的 `en` 和 `zh-CN` 不会被改掉。返回值要交给 `provideAstryxLocale` 的第二个参数。
|
|
7
|
-
* `unmapped` 列出每一个没写进文案树的键。
|
|
8
|
-
*/
|
|
9
|
-
function loadAstryxCatalog(locale, catalog) {
|
|
10
|
-
const messages = cloneMessages(astryxMessages.en);
|
|
11
|
-
const tree = messages;
|
|
12
|
-
const assigned = /* @__PURE__ */ new Set();
|
|
13
|
-
const unmapped = [];
|
|
14
|
-
const present = /* @__PURE__ */ new Set();
|
|
15
|
-
for (const key of Object.keys(catalog).sort()) {
|
|
16
|
-
present.add(key);
|
|
17
|
-
const read = readMessage(catalog[key]);
|
|
18
|
-
if (read.message == null) {
|
|
19
|
-
unmapped.push({
|
|
20
|
-
key,
|
|
21
|
-
message: read.invalid,
|
|
22
|
-
reason: "invalid-entry"
|
|
23
|
-
});
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
const targets = upstreamMessageMap[key];
|
|
27
|
-
if (targets == null) {
|
|
28
|
-
unmapped.push({
|
|
29
|
-
key,
|
|
30
|
-
message: read.message,
|
|
31
|
-
reason: "no-slot"
|
|
32
|
-
});
|
|
33
|
-
continue;
|
|
34
|
-
}
|
|
35
|
-
if (!writeTargets(tree, assigned, targets, read.message, locale)) unmapped.push({
|
|
36
|
-
key,
|
|
37
|
-
message: read.message,
|
|
38
|
-
reason: failureReason(targets, assigned, read.message)
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
const missingKeys = Object.keys(upstreamMessageMap).filter((key) => !present.has(key)).sort();
|
|
42
|
-
const fallbackFields = collectLeaves(tree).filter((path) => !assigned.has(path)).sort();
|
|
43
|
-
unmapped.sort((a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0);
|
|
44
|
-
return {
|
|
45
|
-
locale,
|
|
46
|
-
messages,
|
|
47
|
-
unmapped,
|
|
48
|
-
missingKeys,
|
|
49
|
-
fallbackFields
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
function writeTargets(tree, assigned, targets, message, locale) {
|
|
53
|
-
let wrote = false;
|
|
54
|
-
let names;
|
|
55
|
-
try {
|
|
56
|
-
names = icuPlaceholderNames(message);
|
|
57
|
-
} catch {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
for (const target of targets) {
|
|
61
|
-
if (assigned.has(target.path)) continue;
|
|
62
|
-
const args = target.args ?? [];
|
|
63
|
-
if (names.some((name) => !args.includes(name))) continue;
|
|
64
|
-
let value;
|
|
65
|
-
try {
|
|
66
|
-
value = target.args == null ? cleanup(formatIcu(message, {}, locale)) : bindMessage(message, target.args, locale);
|
|
67
|
-
} catch {
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
setPath(tree, target.path, value);
|
|
71
|
-
assigned.add(target.path);
|
|
72
|
-
wrote = true;
|
|
73
|
-
}
|
|
74
|
-
return wrote;
|
|
75
|
-
}
|
|
76
|
-
function failureReason(targets, assigned, message) {
|
|
77
|
-
let names;
|
|
78
|
-
try {
|
|
79
|
-
names = icuPlaceholderNames(message);
|
|
80
|
-
} catch {
|
|
81
|
-
return "unsupported-message";
|
|
82
|
-
}
|
|
83
|
-
const openTargets = targets.filter((target) => !assigned.has(target.path));
|
|
84
|
-
if (openTargets.length === 0) return "slot-taken";
|
|
85
|
-
return openTargets.some((target) => {
|
|
86
|
-
const args = target.args ?? [];
|
|
87
|
-
return names.some((name) => !args.includes(name));
|
|
88
|
-
}) ? "placeholder-mismatch" : "unsupported-message";
|
|
89
|
-
}
|
|
90
|
-
function bindMessage(message, args, locale) {
|
|
91
|
-
return (...values) => {
|
|
92
|
-
const bag = {};
|
|
93
|
-
args.forEach((name, index) => {
|
|
94
|
-
bag[name] = coerce(values[index]);
|
|
95
|
-
});
|
|
96
|
-
return cleanup(formatIcu(message, bag, locale));
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
function coerce(value) {
|
|
100
|
-
if (typeof value === "number" || typeof value === "string") return value;
|
|
101
|
-
if (value == null) return void 0;
|
|
102
|
-
return String(value);
|
|
103
|
-
}
|
|
104
|
-
function cleanup(text) {
|
|
105
|
-
return text.replace(/[ \t]{2,}/g, " ").trim();
|
|
106
|
-
}
|
|
107
|
-
function readMessage(entry) {
|
|
108
|
-
if (typeof entry === "string") return { message: entry };
|
|
109
|
-
if (entry != null && typeof entry === "object" && typeof entry.defaultMessage === "string") return { message: entry.defaultMessage };
|
|
110
|
-
return { invalid: JSON.stringify(entry) };
|
|
111
|
-
}
|
|
112
|
-
function cloneMessages(source) {
|
|
113
|
-
return cloneValue(source);
|
|
114
|
-
}
|
|
115
|
-
function cloneValue(value) {
|
|
116
|
-
if (typeof value === "function" || value == null || typeof value !== "object") return value;
|
|
117
|
-
const copy = {};
|
|
118
|
-
for (const [key, child] of Object.entries(value)) copy[key] = cloneValue(child);
|
|
119
|
-
return copy;
|
|
120
|
-
}
|
|
121
|
-
function setPath(tree, path, value) {
|
|
122
|
-
const parts = path.split(".");
|
|
123
|
-
let cursor = tree;
|
|
124
|
-
for (const part of parts.slice(0, -1)) {
|
|
125
|
-
const next = cursor[part];
|
|
126
|
-
if (next == null || typeof next === "function" || typeof next === "string") throw new Error(`消息路径不存在:${path}`);
|
|
127
|
-
cursor = next;
|
|
128
|
-
}
|
|
129
|
-
const leaf = parts[parts.length - 1];
|
|
130
|
-
if (leaf == null || !Object.hasOwn(cursor, leaf)) throw new Error(`消息路径不存在:${path}`);
|
|
131
|
-
cursor[leaf] = value;
|
|
132
|
-
}
|
|
133
|
-
function collectLeaves(tree, prefix = "") {
|
|
134
|
-
const paths = [];
|
|
135
|
-
for (const [key, value] of Object.entries(tree)) {
|
|
136
|
-
const path = prefix === "" ? key : `${prefix}.${key}`;
|
|
137
|
-
if (typeof value === "string" || typeof value === "function") paths.push(path);
|
|
138
|
-
else paths.push(...collectLeaves(value, path));
|
|
139
|
-
}
|
|
140
|
-
return paths;
|
|
141
|
-
}
|
|
142
|
-
//#endregion
|
|
143
|
-
export { loadAstryxCatalog as t };
|