@pathscale/ui 0.0.121 → 0.0.122

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.
@@ -32,6 +32,7 @@ export interface ImmersiveLandingContextValue {
32
32
  direction: Accessor<"next" | "prev" | null>;
33
33
  transitionDuration: number;
34
34
  pages: readonly string[];
35
+ appVersion?: string;
35
36
  }
36
37
  export interface ImmersiveLandingProps extends IComponentBaseProps {
37
38
  pages: readonly string[];
@@ -42,6 +43,8 @@ export interface ImmersiveLandingProps extends IComponentBaseProps {
42
43
  enableScrollNavigation?: boolean;
43
44
  showNavigation?: boolean;
44
45
  showArrows?: boolean;
46
+ appVersion?: string;
47
+ overlay?: JSX.Element | ((context: ImmersiveLandingContextValue) => JSX.Element);
45
48
  children: JSX.Element | ((context: ImmersiveLandingContextValue) => JSX.Element);
46
49
  }
47
50
  export interface ImmersiveLandingPageProps extends IComponentBaseProps {
@@ -29,13 +29,13 @@ export interface I18nOptions {
29
29
  }
30
30
  export interface I18nStore {
31
31
  /**
32
- * Current locale code
32
+ * Current locale code (getter, reactive)
33
33
  */
34
- locale: () => string;
34
+ readonly locale: string;
35
35
  /**
36
- * Whether translations are currently loading
36
+ * Whether translations are currently loading (getter, reactive)
37
37
  */
38
- isLoading: () => boolean;
38
+ readonly isLoading: boolean;
39
39
  /**
40
40
  * Translation function
41
41
  */
@@ -51,14 +51,40 @@ export interface I18nStore {
51
51
  /**
52
52
  * Available languages
53
53
  */
54
- languages: Language[];
54
+ readonly languages: Language[];
55
55
  /**
56
56
  * Language names map for quick lookup
57
57
  */
58
- languageNames: Record<string, string>;
58
+ readonly languageNames: Record<string, string>;
59
+ /**
60
+ * Supported language codes
61
+ */
62
+ readonly supportedCodes: string[];
59
63
  }
60
64
  /**
61
65
  * Creates an i18n store with configurable options.
66
+ * API matches nofilter.io's i18nStore for easy migration.
67
+ *
68
+ * @example
69
+ * ```tsx
70
+ * // Create the store
71
+ * const i18n = createI18n({
72
+ * languages: [
73
+ * { code: "en", name: "English" },
74
+ * { code: "es", name: "Español" },
75
+ * ],
76
+ * storageKey: "myapp_locale",
77
+ * initialTranslations: enTranslations,
78
+ * loadTranslations: (locale) => fetch(`/locales/${locale}.json`).then(r => r.json()),
79
+ * });
80
+ *
81
+ * // Use in components
82
+ * <p>{i18n.t("greeting")}</p>
83
+ * <p>Current: {i18n.locale}</p>
84
+ *
85
+ * // Initialize on app mount
86
+ * onMount(() => i18n.init());
87
+ * ```
62
88
  */
63
89
  export declare function createI18n(options: I18nOptions): I18nStore;
64
90
  export interface I18nContextValue {
package/dist/index.js CHANGED
@@ -10940,7 +10940,7 @@ const immersive_landing_ImmersiveLandingNavigation = ImmersiveLandingNavigation;
10940
10940
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.delegateEvents)([
10941
10941
  "click"
10942
10942
  ]);
10943
- var ImmersiveLanding_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div><div class="relative z-10 h-full w-full">');
10943
+ var ImmersiveLanding_tmpl$ = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div><div class="relative h-full w-full"><div class="relative z-10 h-full w-full">'), ImmersiveLanding_tmpl$2 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div class="absolute inset-0 flex items-end justify-end p-6"aria-hidden=true><span class="font-mono text-base-content/20 text-[clamp(0.75rem,2vw,1.25rem)] tracking-[0.4em]">v'), ImmersiveLanding_tmpl$3 = /*#__PURE__*/ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.template)('<div class="pointer-events-none fixed inset-0 z-30">');
10944
10944
  const ImmersiveLanding = (props)=>{
10945
10945
  const [local, others] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.splitProps)(props, [
10946
10946
  "pages",
@@ -10951,6 +10951,9 @@ const ImmersiveLanding = (props)=>{
10951
10951
  "enableScrollNavigation",
10952
10952
  "showNavigation",
10953
10953
  "showArrows",
10954
+ "appVersion",
10955
+ "overlay",
10956
+ "children",
10954
10957
  "class",
10955
10958
  "className",
10956
10959
  "style"
@@ -10974,18 +10977,20 @@ const ImmersiveLanding = (props)=>{
10974
10977
  isLastPage: navigation.isLastPage,
10975
10978
  direction: navigation.direction,
10976
10979
  transitionDuration: navigation.transitionDuration,
10977
- pages: local.pages
10980
+ pages: local.pages,
10981
+ appVersion: local.appVersion
10978
10982
  };
10979
10983
  const showNav = ()=>false !== local.showNavigation;
10980
10984
  const showArrowNav = ()=>false !== local.showArrows;
10981
- const classes = ()=>twMerge("fixed inset-0 overflow-hidden bg-transparent", local.class, local.className);
10982
- const renderChildren = ()=>"function" == typeof props.children ? props.children(contextValue) : props.children;
10985
+ const classes = ()=>twMerge("fixed inset-0 h-screen w-screen overflow-hidden bg-transparent relative isolate", local.class, local.className);
10986
+ const renderChildren = ()=>"function" == typeof local.children ? local.children(contextValue) : local.children;
10987
+ const renderOverlay = ()=>"function" == typeof local.overlay ? local.overlay(contextValue) : local.overlay;
10983
10988
  return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(ImmersiveLandingContext.Provider, {
10984
10989
  value: contextValue,
10985
10990
  get children () {
10986
10991
  return [
10987
10992
  (()=>{
10988
- var _el$ = ImmersiveLanding_tmpl$(), _el$2 = _el$.firstChild;
10993
+ var _el$ = ImmersiveLanding_tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
10989
10994
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.spread)(_el$, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.mergeProps)({
10990
10995
  get ["class"] () {
10991
10996
  return classes();
@@ -10994,9 +10999,30 @@ const ImmersiveLanding = (props)=>{
10994
10999
  return local.style;
10995
11000
  }
10996
11001
  }, others), false, true);
10997
- (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$2, renderChildren);
11002
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$3, renderChildren);
10998
11003
  return _el$;
10999
11004
  })(),
11005
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.Show, {
11006
+ get when () {
11007
+ return local.overlay || local.appVersion;
11008
+ },
11009
+ get children () {
11010
+ var _el$4 = ImmersiveLanding_tmpl$3();
11011
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$4, renderOverlay, null);
11012
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$4, (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.Show, {
11013
+ get when () {
11014
+ return local.appVersion;
11015
+ },
11016
+ get children () {
11017
+ var _el$5 = ImmersiveLanding_tmpl$2(), _el$6 = _el$5.firstChild;
11018
+ _el$6.firstChild;
11019
+ (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.insert)(_el$6, ()=>local.appVersion, null);
11020
+ return _el$5;
11021
+ }
11022
+ }), null);
11023
+ return _el$4;
11024
+ }
11025
+ }),
11000
11026
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>(0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.memo)(()=>!!showArrowNav())() && (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(immersive_landing_ImmersiveLandingArrows, {
11001
11027
  get onPrev () {
11002
11028
  return navigation.goPrev;
@@ -11623,8 +11649,8 @@ const LanguageSwitcher = (props)=>{
11623
11649
  "loadingLabel",
11624
11650
  "onLanguageChange"
11625
11651
  ]);
11626
- const currentLanguageName = ()=>local.i18n.languageNames[local.i18n.locale()];
11627
- const isSelected = (lang)=>local.i18n.locale() === lang;
11652
+ const currentLanguageName = ()=>local.i18n.languageNames[local.i18n.locale];
11653
+ const isSelected = (lang)=>local.i18n.locale === lang;
11628
11654
  const handleSelect = async (lang)=>{
11629
11655
  await local.i18n.setLocale(lang);
11630
11656
  local.onLanguageChange?.(lang);
@@ -11658,7 +11684,7 @@ const LanguageSwitcher = (props)=>{
11658
11684
  })(),
11659
11685
  (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(__WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.Show, {
11660
11686
  get when () {
11661
- return !local.i18n.isLoading();
11687
+ return !local.i18n.isLoading;
11662
11688
  },
11663
11689
  get fallback () {
11664
11690
  return (0, __WEBPACK_EXTERNAL_MODULE_solid_js_web_35d951b7__.createComponent)(icon_Icon, {
@@ -11729,13 +11755,13 @@ function createI18n(options) {
11729
11755
  ...acc,
11730
11756
  [lang.code]: lang.name
11731
11757
  }), {});
11732
- const [locale, setLocaleSignal] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(defaultLanguage);
11758
+ const [localeSignal, setLocaleSignal] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(defaultLanguage);
11733
11759
  const [translations, setTranslations] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(initialTranslations);
11734
- const [isLoading, setIsLoading] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(false);
11760
+ const [isLoadingSignal, setIsLoading] = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createSignal)(false);
11735
11761
  const t = (key)=>getNestedValue(translations(), key);
11736
11762
  const setLocale = async (lang)=>{
11737
11763
  if (!supportedCodes.includes(lang)) lang = defaultLanguage;
11738
- if (lang === locale() && Object.keys(translations()).length > 0) return;
11764
+ if (lang === localeSignal() && Object.keys(translations()).length > 0) return;
11739
11765
  setIsLoading(true);
11740
11766
  try {
11741
11767
  const minDelay = new Promise((resolve)=>setTimeout(resolve, 100));
@@ -11765,13 +11791,18 @@ function createI18n(options) {
11765
11791
  await setLocale(detected);
11766
11792
  };
11767
11793
  return {
11768
- locale,
11769
- isLoading,
11794
+ get locale () {
11795
+ return localeSignal();
11796
+ },
11797
+ get isLoading () {
11798
+ return isLoadingSignal();
11799
+ },
11770
11800
  t,
11771
11801
  setLocale,
11772
11802
  init,
11773
11803
  languages,
11774
- languageNames
11804
+ languageNames,
11805
+ supportedCodes
11775
11806
  };
11776
11807
  }
11777
11808
  const I18nContext = (0, __WEBPACK_EXTERNAL_MODULE_solid_js_aeefcc6d__.createContext)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pathscale/ui",
3
- "version": "0.0.121",
3
+ "version": "0.0.122",
4
4
  "author": "pathscale",
5
5
  "repository": {
6
6
  "type": "git",