@10x-media/fields 0.1.0-beta.0 → 0.1.0-beta.10
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/CHANGELOG.md +173 -0
- package/README.md +8 -4
- package/dist/exports/client.d.ts +10 -1
- package/dist/exports/client.js +9 -1
- package/dist/exports/color-utils.d.ts +4 -2
- package/dist/exports/color-utils.js +3 -1
- package/dist/exports/color.d.ts +5 -2
- package/dist/exports/color.js +4 -1
- package/dist/exports/encrypted.d.ts +7 -4
- package/dist/exports/encrypted.js +6 -3
- package/dist/exports/icon-adapters/radix.d.ts +2 -2
- package/dist/exports/icon-adapters/radix.js +2 -2
- package/dist/exports/icon-react.d.ts +2 -2
- package/dist/exports/icon.d.ts +6 -2
- package/dist/exports/icon.js +6 -2
- package/dist/exports/measurement-utils.d.ts +9 -0
- package/dist/exports/measurement-utils.js +8 -0
- package/dist/exports/measurement.d.ts +11 -0
- package/dist/exports/measurement.js +10 -0
- package/dist/exports/phone-utils.d.ts +4 -0
- package/dist/exports/phone-utils.js +4 -0
- package/dist/exports/phone.d.ts +6 -0
- package/dist/exports/phone.js +3 -0
- package/dist/exports/rsc.d.ts +5 -1
- package/dist/exports/rsc.js +5 -1
- package/dist/exports/types.d.ts +3 -2
- package/dist/fields/color/client/ColorField.d.ts +2 -0
- package/dist/fields/color/client/ColorField.js +35 -288
- package/dist/fields/color/client/ColorField.js.map +1 -1
- package/dist/fields/color/client/ColorInput.d.ts +44 -0
- package/dist/fields/color/client/ColorInput.js +374 -0
- package/dist/fields/color/client/ColorInput.js.map +1 -0
- package/dist/fields/color/client/ColorPickerPanel.d.ts +3 -1
- package/dist/fields/color/client/ColorPickerPanel.js +31 -5
- package/dist/fields/color/client/ColorPickerPanel.js.map +1 -1
- package/dist/fields/color/client/colorField.css +30 -0
- package/dist/fields/color/colorField.d.ts +9 -2
- package/dist/fields/color/colorField.js +68 -15
- package/dist/fields/color/colorField.js.map +1 -1
- package/dist/fields/color/engine/index.d.ts +2 -1
- package/dist/fields/color/engine/scheme.d.ts +13 -0
- package/dist/fields/color/engine/scheme.js +12 -0
- package/dist/fields/color/engine/scheme.js.map +1 -0
- package/dist/fields/color/options.d.ts +5 -4
- package/dist/fields/color/options.js.map +1 -1
- package/dist/fields/color/paths.d.ts +1 -0
- package/dist/fields/color/paths.js +32 -0
- package/dist/fields/color/paths.js.map +1 -0
- package/dist/fields/color/presetChip.js +10 -9
- package/dist/fields/color/presetChip.js.map +1 -1
- package/dist/fields/color/presetReference.d.ts +13 -0
- package/dist/fields/color/presetReference.js +94 -0
- package/dist/fields/color/presetReference.js.map +1 -0
- package/dist/fields/color/presetsFromArray.d.ts +30 -0
- package/dist/fields/color/presetsFromArray.js +58 -0
- package/dist/fields/color/presetsFromArray.js.map +1 -0
- package/dist/fields/color/presetsFromDoc.js +1 -23
- package/dist/fields/color/presetsFromDoc.js.map +1 -1
- package/dist/fields/color/resolvePresets.d.ts +2 -2
- package/dist/fields/color/resolvePresets.js +38 -8
- package/dist/fields/color/resolvePresets.js.map +1 -1
- package/dist/fields/color/schemeValue.js +30 -0
- package/dist/fields/color/schemeValue.js.map +1 -0
- package/dist/fields/color/server/ColorCell.js +9 -3
- package/dist/fields/color/server/ColorCell.js.map +1 -1
- package/dist/fields/color/server/colorCell.css +5 -0
- package/dist/fields/color/valueIssue.js +23 -0
- package/dist/fields/color/valueIssue.js.map +1 -0
- package/dist/fields/encrypted/boot.js +2 -1
- package/dist/fields/encrypted/boot.js.map +1 -1
- package/dist/fields/encrypted/components/EncryptedInput.js +4 -1
- package/dist/fields/encrypted/components/EncryptedInput.js.map +1 -1
- package/dist/fields/encrypted/components/EncryptedTextarea.js +6 -2
- package/dist/fields/encrypted/components/EncryptedTextarea.js.map +1 -1
- package/dist/fields/encrypted/components/ProtectedCell.d.ts +15 -6
- package/dist/fields/encrypted/components/ProtectedCell.js +37 -8
- package/dist/fields/encrypted/components/ProtectedCell.js.map +1 -1
- package/dist/fields/encrypted/components/ProtectedField.css +134 -39
- package/dist/fields/encrypted/components/ProtectedField.d.ts +3 -0
- package/dist/fields/encrypted/components/ProtectedField.js +14 -0
- package/dist/fields/encrypted/components/ProtectedField.js.map +1 -1
- package/dist/fields/encrypted/components/WriteOnlyActions.js +65 -0
- package/dist/fields/encrypted/components/WriteOnlyActions.js.map +1 -0
- package/dist/fields/encrypted/components/WriteOnlyField.js +286 -0
- package/dist/fields/encrypted/components/WriteOnlyField.js.map +1 -0
- package/dist/fields/encrypted/components/writeOnlyIntent.js +69 -0
- package/dist/fields/encrypted/components/writeOnlyIntent.js.map +1 -0
- package/dist/fields/encrypted/crypto/wire.d.ts +10 -1
- package/dist/fields/encrypted/crypto/wire.js +1 -1
- package/dist/fields/encrypted/encryptedField.js +63 -6
- package/dist/fields/encrypted/encryptedField.js.map +1 -1
- package/dist/fields/encrypted/generateSecret.d.ts +10 -0
- package/dist/fields/encrypted/generateSecret.js +41 -0
- package/dist/fields/encrypted/generateSecret.js.map +1 -0
- package/dist/fields/encrypted/hint.js +67 -0
- package/dist/fields/encrypted/hint.js.map +1 -0
- package/dist/fields/encrypted/hooks.js +59 -31
- package/dist/fields/encrypted/hooks.js.map +1 -1
- package/dist/fields/encrypted/queryRewrite.d.ts +10 -2
- package/dist/fields/encrypted/queryRewrite.js +34 -8
- package/dist/fields/encrypted/queryRewrite.js.map +1 -1
- package/dist/fields/encrypted/rawRead.d.ts +24 -0
- package/dist/fields/encrypted/rawRead.js +40 -0
- package/dist/fields/encrypted/rawRead.js.map +1 -0
- package/dist/fields/encrypted/scan.js +21 -4
- package/dist/fields/encrypted/scan.js.map +1 -1
- package/dist/fields/encrypted/types.d.ts +67 -2
- package/dist/fields/encrypted/types.js +8 -1
- package/dist/fields/encrypted/types.js.map +1 -1
- package/dist/fields/encrypted/utils/decryptAllData.js +2 -2
- package/dist/fields/encrypted/utils/decryptAllData.js.map +1 -1
- package/dist/fields/encrypted/utils/decryptFieldValue.d.ts +30 -0
- package/dist/fields/encrypted/utils/decryptFieldValue.js +56 -0
- package/dist/fields/encrypted/utils/decryptFieldValue.js.map +1 -0
- package/dist/fields/encrypted/utils/readEncryptedField.d.ts +51 -0
- package/dist/fields/encrypted/utils/readEncryptedField.js +96 -0
- package/dist/fields/encrypted/utils/readEncryptedField.js.map +1 -0
- package/dist/fields/icon/adapters/lucide/generated/manifest.js.map +1 -1
- package/dist/fields/icon/adapters/lucide/generated/nodes.js.map +1 -1
- package/dist/fields/icon/adapters/radix/adapter.js +7 -0
- package/dist/fields/icon/adapters/radix/adapter.js.map +1 -1
- package/dist/fields/icon/adapters/radix/client.d.ts +3 -2
- package/dist/fields/icon/adapters/radix/client.js +3 -2
- package/dist/fields/icon/adapters/radix/client.js.map +1 -1
- package/dist/fields/icon/adapters/radix/generated/manifest.js.map +1 -1
- package/dist/fields/icon/adapters/radix/generated/nodes.js +3625 -0
- package/dist/fields/icon/adapters/radix/generated/nodes.js.map +1 -0
- package/dist/fields/icon/adapters/tabler/generated/manifest.js.map +1 -1
- package/dist/fields/icon/adapters/tabler/generated/nodes.js.map +1 -1
- package/dist/fields/icon/client/DrawerGlyph.js +34 -17
- package/dist/fields/icon/client/DrawerGlyph.js.map +1 -1
- package/dist/fields/icon/client/IconDrawerContent.js +9 -45
- package/dist/fields/icon/client/IconDrawerContent.js.map +1 -1
- package/dist/fields/icon/client/IconFieldClient.d.ts +7 -0
- package/dist/fields/icon/client/IconFieldClient.js +15 -7
- package/dist/fields/icon/client/IconFieldClient.js.map +1 -1
- package/dist/fields/icon/client/IconGridCell.js +67 -0
- package/dist/fields/icon/client/IconGridCell.js.map +1 -0
- package/dist/fields/icon/client/icon-field.css +12 -2
- package/dist/fields/icon/codegen/emit.js +5 -4
- package/dist/fields/icon/codegen/emit.js.map +1 -1
- package/dist/fields/icon/codegen/generate.js +32 -6
- package/dist/fields/icon/codegen/generate.js.map +1 -1
- package/dist/fields/icon/layers/coalesce.js +41 -0
- package/dist/fields/icon/layers/coalesce.js.map +1 -0
- package/dist/fields/icon/layers/manifestCache.d.ts +6 -0
- package/dist/fields/icon/layers/manifestCache.js +49 -0
- package/dist/fields/icon/layers/manifestCache.js.map +1 -0
- package/dist/fields/icon/layers/resolve.d.ts +20 -0
- package/dist/fields/icon/layers/resolve.js +63 -0
- package/dist/fields/icon/layers/resolve.js.map +1 -0
- package/dist/fields/icon/layers/upload.d.ts +52 -0
- package/dist/fields/icon/layers/upload.js +116 -0
- package/dist/fields/icon/layers/upload.js.map +1 -0
- package/dist/fields/icon/plugin.js +24 -0
- package/dist/fields/icon/plugin.js.map +1 -1
- package/dist/fields/icon/react/createIcon.d.ts +5 -0
- package/dist/fields/icon/react/createIcon.js +22 -4
- package/dist/fields/icon/react/createIcon.js.map +1 -1
- package/dist/fields/icon/react/createRscIcon.js +22 -1
- package/dist/fields/icon/react/createRscIcon.js.map +1 -1
- package/dist/fields/icon/react/resolveRendered.js +21 -0
- package/dist/fields/icon/react/resolveRendered.js.map +1 -0
- package/dist/fields/icon/react/types.d.ts +15 -1
- package/dist/fields/icon/rsc/IconCell.d.ts +2 -2
- package/dist/fields/icon/rsc/IconCell.js +12 -5
- package/dist/fields/icon/rsc/IconCell.js.map +1 -1
- package/dist/fields/icon/rsc/IconFieldServer.js +16 -2
- package/dist/fields/icon/rsc/IconFieldServer.js.map +1 -1
- package/dist/fields/icon/rsc/IconLibrarySelectServer.js +1 -1
- package/dist/fields/icon/rsc/IconLibrarySelectServer.js.map +1 -1
- package/dist/fields/icon/server/endpoint.d.ts +12 -0
- package/dist/fields/icon/server/endpoint.js +52 -0
- package/dist/fields/icon/server/endpoint.js.map +1 -0
- package/dist/fields/icon/server/manifestCache.js +9 -4
- package/dist/fields/icon/server/manifestCache.js.map +1 -1
- package/dist/fields/icon/server/resolveIconMeta.js +31 -0
- package/dist/fields/icon/server/resolveIconMeta.js.map +1 -0
- package/dist/fields/icon/server/validate.js +5 -2
- package/dist/fields/icon/server/validate.js.map +1 -1
- package/dist/fields/icon/shared/adapterComponents.d.ts +3 -2
- package/dist/fields/icon/shared/iconLabel.js +26 -0
- package/dist/fields/icon/shared/iconLabel.js.map +1 -0
- package/dist/fields/measurement/client/MeasurementCell.d.ts +18 -0
- package/dist/fields/measurement/client/MeasurementCell.js +47 -0
- package/dist/fields/measurement/client/MeasurementCell.js.map +1 -0
- package/dist/fields/measurement/client/MeasurementField.d.ts +13 -0
- package/dist/fields/measurement/client/MeasurementField.js +70 -0
- package/dist/fields/measurement/client/MeasurementField.js.map +1 -0
- package/dist/fields/measurement/client/MeasurementInput.d.ts +42 -0
- package/dist/fields/measurement/client/MeasurementInput.js +327 -0
- package/dist/fields/measurement/client/MeasurementInput.js.map +1 -0
- package/dist/fields/measurement/client/MeasurementUnitsProvider.d.ts +24 -0
- package/dist/fields/measurement/client/MeasurementUnitsProvider.js +61 -0
- package/dist/fields/measurement/client/MeasurementUnitsProvider.js.map +1 -0
- package/dist/fields/measurement/client/editModel.js +124 -0
- package/dist/fields/measurement/client/editModel.js.map +1 -0
- package/dist/fields/measurement/client/measurementCell.css +4 -0
- package/dist/fields/measurement/client/measurementField.css +215 -0
- package/dist/fields/measurement/client/useMeasurementModel.d.ts +19 -0
- package/dist/fields/measurement/client/useMeasurementModel.js +85 -0
- package/dist/fields/measurement/client/useMeasurementModel.js.map +1 -0
- package/dist/fields/measurement/engine/convert.d.ts +8 -0
- package/dist/fields/measurement/engine/convert.js +21 -0
- package/dist/fields/measurement/engine/convert.js.map +1 -0
- package/dist/fields/measurement/engine/format.d.ts +37 -0
- package/dist/fields/measurement/engine/format.js +156 -0
- package/dist/fields/measurement/engine/format.js.map +1 -0
- package/dist/fields/measurement/engine/locale.d.ts +25 -0
- package/dist/fields/measurement/engine/locale.js +79 -0
- package/dist/fields/measurement/engine/locale.js.map +1 -0
- package/dist/fields/measurement/engine/precision.d.ts +34 -0
- package/dist/fields/measurement/engine/precision.js +63 -0
- package/dist/fields/measurement/engine/precision.js.map +1 -0
- package/dist/fields/measurement/engine/registry.d.ts +55 -0
- package/dist/fields/measurement/engine/registry.js +117 -0
- package/dist/fields/measurement/engine/registry.js.map +1 -0
- package/dist/fields/measurement/engine/units.d.ts +178 -0
- package/dist/fields/measurement/engine/units.js +198 -0
- package/dist/fields/measurement/engine/units.js.map +1 -0
- package/dist/fields/measurement/measurementField.d.ts +17 -0
- package/dist/fields/measurement/measurementField.js +139 -0
- package/dist/fields/measurement/measurementField.js.map +1 -0
- package/dist/fields/measurement/options.d.ts +76 -0
- package/dist/fields/measurement/options.js +9 -0
- package/dist/fields/measurement/options.js.map +1 -0
- package/dist/fields/measurement/presets.d.ts +117 -0
- package/dist/fields/measurement/presets.js +136 -0
- package/dist/fields/measurement/presets.js.map +1 -0
- package/dist/fields/measurement/server/MeasurementCellServer.d.ts +21 -0
- package/dist/fields/measurement/server/MeasurementCellServer.js +53 -0
- package/dist/fields/measurement/server/MeasurementCellServer.js.map +1 -0
- package/dist/fields/measurement/server/MeasurementFieldServer.d.ts +16 -0
- package/dist/fields/measurement/server/MeasurementFieldServer.js +45 -0
- package/dist/fields/measurement/server/MeasurementFieldServer.js.map +1 -0
- package/dist/fields/measurement/server/getUserUnits.js +39 -0
- package/dist/fields/measurement/server/getUserUnits.js.map +1 -0
- package/dist/fields/measurement/server/resolvePrecisionSafe.js +24 -0
- package/dist/fields/measurement/server/resolvePrecisionSafe.js.map +1 -0
- package/dist/fields/measurement/server/resolveRegistryDefault.js +26 -0
- package/dist/fields/measurement/server/resolveRegistryDefault.js.map +1 -0
- package/dist/fields/phoneNumber/client/CountryFlag.d.ts +16 -0
- package/dist/fields/phoneNumber/client/CountryFlag.js +40 -0
- package/dist/fields/phoneNumber/client/CountryFlag.js.map +1 -0
- package/dist/fields/phoneNumber/client/CountryPicker.d.ts +21 -0
- package/dist/fields/phoneNumber/client/CountryPicker.js +255 -0
- package/dist/fields/phoneNumber/client/CountryPicker.js.map +1 -0
- package/dist/fields/phoneNumber/client/PhoneNumberField.d.ts +26 -0
- package/dist/fields/phoneNumber/client/PhoneNumberField.js +318 -0
- package/dist/fields/phoneNumber/client/PhoneNumberField.js.map +1 -0
- package/dist/fields/phoneNumber/client/editModel.js +86 -0
- package/dist/fields/phoneNumber/client/editModel.js.map +1 -0
- package/dist/fields/phoneNumber/client/phoneNumberField.css +305 -0
- package/dist/fields/phoneNumber/engine/countries.d.ts +36 -0
- package/dist/fields/phoneNumber/engine/countries.js +68 -0
- package/dist/fields/phoneNumber/engine/countries.js.map +1 -0
- package/dist/fields/phoneNumber/engine/draft.d.ts +13 -0
- package/dist/fields/phoneNumber/engine/draft.js +72 -0
- package/dist/fields/phoneNumber/engine/draft.js.map +1 -0
- package/dist/fields/phoneNumber/engine/metadata.d.ts +11 -0
- package/dist/fields/phoneNumber/engine/metadata.js +32 -0
- package/dist/fields/phoneNumber/engine/metadata.js.map +1 -0
- package/dist/fields/phoneNumber/engine/phone.d.ts +37 -0
- package/dist/fields/phoneNumber/engine/phone.js +59 -0
- package/dist/fields/phoneNumber/engine/phone.js.map +1 -0
- package/dist/fields/phoneNumber/options.d.ts +72 -0
- package/dist/fields/phoneNumber/options.js +37 -0
- package/dist/fields/phoneNumber/options.js.map +1 -0
- package/dist/fields/phoneNumber/phoneNumberField.d.ts +14 -0
- package/dist/fields/phoneNumber/phoneNumberField.js +167 -0
- package/dist/fields/phoneNumber/phoneNumberField.js.map +1 -0
- package/dist/fields/phoneNumber/server/PhoneNumberCellServer.d.ts +19 -0
- package/dist/fields/phoneNumber/server/PhoneNumberCellServer.js +73 -0
- package/dist/fields/phoneNumber/server/PhoneNumberCellServer.js.map +1 -0
- package/dist/fields/phoneNumber/server/PhoneNumberFieldServer.d.ts +16 -0
- package/dist/fields/phoneNumber/server/PhoneNumberFieldServer.js +57 -0
- package/dist/fields/phoneNumber/server/PhoneNumberFieldServer.js.map +1 -0
- package/dist/fields/phoneNumber/server/flagsEndpoint.js +51 -0
- package/dist/fields/phoneNumber/server/flagsEndpoint.js.map +1 -0
- package/dist/fields/phoneNumber/server/readPhoneOptions.js +18 -0
- package/dist/fields/phoneNumber/server/readPhoneOptions.js.map +1 -0
- package/dist/fields/phoneNumber/server/resolvePhoneOptionsSafe.js +33 -0
- package/dist/fields/phoneNumber/server/resolvePhoneOptionsSafe.js.map +1 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/dist/translations/ar.js +62 -0
- package/dist/translations/ar.js.map +1 -0
- package/dist/translations/de.js +19 -1
- package/dist/translations/de.js.map +1 -1
- package/dist/translations/en.js +19 -1
- package/dist/translations/en.js.map +1 -1
- package/dist/translations/es.js +62 -0
- package/dist/translations/es.js.map +1 -0
- package/dist/translations/fr.js +62 -0
- package/dist/translations/fr.js.map +1 -0
- package/dist/translations/id.js +62 -0
- package/dist/translations/id.js.map +1 -0
- package/dist/translations/index.d.ts +10 -1
- package/dist/translations/index.js +19 -1
- package/dist/translations/index.js.map +1 -1
- package/dist/translations/keys.d.ts +19 -1
- package/dist/translations/keys.js +20 -2
- package/dist/translations/keys.js.map +1 -1
- package/dist/translations/ko.js +62 -0
- package/dist/translations/ko.js.map +1 -0
- package/dist/translations/pt.js +62 -0
- package/dist/translations/pt.js.map +1 -0
- package/dist/translations/ru.js +62 -0
- package/dist/translations/ru.js.map +1 -0
- package/dist/translations/uk.js +62 -0
- package/dist/translations/uk.js.map +1 -0
- package/dist/translations/zh.js +62 -0
- package/dist/translations/zh.js.map +1 -0
- package/dist/types.d.ts +165 -8
- package/dist/utils/resolveStaticLabel.js +13 -0
- package/dist/utils/resolveStaticLabel.js.map +1 -0
- package/package.json +31 -7
- package/dist/fields/icon/rsc/resolveStaticLabel.js +0 -16
- package/dist/fields/icon/rsc/resolveStaticLabel.js.map +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { keys } from "./keys.js";
|
|
2
|
+
//#region src/translations/zh.ts
|
|
3
|
+
const zh = {
|
|
4
|
+
[keys.pluginName]: "Fields",
|
|
5
|
+
[keys.presets]: "预设",
|
|
6
|
+
[keys.fieldIconLabel]: "图标",
|
|
7
|
+
[keys.fieldIconLibraryLabel]: "图标库",
|
|
8
|
+
[keys.selectIcon]: "选择图标",
|
|
9
|
+
[keys.clearIcon]: "清除图标",
|
|
10
|
+
[keys.resultsCount]: "{{count}} 个图标",
|
|
11
|
+
[keys.textInputPlaceholder]: "library:icon-name",
|
|
12
|
+
[keys.invalidIconLibrary]: "未知图标库:{{library}}",
|
|
13
|
+
[keys.invalidIconName]: "图标库 {{library}} 中不存在图标 \"{{name}}\"",
|
|
14
|
+
[keys.invalidIconLibraryValue]: "未注册的图标库:{{value}}",
|
|
15
|
+
[keys.searchIcons]: "搜索图标",
|
|
16
|
+
[keys.noIconsFound]: "未找到图标",
|
|
17
|
+
[keys.browseAll]: "浏览全部",
|
|
18
|
+
[keys.recent]: "最近使用",
|
|
19
|
+
[keys.allIcons]: "全部图标",
|
|
20
|
+
[keys.iconCategories]: "图标分类",
|
|
21
|
+
[keys.iconGrid]: "图标",
|
|
22
|
+
[keys.libraryUnavailable]: "该图标库已不可用,请选择替代项。",
|
|
23
|
+
[keys.iconUnavailable]: "不可用",
|
|
24
|
+
[keys.missingPreset]: "预设缺失",
|
|
25
|
+
[keys.preset]: "预设",
|
|
26
|
+
[keys.missingPresetHint]: "该预设已不存在,请选择替代项。",
|
|
27
|
+
[keys.invalidColor]: "无效颜色",
|
|
28
|
+
[keys.pickColor]: "选择颜色",
|
|
29
|
+
[keys.clearColor]: "清除颜色",
|
|
30
|
+
[keys.eyedropperPick]: "从屏幕取色",
|
|
31
|
+
[keys.hue]: "色相",
|
|
32
|
+
[keys.opacity]: "不透明度",
|
|
33
|
+
[keys.saturationBrightness]: "饱和度与亮度",
|
|
34
|
+
[keys.format]: "格式",
|
|
35
|
+
[keys.reveal]: "显示",
|
|
36
|
+
[keys.conceal]: "隐藏",
|
|
37
|
+
[keys.showValue]: "显示值",
|
|
38
|
+
[keys.hideValue]: "隐藏值",
|
|
39
|
+
[keys.encryptedValue]: "加密值",
|
|
40
|
+
[keys.replaceValue]: "替换值",
|
|
41
|
+
[keys.clearValue]: "清除值",
|
|
42
|
+
[keys.undoClear]: "撤销清除",
|
|
43
|
+
[keys.clearedOnSave]: "保存时将被移除",
|
|
44
|
+
[keys.generateValue]: "生成新值",
|
|
45
|
+
[keys.writeOnlyValue]: "只写加密值",
|
|
46
|
+
[keys.secretNotSet]: "未设置",
|
|
47
|
+
[keys.selectUnit]: "选择单位",
|
|
48
|
+
[keys.measurementBelowMin]: "不得少于 {{min}}",
|
|
49
|
+
[keys.measurementAboveMax]: "不得超过 {{max}}",
|
|
50
|
+
[keys.selectCountry]: "选择国家/地区",
|
|
51
|
+
[keys.searchCountries]: "搜索国家/地区",
|
|
52
|
+
[keys.noCountriesFound]: "未找到国家/地区",
|
|
53
|
+
[keys.phoneRequired]: "此字段为必填项。",
|
|
54
|
+
[keys.invalidPhoneNumber]: "请输入有效的电话号码。",
|
|
55
|
+
[keys.phoneNotMobile]: "请输入手机号码。",
|
|
56
|
+
[keys.clearPhoneNumber]: "清除电话号码",
|
|
57
|
+
[keys.phoneCountryFor]: "国家/地区:{{country}}"
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { zh };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=zh.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zh.js","names":[],"sources":["../../src/translations/zh.ts"],"sourcesContent":["import { keys, type TranslationKey } from './keys'\n\nexport const zh: Record<TranslationKey, string> = {\n\t[keys.pluginName]: 'Fields',\n\t[keys.presets]: '预设',\n\t[keys.fieldIconLabel]: '图标',\n\t[keys.fieldIconLibraryLabel]: '图标库',\n\t[keys.selectIcon]: '选择图标',\n\t[keys.clearIcon]: '清除图标',\n\t[keys.resultsCount]: '{{count}} 个图标',\n\t[keys.textInputPlaceholder]: 'library:icon-name',\n\t[keys.invalidIconLibrary]: '未知图标库:{{library}}',\n\t[keys.invalidIconName]: '图标库 {{library}} 中不存在图标 \"{{name}}\"',\n\t[keys.invalidIconLibraryValue]: '未注册的图标库:{{value}}',\n\t[keys.searchIcons]: '搜索图标',\n\t[keys.noIconsFound]: '未找到图标',\n\t[keys.browseAll]: '浏览全部',\n\t[keys.recent]: '最近使用',\n\t[keys.allIcons]: '全部图标',\n\t[keys.iconCategories]: '图标分类',\n\t[keys.iconGrid]: '图标',\n\t[keys.libraryUnavailable]: '该图标库已不可用,请选择替代项。',\n\t[keys.iconUnavailable]: '不可用',\n\t[keys.missingPreset]: '预设缺失',\n\t[keys.preset]: '预设',\n\t[keys.missingPresetHint]: '该预设已不存在,请选择替代项。',\n\t[keys.invalidColor]: '无效颜色',\n\t[keys.pickColor]: '选择颜色',\n\t[keys.clearColor]: '清除颜色',\n\t[keys.eyedropperPick]: '从屏幕取色',\n\t[keys.hue]: '色相',\n\t[keys.opacity]: '不透明度',\n\t[keys.saturationBrightness]: '饱和度与亮度',\n\t[keys.format]: '格式',\n\t[keys.reveal]: '显示',\n\t[keys.conceal]: '隐藏',\n\t[keys.showValue]: '显示值',\n\t[keys.hideValue]: '隐藏值',\n\t[keys.encryptedValue]: '加密值',\n\t[keys.replaceValue]: '替换值',\n\t[keys.clearValue]: '清除值',\n\t[keys.undoClear]: '撤销清除',\n\t[keys.clearedOnSave]: '保存时将被移除',\n\t[keys.generateValue]: '生成新值',\n\t[keys.writeOnlyValue]: '只写加密值',\n\t[keys.secretNotSet]: '未设置',\n\t[keys.selectUnit]: '选择单位',\n\t[keys.measurementBelowMin]: '不得少于 {{min}}',\n\t[keys.measurementAboveMax]: '不得超过 {{max}}',\n\t[keys.selectCountry]: '选择国家/地区',\n\t[keys.searchCountries]: '搜索国家/地区',\n\t[keys.noCountriesFound]: '未找到国家/地区',\n\t[keys.phoneRequired]: '此字段为必填项。',\n\t[keys.invalidPhoneNumber]: '请输入有效的电话号码。',\n\t[keys.phoneNotMobile]: '请输入手机号码。',\n\t[keys.clearPhoneNumber]: '清除电话号码',\n\t[keys.phoneCountryFor]: '国家/地区:{{country}}',\n}\n"],"mappings":";;AAEA,MAAa,KAAqC;EAChD,KAAK,aAAa;EAClB,KAAK,UAAU;EACf,KAAK,iBAAiB;EACtB,KAAK,wBAAwB;EAC7B,KAAK,aAAa;EAClB,KAAK,YAAY;EACjB,KAAK,eAAe;EACpB,KAAK,uBAAuB;EAC5B,KAAK,qBAAqB;EAC1B,KAAK,kBAAkB;EACvB,KAAK,0BAA0B;EAC/B,KAAK,cAAc;EACnB,KAAK,eAAe;EACpB,KAAK,YAAY;EACjB,KAAK,SAAS;EACd,KAAK,WAAW;EAChB,KAAK,iBAAiB;EACtB,KAAK,WAAW;EAChB,KAAK,qBAAqB;EAC1B,KAAK,kBAAkB;EACvB,KAAK,gBAAgB;EACrB,KAAK,SAAS;EACd,KAAK,oBAAoB;EACzB,KAAK,eAAe;EACpB,KAAK,YAAY;EACjB,KAAK,aAAa;EAClB,KAAK,iBAAiB;EACtB,KAAK,MAAM;EACX,KAAK,UAAU;EACf,KAAK,uBAAuB;EAC5B,KAAK,SAAS;EACd,KAAK,SAAS;EACd,KAAK,UAAU;EACf,KAAK,YAAY;EACjB,KAAK,YAAY;EACjB,KAAK,iBAAiB;EACtB,KAAK,eAAe;EACpB,KAAK,aAAa;EAClB,KAAK,YAAY;EACjB,KAAK,gBAAgB;EACrB,KAAK,gBAAgB;EACrB,KAAK,iBAAiB;EACtB,KAAK,eAAe;EACpB,KAAK,aAAa;EAClB,KAAK,sBAAsB;EAC3B,KAAK,sBAAsB;EAC3B,KAAK,gBAAgB;EACrB,KAAK,kBAAkB;EACvB,KAAK,mBAAmB;EACxB,KAAK,gBAAgB;EACrB,KAAK,qBAAqB;EAC1B,KAAK,iBAAiB;EACtB,KAAK,mBAAmB;EACxB,KAAK,kBAAkB;AACzB"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MeasurementPrecision, PrecisionMode } from "./fields/measurement/engine/precision.js";
|
|
2
|
+
import { MeasurementUnitId } from "./fields/measurement/engine/units.js";
|
|
3
|
+
import { MetadataSet } from "./fields/phoneNumber/engine/metadata.js";
|
|
4
|
+
import { CountryCode, PhoneFormat, PhoneValidationMode } from "./fields/phoneNumber/engine/phone.js";
|
|
5
|
+
import { PhoneFlagMode } from "./fields/phoneNumber/options.js";
|
|
6
|
+
import { Payload, PayloadRequest, StaticLabel } from "payload";
|
|
2
7
|
|
|
3
8
|
//#region src/types.d.ts
|
|
4
9
|
/** Args passed to async per-document resolvers (color presets, icon availability). */
|
|
@@ -7,10 +12,18 @@ type FieldsResolverArgs = {
|
|
|
7
12
|
data?: Record<string, unknown>;
|
|
8
13
|
siblingData?: Record<string, unknown>;
|
|
9
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* A color that varies by color scheme. Consumers read members individually, so
|
|
17
|
+
* an optional third scheme stays a non-breaking addition.
|
|
18
|
+
*/
|
|
19
|
+
type ColorSchemeValue = {
|
|
20
|
+
light: string;
|
|
21
|
+
dark: string;
|
|
22
|
+
};
|
|
10
23
|
/** A color preset: bare CSS string, or a keyed entry usable in linked mode. */
|
|
11
24
|
type ColorPreset = string | {
|
|
12
25
|
key: string;
|
|
13
|
-
value: string;
|
|
26
|
+
value: string | ColorSchemeValue;
|
|
14
27
|
label?: StaticLabel;
|
|
15
28
|
};
|
|
16
29
|
/** Stored CSS color format for colorField(). */
|
|
@@ -20,16 +33,103 @@ type IconMeta = {
|
|
|
20
33
|
name: string;
|
|
21
34
|
tags: string[];
|
|
22
35
|
categories: string[];
|
|
36
|
+
/**
|
|
37
|
+
* Human-readable name shown to editors, replacing the one derived from `name`.
|
|
38
|
+
* Supply it wherever the name is a code rather than words: `HUN` reads as `Hun`
|
|
39
|
+
* without one, and a screen reader announces that. Omit it and every existing
|
|
40
|
+
* manifest keeps its derived label unchanged.
|
|
41
|
+
*/
|
|
42
|
+
label?: StaticLabel;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* What an icon adapter's async resolvers receive. `req` is optional because Payload
|
|
46
|
+
* renders list cells without one (`DefaultServerCellComponentProps` carries `payload`
|
|
47
|
+
* and `i18n` only), so a resolver must not depend on it being present.
|
|
48
|
+
*/
|
|
49
|
+
type IconLayerContext = {
|
|
50
|
+
payload: Payload;
|
|
51
|
+
req?: PayloadRequest;
|
|
23
52
|
};
|
|
24
53
|
/** Lazily loaded icon library manifest. */
|
|
25
54
|
type IconManifest = {
|
|
26
55
|
icons: IconMeta[];
|
|
27
56
|
categories: string[];
|
|
28
57
|
};
|
|
29
|
-
/**
|
|
30
|
-
|
|
58
|
+
/**
|
|
59
|
+
* One SVG child of a glyph: an element tag and its attribute map, matching lucide-static's
|
|
60
|
+
* icon-nodes shape. An optional third element carries children, so a glyph needing `<g>`
|
|
61
|
+
* or `<defs>` is expressible; the two-element form every generated manifest already uses
|
|
62
|
+
* keeps parsing exactly as before.
|
|
63
|
+
*/
|
|
64
|
+
type IconNode = [tag: string, attrs: Record<string, string>] | [tag: string, attrs: Record<string, string>, children: IconNode[]];
|
|
31
65
|
/** An icon library's glyphs keyed by name, so the drawer renders inline SVG in bulk instead of per-icon imports. */
|
|
32
66
|
type IconNodeMap = Record<string, IconNode[]>;
|
|
67
|
+
/**
|
|
68
|
+
* How a layer's glyphs paint in the admin. Every variant carries importMap path
|
|
69
|
+
* strings, so a layer stays serializable inside a field config.
|
|
70
|
+
*/
|
|
71
|
+
type IconRenderStrategy = /** Bulk node-data rendered as inline SVG. `load` resolves `() => Promise<IconNodeMap>`. */{
|
|
72
|
+
type: 'nodes';
|
|
73
|
+
canvas?: IconCanvas;
|
|
74
|
+
load: string;
|
|
75
|
+
} /** Bulk raw SVG, sprited once client-side. `load` resolves `() => Promise<Record<string, string>>`. */ | {
|
|
76
|
+
type: 'svg';
|
|
77
|
+
load: string;
|
|
78
|
+
} /** One image per icon. `resolve` resolves `(name: string) => null | string`. */ | {
|
|
79
|
+
type: 'url';
|
|
80
|
+
resolve: string;
|
|
81
|
+
} /** A component per icon, for libraries that ship their own lazy glyph components. */ | {
|
|
82
|
+
type: 'component';
|
|
83
|
+
Icon: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* The SVG canvas a library's glyphs are drawn on. Defaults are lucide's outline
|
|
87
|
+
* convention, which is what the drawer hardcoded before layers existed, so a layer
|
|
88
|
+
* that declares nothing renders exactly as lucide and tabler always have.
|
|
89
|
+
*/
|
|
90
|
+
type IconCanvas = {
|
|
91
|
+
viewBox?: string;
|
|
92
|
+
fill?: string;
|
|
93
|
+
stroke?: string;
|
|
94
|
+
strokeWidth?: number | string;
|
|
95
|
+
strokeLinecap?: 'butt' | 'round' | 'square'; /** SVG2's `arcs` and `miter-clip` are omitted: React does not type them and browsers barely support them. */
|
|
96
|
+
strokeLinejoin?: 'bevel' | 'miter' | 'round';
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* How long a layer's manifest listing may be reused. `'forever'` is the default and
|
|
100
|
+
* matches how a static build artifact has always been cached. A `ttl` in milliseconds
|
|
101
|
+
* suits a layer whose contents change at runtime.
|
|
102
|
+
*
|
|
103
|
+
* Note this governs the drawer *listing* only. Validation goes through `resolveMeta`,
|
|
104
|
+
* which is never cached, so an icon added at runtime is valid immediately regardless.
|
|
105
|
+
*/
|
|
106
|
+
type IconLayerCache = 'forever' | {
|
|
107
|
+
ttl: number;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* One source within a library. Layers are ordered and later ones win by name, so a
|
|
111
|
+
* static base set can be overridden by a runtime-backed layer under a single slug.
|
|
112
|
+
*/
|
|
113
|
+
type IconLayer = {
|
|
114
|
+
/** Diagnostic identity, unique within the adapter. Never part of a stored value. */id: string; /** Lists this layer's icons for the drawer. */
|
|
115
|
+
loadManifest: (ctx: IconLayerContext) => Promise<IconManifest>; /** Exact single-name lookup, serving validation and label resolution. Never cached. */
|
|
116
|
+
resolveMeta?: (name: string, ctx: IconLayerContext) => Promise<IconMeta | null>;
|
|
117
|
+
/**
|
|
118
|
+
* Batched `resolveMeta`. Lookups issued in one microtask are coalesced into a single
|
|
119
|
+
* call, which is what turns a document holding eight icon fields, or a fifty-row list,
|
|
120
|
+
* into one query instead of eight or fifty.
|
|
121
|
+
*/
|
|
122
|
+
resolveMetaMany?: (names: string[], ctx: IconLayerContext) => Promise<Map<string, IconMeta>>; /** Cache policy for `loadManifest`. Defaults to `'forever'`. */
|
|
123
|
+
cache?: IconLayerCache;
|
|
124
|
+
/**
|
|
125
|
+
* Extra cache-key segment derived from the request. A layer whose listing differs per
|
|
126
|
+
* tenant, locale or user MUST supply this, or one caller's manifest is served to
|
|
127
|
+
* another: the cache is otherwise keyed by adapter slug and layer id alone, which are
|
|
128
|
+
* identical across tenants by construction.
|
|
129
|
+
*/
|
|
130
|
+
cacheKey?: (ctx: IconLayerContext) => string; /** How this layer's glyphs paint. */
|
|
131
|
+
render: IconRenderStrategy;
|
|
132
|
+
};
|
|
33
133
|
/**
|
|
34
134
|
* An icon library adapter. `Icon`, `Assets`, and `Nodes` are importMap component
|
|
35
135
|
* path strings so adapters stay serializable inside field configs.
|
|
@@ -37,15 +137,37 @@ type IconNodeMap = Record<string, IconNode[]>;
|
|
|
37
137
|
type IconAdapter = {
|
|
38
138
|
slug: string;
|
|
39
139
|
label: StaticLabel; /** Lazy manifest loader; used server-side for validation and never bundled eagerly. */
|
|
40
|
-
loadManifest: () => Promise<IconManifest>;
|
|
140
|
+
loadManifest: () => Promise<IconManifest>;
|
|
141
|
+
/**
|
|
142
|
+
* Exact single-name lookup, serving validation (non-null means the name exists)
|
|
143
|
+
* and label resolution from one query. Supply it for a library whose contents
|
|
144
|
+
* change at runtime: it stays correct where a cached manifest snapshot cannot,
|
|
145
|
+
* and it answers without materialising the whole manifest. Omit it and the
|
|
146
|
+
* cached manifest index answers both.
|
|
147
|
+
*/
|
|
148
|
+
resolveMeta?: (name: string, ctx: IconLayerContext) => Promise<IconMeta | null>; /** Batched `resolveMeta`; see `IconLayer.resolveMetaMany`. */
|
|
149
|
+
resolveMetaMany?: (names: string[], ctx: IconLayerContext) => Promise<Map<string, IconMeta>>;
|
|
150
|
+
/**
|
|
151
|
+
* Ordered sources composing this library, later winning by name. Omit for a
|
|
152
|
+
* single-source library, which is every adapter written before layers existed:
|
|
153
|
+
* `loadManifest`, `resolveMeta`, `Icon`, `Assets` and `Nodes` then drive everything
|
|
154
|
+
* exactly as they did.
|
|
155
|
+
*/
|
|
156
|
+
layers?: IconLayer[]; /** importMap path of a client component rendering one icon by name, e.g. '@10x-media/fields/icon/adapters/lucide#LucideAdapterIcon'. */
|
|
41
157
|
Icon: string; /** importMap path of a client component that loads the manifest for the admin drawer. */
|
|
42
158
|
Assets: string;
|
|
43
159
|
/**
|
|
44
160
|
* importMap path of a client component that loads this library's bulk node-data
|
|
45
|
-
* for fast drawer rendering. Omit for
|
|
46
|
-
*
|
|
161
|
+
* for fast drawer rendering. Omit for a library with no node-data; the drawer then
|
|
162
|
+
* falls back to the per-icon `Icon` component.
|
|
47
163
|
*/
|
|
48
164
|
Nodes?: string;
|
|
165
|
+
/**
|
|
166
|
+
* Canvas its `Nodes` glyphs are drawn on. Omitted means lucide's outline convention,
|
|
167
|
+
* which is what the drawer assumed before this existed, so every library that shipped
|
|
168
|
+
* without one is unaffected. A filled set must declare its own or it inherits a stroke.
|
|
169
|
+
*/
|
|
170
|
+
canvas?: IconCanvas;
|
|
49
171
|
version: 1;
|
|
50
172
|
};
|
|
51
173
|
/** Resolves which library slugs a request may pick from. */
|
|
@@ -94,12 +216,47 @@ type EncryptedGlobalConfig = {
|
|
|
94
216
|
keys?: KeysConfig;
|
|
95
217
|
onDecryptFailure?: DecryptFailurePolicy;
|
|
96
218
|
};
|
|
219
|
+
/** Per-request policy for registry defaults; list cells call it with `req` undefined (Cell components carry no request). */
|
|
220
|
+
type MeasurementDefaultUnitsResolver = (args: {
|
|
221
|
+
req: PayloadRequest | undefined;
|
|
222
|
+
preferenceKey: string;
|
|
223
|
+
}) => MeasurementUnitId | undefined;
|
|
224
|
+
/** Plugin-level defaults for measurementField(). Per-field options always win. */
|
|
225
|
+
type MeasurementGlobalConfig = {
|
|
226
|
+
/**
|
|
227
|
+
* Keyed by each field's `preferenceKey`, which defaults to its dimension. Or a
|
|
228
|
+
* resolver function for per-request (tenant-aware) policy; a throwing resolver
|
|
229
|
+
* degrades to no default rather than breaking the render.
|
|
230
|
+
*/
|
|
231
|
+
defaultUnits?: Partial<Record<string, MeasurementUnitId>> | MeasurementDefaultUnitsResolver; /** Session-only preference mode for kiosks and shared accounts: skips both reads and writes. Defaults to true. */
|
|
232
|
+
persistPreferences?: boolean; /** Precision default for every measurementField(), ahead of the engine's own default. A field's own `precision` always wins. */
|
|
233
|
+
precision?: MeasurementPrecision | PrecisionMode;
|
|
234
|
+
};
|
|
235
|
+
/** Plugin-level defaults for phoneNumberField(). Per-field options always win. */
|
|
236
|
+
type PhoneNumberGlobalConfig = {
|
|
237
|
+
/** Default for every phoneNumberField(); a field's own option always wins. */defaultCountry?: CountryCode;
|
|
238
|
+
countries?: readonly CountryCode[];
|
|
239
|
+
priorityCountries?: readonly CountryCode[]; /** Heading over `priorityCountries` in the picker. No label renders no heading, only the group separator. */
|
|
240
|
+
priorityCountriesLabel?: StaticLabel;
|
|
241
|
+
validation?: PhoneValidationMode;
|
|
242
|
+
flags?: PhoneFlagMode;
|
|
243
|
+
cellFormat?: PhoneFormat;
|
|
244
|
+
/**
|
|
245
|
+
* Install-wide, with no per-field form. A cost decision, not a technical one: a second
|
|
246
|
+
* set is another 80-145 kB loaded for marginal gain, and two fields on one document
|
|
247
|
+
* could then reach different verdicts about the same number.
|
|
248
|
+
*/
|
|
249
|
+
metadata?: MetadataSet; /** Mount the flag SVG route. Defaults to true. */
|
|
250
|
+
serveFlags?: boolean;
|
|
251
|
+
};
|
|
97
252
|
/** Normalized plugin options written to `config.custom['@10x-media/fields']`. */
|
|
98
253
|
type FieldsPluginRegistry = {
|
|
99
254
|
color?: ColorGlobalConfig;
|
|
100
255
|
icon?: IconGlobalConfig;
|
|
101
256
|
encrypted?: EncryptedGlobalConfig;
|
|
257
|
+
measurement?: MeasurementGlobalConfig;
|
|
258
|
+
phoneNumber?: PhoneNumberGlobalConfig;
|
|
102
259
|
};
|
|
103
260
|
//#endregion
|
|
104
|
-
export { ColorFormat, ColorGlobalConfig, ColorPreset, DecryptFailurePolicy, EncryptedGlobalConfig, FieldsPluginRegistry, FieldsResolverArgs, IconAdapter, IconAvailabilityResolver, IconGlobalConfig, IconManifest, IconMeta, IconNode, IconNodeMap, KeysConfig };
|
|
261
|
+
export { ColorFormat, ColorGlobalConfig, ColorPreset, ColorSchemeValue, DecryptFailurePolicy, EncryptedGlobalConfig, FieldsPluginRegistry, FieldsResolverArgs, IconAdapter, IconAvailabilityResolver, IconCanvas, IconGlobalConfig, IconLayer, IconLayerCache, IconLayerContext, IconManifest, IconMeta, IconNode, IconNodeMap, IconRenderStrategy, KeysConfig, MeasurementDefaultUnitsResolver, MeasurementGlobalConfig, PhoneNumberGlobalConfig };
|
|
105
262
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/utils/resolveStaticLabel.ts
|
|
2
|
+
/**
|
|
3
|
+
* Flattens a StaticLabel to a plain string for one language. Done here rather than through
|
|
4
|
+
* `@payloadcms/translations`, which this package deliberately does not depend on.
|
|
5
|
+
*/
|
|
6
|
+
const resolveStaticLabel = (label, language) => {
|
|
7
|
+
if (label === void 0 || typeof label === "string") return label;
|
|
8
|
+
return label[language] ?? label.en ?? Object.values(label)[0];
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { resolveStaticLabel };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=resolveStaticLabel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveStaticLabel.js","names":[],"sources":["../../src/utils/resolveStaticLabel.ts"],"sourcesContent":["import type { StaticLabel } from 'payload'\n\n/**\n * Flattens a StaticLabel to a plain string for one language. Done here rather than through\n * `@payloadcms/translations`, which this package deliberately does not depend on.\n */\nexport const resolveStaticLabel = (\n\tlabel: StaticLabel | undefined,\n\tlanguage: string\n): string | undefined => {\n\tif (label === undefined || typeof label === 'string') return label\n\treturn label[language] ?? label.en ?? Object.values(label)[0]\n}\n"],"mappings":";;;;;AAMA,MAAa,sBACZ,OACA,aACwB;CACxB,IAAI,UAAU,KAAA,KAAa,OAAO,UAAU,UAAU,OAAO;CAC7D,OAAO,MAAM,aAAa,MAAM,MAAM,OAAO,OAAO,KAAK,EAAE;AAC5D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@10x-media/fields",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.10",
|
|
4
4
|
"description": "Reusable admin fields for Payload: color picker, icon picker, encrypted fields, and more",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -95,6 +95,26 @@
|
|
|
95
95
|
"types": "./dist/exports/encrypted.d.ts",
|
|
96
96
|
"import": "./dist/exports/encrypted.js",
|
|
97
97
|
"default": "./dist/exports/encrypted.js"
|
|
98
|
+
},
|
|
99
|
+
"./measurement": {
|
|
100
|
+
"types": "./dist/exports/measurement.d.ts",
|
|
101
|
+
"import": "./dist/exports/measurement.js",
|
|
102
|
+
"default": "./dist/exports/measurement.js"
|
|
103
|
+
},
|
|
104
|
+
"./measurement/utils": {
|
|
105
|
+
"types": "./dist/exports/measurement-utils.d.ts",
|
|
106
|
+
"import": "./dist/exports/measurement-utils.js",
|
|
107
|
+
"default": "./dist/exports/measurement-utils.js"
|
|
108
|
+
},
|
|
109
|
+
"./phone": {
|
|
110
|
+
"types": "./dist/exports/phone.d.ts",
|
|
111
|
+
"import": "./dist/exports/phone.js",
|
|
112
|
+
"default": "./dist/exports/phone.js"
|
|
113
|
+
},
|
|
114
|
+
"./phone/utils": {
|
|
115
|
+
"types": "./dist/exports/phone-utils.d.ts",
|
|
116
|
+
"import": "./dist/exports/phone-utils.js",
|
|
117
|
+
"default": "./dist/exports/phone-utils.js"
|
|
98
118
|
}
|
|
99
119
|
},
|
|
100
120
|
"files": [
|
|
@@ -128,7 +148,10 @@
|
|
|
128
148
|
}
|
|
129
149
|
},
|
|
130
150
|
"dependencies": {
|
|
131
|
-
"@tanstack/react-virtual": "^3.13.0"
|
|
151
|
+
"@tanstack/react-virtual": "^3.13.0",
|
|
152
|
+
"country-flag-icons": "^1.6.20",
|
|
153
|
+
"dompurify": "^3.2.7",
|
|
154
|
+
"libphonenumber-js": "^1.11.0"
|
|
132
155
|
},
|
|
133
156
|
"devDependencies": {
|
|
134
157
|
"@axe-core/playwright": "^4.11.3",
|
|
@@ -141,6 +164,7 @@
|
|
|
141
164
|
"@tabler/icons": "3.31.0",
|
|
142
165
|
"@tabler/icons-react": "3.31.0",
|
|
143
166
|
"@testing-library/react": "^16.1.0",
|
|
167
|
+
"@types/jsdom": "^21.1.7",
|
|
144
168
|
"@types/json-schema": "^7.0.15",
|
|
145
169
|
"@types/node": "22.19.19",
|
|
146
170
|
"@types/react": "19.2.15",
|
|
@@ -157,10 +181,10 @@
|
|
|
157
181
|
"tsx": "^4.19.2",
|
|
158
182
|
"typescript": "5.9.3",
|
|
159
183
|
"vitest": "4.1.7",
|
|
160
|
-
"@10x-media/tsconfig": "0.0.0",
|
|
161
|
-
"@10x-media/vitest-config": "0.0.0",
|
|
162
184
|
"@10x-media/payload-test-harness": "0.0.0",
|
|
163
|
-
"@10x-media/tsdown-config": "0.0.0"
|
|
185
|
+
"@10x-media/tsdown-config": "0.0.0",
|
|
186
|
+
"@10x-media/tsconfig": "0.0.0",
|
|
187
|
+
"@10x-media/vitest-config": "0.0.0"
|
|
164
188
|
},
|
|
165
189
|
"publishConfig": {
|
|
166
190
|
"access": "public"
|
|
@@ -174,8 +198,8 @@
|
|
|
174
198
|
"test:unit": "vitest run src",
|
|
175
199
|
"test:int": "vitest run tests/int",
|
|
176
200
|
"test:dist": "REQUIRE_DIST=1 vitest run --passWithNoTests=false tests/dist",
|
|
177
|
-
"test:matrix": "
|
|
178
|
-
"test:container": "TEST_DB=container
|
|
201
|
+
"test:matrix": "bash scripts/test-int-matrix.sh",
|
|
202
|
+
"test:container": "TEST_DB=container bash scripts/test-int-matrix.sh",
|
|
179
203
|
"test:e2e": "bash scripts/e2e.sh",
|
|
180
204
|
"dev": "pnpm --filter @10x-media/fields-dev dev",
|
|
181
205
|
"start": "pnpm --filter @10x-media/fields-dev start",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
//#region src/fields/icon/rsc/resolveStaticLabel.ts
|
|
2
|
-
/**
|
|
3
|
-
* Resolves a StaticLabel to a plain string for the requested language. Adapter
|
|
4
|
-
* and library-option labels reach the client as strings, so they must be
|
|
5
|
-
* flattened server-side. Done here rather than via `@payloadcms/translations`
|
|
6
|
-
* because this package does not depend on it (same reason colorField resolves
|
|
7
|
-
* its own labels).
|
|
8
|
-
*/
|
|
9
|
-
const resolveStaticLabel = (label, language) => {
|
|
10
|
-
if (label === void 0 || typeof label === "string") return label;
|
|
11
|
-
return label[language] ?? label.en ?? Object.values(label)[0];
|
|
12
|
-
};
|
|
13
|
-
//#endregion
|
|
14
|
-
export { resolveStaticLabel };
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=resolveStaticLabel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolveStaticLabel.js","names":[],"sources":["../../../../src/fields/icon/rsc/resolveStaticLabel.ts"],"sourcesContent":["import type { StaticLabel } from 'payload'\n\n/**\n * Resolves a StaticLabel to a plain string for the requested language. Adapter\n * and library-option labels reach the client as strings, so they must be\n * flattened server-side. Done here rather than via `@payloadcms/translations`\n * because this package does not depend on it (same reason colorField resolves\n * its own labels).\n */\nexport const resolveStaticLabel = (\n\tlabel: StaticLabel | undefined,\n\tlanguage: string\n): string | undefined => {\n\tif (label === undefined || typeof label === 'string') return label\n\treturn label[language] ?? label.en ?? Object.values(label)[0]\n}\n"],"mappings":";;;;;;;;AASA,MAAa,sBACZ,OACA,aACwB;CACxB,IAAI,UAAU,KAAA,KAAa,OAAO,UAAU,UAAU,OAAO;CAC7D,OAAO,MAAM,aAAa,MAAM,MAAM,OAAO,OAAO,KAAK,EAAE;AAC5D"}
|