@monkey-mini-app/panel 0.1.5 → 0.1.7
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/index.cjs +16 -0
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +15 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3235,6 +3235,20 @@ function resolvePanelLocale(value) {
|
|
|
3235
3235
|
}
|
|
3236
3236
|
return value;
|
|
3237
3237
|
}
|
|
3238
|
+
function localeFromLanguageTag(tag) {
|
|
3239
|
+
if (tag == null) return "en";
|
|
3240
|
+
const raw = String(tag).trim();
|
|
3241
|
+
if (!raw) return "en";
|
|
3242
|
+
const normalized = raw.replace(/_/g, "-").toLowerCase();
|
|
3243
|
+
return normalized === "zh" || normalized.startsWith("zh-") ? "zh-CN" : "en";
|
|
3244
|
+
}
|
|
3245
|
+
function detectBrowserLocale(languages) {
|
|
3246
|
+
const tags = languages ?? (typeof navigator !== "undefined" ? navigator.languages?.length ? [...navigator.languages] : navigator.language ? [navigator.language] : [] : []);
|
|
3247
|
+
for (const tag of tags) {
|
|
3248
|
+
if (tag) return localeFromLanguageTag(tag);
|
|
3249
|
+
}
|
|
3250
|
+
return "en";
|
|
3251
|
+
}
|
|
3238
3252
|
|
|
3239
3253
|
// src/styles.ts
|
|
3240
3254
|
var PANEL_CSS_TAG = "panel";
|
|
@@ -3813,6 +3827,7 @@ exports.createPanelI18n = createPanelI18n;
|
|
|
3813
3827
|
exports.createRestPanelHost = createRestPanelHost;
|
|
3814
3828
|
exports.cssVars = cssVars;
|
|
3815
3829
|
exports.defaultHideThemePop = defaultHideThemePop;
|
|
3830
|
+
exports.detectBrowserLocale = detectBrowserLocale;
|
|
3816
3831
|
exports.effectivePalette = effectivePalette;
|
|
3817
3832
|
exports.formToHostConfigBody = formToHostConfigBody;
|
|
3818
3833
|
exports.getPanelState = getPanelState;
|
|
@@ -3820,6 +3835,7 @@ exports.hostConfigToForm = hostConfigToForm;
|
|
|
3820
3835
|
exports.hue = hue;
|
|
3821
3836
|
exports.injectPanelCss = injectPanelCss;
|
|
3822
3837
|
exports.isHostUnreachable = isHostUnreachable;
|
|
3838
|
+
exports.localeFromLanguageTag = localeFromLanguageTag;
|
|
3823
3839
|
exports.monoOf = monoOf;
|
|
3824
3840
|
exports.packageName = packageName;
|
|
3825
3841
|
exports.parseAppsResponse = parseAppsResponse;
|
package/dist/index.d.cts
CHANGED
|
@@ -181,6 +181,13 @@ type PanelI18n = {
|
|
|
181
181
|
/** i18next helper bound to `locale`. Missing keys throw outside production. */
|
|
182
182
|
declare function createPanelI18n(locale: LocaleId): PanelI18n;
|
|
183
183
|
declare function resolvePanelLocale(value: string | undefined): LocaleId;
|
|
184
|
+
/**
|
|
185
|
+
* Map a BCP 47 language tag to a supported panel locale.
|
|
186
|
+
* `zh*` (case-insensitive) → `zh-CN`; anything else → `en`.
|
|
187
|
+
*/
|
|
188
|
+
declare function localeFromLanguageTag(tag: string | null | undefined): LocaleId;
|
|
189
|
+
/** Browser locale for first paint before host.json is loaded. */
|
|
190
|
+
declare function detectBrowserLocale(languages?: readonly string[] | null): LocaleId;
|
|
184
191
|
|
|
185
192
|
/**
|
|
186
193
|
* PanelHost — the only seam between the panel UI and a host (dsh client, demo, …).
|
|
@@ -522,4 +529,4 @@ declare function injectPanelCss(): void;
|
|
|
522
529
|
|
|
523
530
|
declare const packageName = "@monkey-mini-app/panel";
|
|
524
531
|
|
|
525
|
-
export { type AboutInfo, type AboutPackage, type AppItem, AppList, Browse, type BrowseKind, type CardStyle, type Commit, type CommitFile, type CreateMiniAppPanelOptions, type DockId, type FrameController, type FrameControllerOptions, type FrameEnv, type FrameRecord, type HostEventHandlers, type HostShellInstance, type HostShellOptions, HostUnreachableError, type I18nParams, LOCALE_IDS, ListRegion, Loading, type LocaleId, MiniAppPanel, Modal, PANEL_CSS_TAG, type Palette, type PanelActions, type PanelCapabilities, PanelError, type PanelHost, type PanelI18n, type PanelInstance, PanelProvider, type PanelState, type RestOptions, Settings, type StorageNotice, type StorageTable, type TabItem, type TabKind, Tabs, ThemePop, type ThemeScope, TokenSet, Toolbar, type UpdateCheck, type UpdateCheckState, type ViewEvalAnswer, type ViewEvalQuery, activeAppFrom, appBlurb, appFrameUrl, capabilitiesOf, clampPaletteId, createFrameController, createHostShell, createMiniAppPanel, createPanelActions, createPanelI18n, createRestPanelHost, defaultHideThemePop, formToHostConfigBody, getPanelState, hostConfigToForm, hue, injectPanelCss, isHostUnreachable, monoOf, packageName, parseAppsResponse, parseCommitDetail, parseCommitList, parsePalettes, parseStorageTables, readJson, relayViewEval, resetPanelState, resolvePanelLocale, setPanelState, subscribeHostEvents, subscribePanel, usePanelActions, usePanelI18n, usePanelState };
|
|
532
|
+
export { type AboutInfo, type AboutPackage, type AppItem, AppList, Browse, type BrowseKind, type CardStyle, type Commit, type CommitFile, type CreateMiniAppPanelOptions, type DockId, type FrameController, type FrameControllerOptions, type FrameEnv, type FrameRecord, type HostEventHandlers, type HostShellInstance, type HostShellOptions, HostUnreachableError, type I18nParams, LOCALE_IDS, ListRegion, Loading, type LocaleId, MiniAppPanel, Modal, PANEL_CSS_TAG, type Palette, type PanelActions, type PanelCapabilities, PanelError, type PanelHost, type PanelI18n, type PanelInstance, PanelProvider, type PanelState, type RestOptions, Settings, type StorageNotice, type StorageTable, type TabItem, type TabKind, Tabs, ThemePop, type ThemeScope, TokenSet, Toolbar, type UpdateCheck, type UpdateCheckState, type ViewEvalAnswer, type ViewEvalQuery, activeAppFrom, appBlurb, appFrameUrl, capabilitiesOf, clampPaletteId, createFrameController, createHostShell, createMiniAppPanel, createPanelActions, createPanelI18n, createRestPanelHost, defaultHideThemePop, detectBrowserLocale, formToHostConfigBody, getPanelState, hostConfigToForm, hue, injectPanelCss, isHostUnreachable, localeFromLanguageTag, monoOf, packageName, parseAppsResponse, parseCommitDetail, parseCommitList, parsePalettes, parseStorageTables, readJson, relayViewEval, resetPanelState, resolvePanelLocale, setPanelState, subscribeHostEvents, subscribePanel, usePanelActions, usePanelI18n, usePanelState };
|
package/dist/index.d.ts
CHANGED
|
@@ -181,6 +181,13 @@ type PanelI18n = {
|
|
|
181
181
|
/** i18next helper bound to `locale`. Missing keys throw outside production. */
|
|
182
182
|
declare function createPanelI18n(locale: LocaleId): PanelI18n;
|
|
183
183
|
declare function resolvePanelLocale(value: string | undefined): LocaleId;
|
|
184
|
+
/**
|
|
185
|
+
* Map a BCP 47 language tag to a supported panel locale.
|
|
186
|
+
* `zh*` (case-insensitive) → `zh-CN`; anything else → `en`.
|
|
187
|
+
*/
|
|
188
|
+
declare function localeFromLanguageTag(tag: string | null | undefined): LocaleId;
|
|
189
|
+
/** Browser locale for first paint before host.json is loaded. */
|
|
190
|
+
declare function detectBrowserLocale(languages?: readonly string[] | null): LocaleId;
|
|
184
191
|
|
|
185
192
|
/**
|
|
186
193
|
* PanelHost — the only seam between the panel UI and a host (dsh client, demo, …).
|
|
@@ -522,4 +529,4 @@ declare function injectPanelCss(): void;
|
|
|
522
529
|
|
|
523
530
|
declare const packageName = "@monkey-mini-app/panel";
|
|
524
531
|
|
|
525
|
-
export { type AboutInfo, type AboutPackage, type AppItem, AppList, Browse, type BrowseKind, type CardStyle, type Commit, type CommitFile, type CreateMiniAppPanelOptions, type DockId, type FrameController, type FrameControllerOptions, type FrameEnv, type FrameRecord, type HostEventHandlers, type HostShellInstance, type HostShellOptions, HostUnreachableError, type I18nParams, LOCALE_IDS, ListRegion, Loading, type LocaleId, MiniAppPanel, Modal, PANEL_CSS_TAG, type Palette, type PanelActions, type PanelCapabilities, PanelError, type PanelHost, type PanelI18n, type PanelInstance, PanelProvider, type PanelState, type RestOptions, Settings, type StorageNotice, type StorageTable, type TabItem, type TabKind, Tabs, ThemePop, type ThemeScope, TokenSet, Toolbar, type UpdateCheck, type UpdateCheckState, type ViewEvalAnswer, type ViewEvalQuery, activeAppFrom, appBlurb, appFrameUrl, capabilitiesOf, clampPaletteId, createFrameController, createHostShell, createMiniAppPanel, createPanelActions, createPanelI18n, createRestPanelHost, defaultHideThemePop, formToHostConfigBody, getPanelState, hostConfigToForm, hue, injectPanelCss, isHostUnreachable, monoOf, packageName, parseAppsResponse, parseCommitDetail, parseCommitList, parsePalettes, parseStorageTables, readJson, relayViewEval, resetPanelState, resolvePanelLocale, setPanelState, subscribeHostEvents, subscribePanel, usePanelActions, usePanelI18n, usePanelState };
|
|
532
|
+
export { type AboutInfo, type AboutPackage, type AppItem, AppList, Browse, type BrowseKind, type CardStyle, type Commit, type CommitFile, type CreateMiniAppPanelOptions, type DockId, type FrameController, type FrameControllerOptions, type FrameEnv, type FrameRecord, type HostEventHandlers, type HostShellInstance, type HostShellOptions, HostUnreachableError, type I18nParams, LOCALE_IDS, ListRegion, Loading, type LocaleId, MiniAppPanel, Modal, PANEL_CSS_TAG, type Palette, type PanelActions, type PanelCapabilities, PanelError, type PanelHost, type PanelI18n, type PanelInstance, PanelProvider, type PanelState, type RestOptions, Settings, type StorageNotice, type StorageTable, type TabItem, type TabKind, Tabs, ThemePop, type ThemeScope, TokenSet, Toolbar, type UpdateCheck, type UpdateCheckState, type ViewEvalAnswer, type ViewEvalQuery, activeAppFrom, appBlurb, appFrameUrl, capabilitiesOf, clampPaletteId, createFrameController, createHostShell, createMiniAppPanel, createPanelActions, createPanelI18n, createRestPanelHost, defaultHideThemePop, detectBrowserLocale, formToHostConfigBody, getPanelState, hostConfigToForm, hue, injectPanelCss, isHostUnreachable, localeFromLanguageTag, monoOf, packageName, parseAppsResponse, parseCommitDetail, parseCommitList, parsePalettes, parseStorageTables, readJson, relayViewEval, resetPanelState, resolvePanelLocale, setPanelState, subscribeHostEvents, subscribePanel, usePanelActions, usePanelI18n, usePanelState };
|
package/dist/index.js
CHANGED
|
@@ -2658,6 +2658,20 @@ function resolvePanelLocale(value) {
|
|
|
2658
2658
|
}
|
|
2659
2659
|
return value;
|
|
2660
2660
|
}
|
|
2661
|
+
function localeFromLanguageTag(tag) {
|
|
2662
|
+
if (tag == null) return "en";
|
|
2663
|
+
const raw = String(tag).trim();
|
|
2664
|
+
if (!raw) return "en";
|
|
2665
|
+
const normalized = raw.replace(/_/g, "-").toLowerCase();
|
|
2666
|
+
return normalized === "zh" || normalized.startsWith("zh-") ? "zh-CN" : "en";
|
|
2667
|
+
}
|
|
2668
|
+
function detectBrowserLocale(languages) {
|
|
2669
|
+
const tags = languages ?? (typeof navigator !== "undefined" ? navigator.languages?.length ? [...navigator.languages] : navigator.language ? [navigator.language] : [] : []);
|
|
2670
|
+
for (const tag of tags) {
|
|
2671
|
+
if (tag) return localeFromLanguageTag(tag);
|
|
2672
|
+
}
|
|
2673
|
+
return "en";
|
|
2674
|
+
}
|
|
2661
2675
|
|
|
2662
2676
|
// src/styles.ts
|
|
2663
2677
|
var PANEL_CSS_TAG = "panel";
|
|
@@ -3202,4 +3216,4 @@ function createHostShell(opts) {
|
|
|
3202
3216
|
// src/index.ts
|
|
3203
3217
|
var packageName = "@monkey-mini-app/panel";
|
|
3204
3218
|
|
|
3205
|
-
export { AppList, Browse, HostUnreachableError, LOCALE_IDS, ListRegion, Loading, MiniAppPanel, Modal, PANEL_CSS_TAG, PanelError, PanelProvider, Settings, Tabs, ThemePop, Toolbar, activeAppFrom, appBlurb, appFrameUrl, capabilitiesOf, clampPaletteId, createFrameController, createHostShell, createMiniAppPanel, createPanelActions, createPanelI18n, createRestPanelHost, defaultHideThemePop, formToHostConfigBody, getPanelState, hostConfigToForm, hue, injectPanelCss, isHostUnreachable, monoOf, packageName, parseAppsResponse, parseCommitDetail, parseCommitList, parsePalettes, parseStorageTables, readJson, relayViewEval, resetPanelState, resolvePanelLocale, setPanelState, subscribeHostEvents, subscribePanel, usePanelActions, usePanelI18n, usePanelState };
|
|
3219
|
+
export { AppList, Browse, HostUnreachableError, LOCALE_IDS, ListRegion, Loading, MiniAppPanel, Modal, PANEL_CSS_TAG, PanelError, PanelProvider, Settings, Tabs, ThemePop, Toolbar, activeAppFrom, appBlurb, appFrameUrl, capabilitiesOf, clampPaletteId, createFrameController, createHostShell, createMiniAppPanel, createPanelActions, createPanelI18n, createRestPanelHost, defaultHideThemePop, detectBrowserLocale, formToHostConfigBody, getPanelState, hostConfigToForm, hue, injectPanelCss, isHostUnreachable, localeFromLanguageTag, monoOf, packageName, parseAppsResponse, parseCommitDetail, parseCommitList, parsePalettes, parseStorageTables, readJson, relayViewEval, resetPanelState, resolvePanelLocale, setPanelState, subscribeHostEvents, subscribePanel, usePanelActions, usePanelI18n, usePanelState };
|