solid-intlayer 9.9.0 → 9.9.1

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.
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});
File without changes
@@ -180,7 +180,7 @@ var markdownPlugin = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? fallb
180
180
  }
181
181
  };
182
182
  var HTMLSuspenseRenderer = lazyComponent(() => htmlRendererModulePromise.then((HTMLRenderer) => ({ default: HTMLRenderer })));
183
- /** HTML plugin. Replaces node with a function that takes components => JSX.Element. */
183
+ /** HTML plugin. Replaces node with a function that takes components => SolidElement. */
184
184
  var htmlPlugin = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? fallbackPlugin : {
185
185
  id: "html-plugin",
186
186
  canHandle: (node) => typeof node === "object" && node?.nodeType === NodeTypes.HTML,
File without changes
@@ -1,6 +1,7 @@
1
1
  import { NodeProps } from '@intlayer/core/interpreter';
2
2
  import { ResolvedEditor } from '@intlayer/types/module_augmentation';
3
- import { JSX, ParentProps } from 'solid-js';
3
+ import { ParentProps } from 'solid-js';
4
+ import { SolidElement } from './solidTypes';
4
5
  /**
5
6
  * Content node returned by `useIntlayer`.
6
7
  *
@@ -11,12 +12,12 @@ import { JSX, ParentProps } from 'solid-js';
11
12
  */
12
13
  export type IntlayerNode<T = NodeProps['children'], AdditionalProps = unknown> = ResolvedEditor<T & {
13
14
  value: T;
14
- } & AdditionalProps, JSX.Element & {
15
+ } & AdditionalProps, SolidElement & {
15
16
  value: T;
16
17
  } & AdditionalProps>;
17
18
  type RenderIntlayerNodeProps<T> = ParentProps<{
18
19
  value: T;
19
- children: JSX.Element;
20
+ children: SolidElement;
20
21
  additionalProps?: Record<string, unknown>;
21
22
  }>;
22
23
  export declare const renderIntlayerNode: <T>({ children, value, additionalProps, }: RenderIntlayerNodeProps<T>) => IntlayerNode<T>;
@@ -1,7 +1,8 @@
1
- import { Component, JSX } from 'solid-js';
1
+ import { Component } from 'solid-js';
2
+ import { SolidElement } from './solidTypes';
2
3
  export type LoadingBoundaryProps = {
3
- fallback?: JSX.Element;
4
- children: JSX.Element;
4
+ fallback?: SolidElement;
5
+ children: SolidElement;
5
6
  };
6
7
  /**
7
8
  * Shows `fallback` while async reads below it are pending: `Suspense` in
@@ -1,4 +1,6 @@
1
+ import { LocaleStorageClient } from '@intlayer/core/utils';
1
2
  import { LocalesValues } from '@intlayer/types/module_augmentation';
3
+ import { Accessor } from 'solid-js';
2
4
  /**
3
5
  * Reads the locale persisted in the browser storage (cookie, localStorage…).
4
6
  *
@@ -32,10 +34,7 @@ export declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled?:
32
34
  /**
33
35
  * Hook that provides the locale storage and a function to set it
34
36
  */
35
- export declare const useLocaleStorage: (isCookieEnabled?: boolean) => import('solid-js').SourceAccessor<{
36
- getLocale: () => import('@intlayer/types').Locale;
37
- setLocale: (locale: LocalesValues) => void;
38
- }>;
37
+ export declare const useLocaleStorage: (isCookieEnabled?: boolean) => Accessor<ReturnType<typeof LocaleStorageClient>>;
39
38
  /**
40
39
  * @deprecated Use useLocaleStorage instead
41
40
  *
@@ -43,7 +42,4 @@ export declare const useLocaleStorage: (isCookieEnabled?: boolean) => import('so
43
42
  *
44
43
  * Hook that provides the locale cookie and a function to set it
45
44
  */
46
- export declare const useLocaleCookie: (isCookieEnabled?: boolean) => import('solid-js').SourceAccessor<{
47
- getLocale: () => import('@intlayer/types').Locale;
48
- setLocale: (locale: LocalesValues) => void;
49
- }>;
45
+ export declare const useLocaleCookie: (isCookieEnabled?: boolean) => Accessor<ReturnType<typeof LocaleStorageClient>>;
@@ -1,16 +1,7 @@
1
1
  import { NodeProps } from '@intlayer/core/interpreter';
2
- import { Component, JSX } from 'solid-js';
3
- declare module 'solid-js' {
4
- namespace JSX {
5
- interface IntrinsicElements {
6
- 'intlayer-content-selector-wrapper': JSX.HTMLAttributes<HTMLElement> & {
7
- 'key-path'?: string;
8
- 'dictionary-key'?: string;
9
- };
10
- }
11
- }
12
- }
13
- export type ContentSelectorWrapperProps = NodeProps & Omit<JSX.HTMLAttributes<HTMLDivElement>, 'children'> & {
14
- children?: JSX.Element;
2
+ import { Component } from 'solid-js';
3
+ import { IntrinsicElementProps, SolidElement } from '../solidTypes';
4
+ export type ContentSelectorWrapperProps = NodeProps & Omit<IntrinsicElementProps<'div'>, 'children'> & {
5
+ children?: SolidElement;
15
6
  };
16
7
  export declare const ContentSelector: Component<ContentSelectorWrapperProps>;
@@ -1,5 +1,6 @@
1
1
  import { WrappedIntl } from '@intlayer/core/formatters';
2
2
  import { LocalesValues } from '@intlayer/types/module_augmentation';
3
+ import { Accessor } from 'solid-js';
3
4
  /**
4
5
  * Solid client hook that provides a locale-bound `Intl` object.
5
6
  *
@@ -18,4 +19,4 @@ import { LocalesValues } from '@intlayer/types/module_augmentation';
18
19
  * }).format(123.45);
19
20
  * ```
20
21
  */
21
- export declare const useIntl: (locale?: LocalesValues) => import('solid-js').SourceAccessor<WrappedIntl>;
22
+ export declare const useIntl: (locale?: LocalesValues) => Accessor<WrappedIntl>;
@@ -1,5 +1,6 @@
1
1
  import { KeyPath } from '@intlayer/types/keyPath';
2
- import { Component, JSX } from 'solid-js';
2
+ import { Component } from 'solid-js';
3
+ import { SolidElement } from '../solidTypes';
3
4
  import { HTMLComponents } from './types';
4
5
  export type RenderHTMLProps = {
5
6
  /**
@@ -14,14 +15,14 @@ export type RenderHTMLProps = {
14
15
  * This function does not use context from HTMLProvider. Use `useHTMLRenderer`
15
16
  * hook if you want to leverage provider context.
16
17
  */
17
- export declare const renderHTML: (content: string, { components }?: RenderHTMLProps) => JSX.Element;
18
+ export declare const renderHTML: (content: string, { components }?: RenderHTMLProps) => SolidElement;
18
19
  /**
19
20
  * Hook that returns a function to render HTML content.
20
21
  *
21
22
  * This hook considers the configuration from the `HTMLProvider` context if available,
22
23
  * falling back to the provided components.
23
24
  */
24
- export declare const useHTMLRenderer: ({ components }?: RenderHTMLProps) => (content: string) => JSX.Element;
25
+ export declare const useHTMLRenderer: ({ components }?: RenderHTMLProps) => ((content: string) => SolidElement);
25
26
  export type HTMLRendererProps = RenderHTMLProps & {
26
27
  /**
27
28
  * The HTML content to render as a string.
@@ -1,17 +1,18 @@
1
1
  import { HTMLTagsType } from '@intlayer/core/transpiler';
2
- import { JSX } from 'solid-js';
2
+ import { IntrinsicElementProps, SolidElement } from '../solidTypes';
3
3
  /**
4
4
  * Helper to extract specific props from the configuration value.
5
5
  */
6
6
  type PropsFromConfig<Value> = Value extends true ? {} : Value extends object ? Value : {};
7
7
  /**
8
- * Common props for all elements
8
+ * Common props for all elements: `HTMLAttributes<HTMLElement>`, which Solid 1
9
+ * gives `<section>`.
9
10
  */
10
- type ElementProps = JSX.HTMLAttributes<HTMLElement>;
11
+ type ElementProps = IntrinsicElementProps<'section'>;
11
12
  /**
12
13
  * Solid Component type
13
14
  */
14
- type SolidComponentType<P = {}> = (props: P) => JSX.Element;
15
+ type SolidComponentType<P = {}> = (props: P) => SolidElement;
15
16
  /**
16
17
  * Helper: Defines the mapping for the explicitly listed keys in T.
17
18
  * Handles whether they are Required or Optional.
@@ -1,5 +1,6 @@
1
- import { Component, JSXElement, ParentProps, ValidComponent } from 'solid-js';
1
+ import { Component, ParentProps, ValidComponent } from 'solid-js';
2
2
  import { HTMLComponents } from '../html/types';
3
+ import { SolidElement } from '../solidTypes';
3
4
  import { ParsedMarkdown } from './compiler';
4
5
  export type MarkdownProviderOptions = {
5
6
  /** Forces the compiler to always output content with a block-level wrapper. */
@@ -11,7 +12,7 @@ export type MarkdownProviderOptions = {
11
12
  };
12
13
  type MarkdownProviderValue = {
13
14
  components?: HTMLComponents<'permissive', {}>;
14
- renderMarkdown: (content: string | ParsedMarkdown, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: ValidComponent) => JSXElement | Promise<JSXElement>;
15
+ renderMarkdown: (content: string | ParsedMarkdown, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: ValidComponent) => SolidElement | Promise<SolidElement>;
15
16
  };
16
17
  /**
17
18
  * `null` outside a provider. An explicit default keeps `useContext` from
@@ -24,7 +25,7 @@ export type MarkdownProviderProps = ParentProps<{
24
25
  forceBlock?: boolean;
25
26
  preserveFrontmatter?: boolean;
26
27
  tagfilter?: boolean;
27
- renderMarkdown?: (content: string | ParsedMarkdown, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: ValidComponent) => JSXElement | Promise<JSXElement>;
28
+ renderMarkdown?: (content: string | ParsedMarkdown, options?: MarkdownProviderOptions, components?: HTMLComponents<'permissive', {}>, wrapper?: ValidComponent) => SolidElement | Promise<SolidElement>;
28
29
  }>;
29
30
  export declare const MarkdownProvider: Component<MarkdownProviderProps>;
30
31
  export declare const useMarkdown: () => MarkdownProviderValue;
@@ -1,7 +1,8 @@
1
1
  import { KeyPath } from '@intlayer/types/keyPath';
2
2
  import { LocalesValues } from '@intlayer/types/module_augmentation';
3
- import { Component, JSX, ValidComponent } from 'solid-js';
3
+ import { Component, ValidComponent } from 'solid-js';
4
4
  import { HTMLComponents } from '../html/types';
5
+ import { SolidElement } from '../solidTypes';
5
6
  import { ParsedMarkdown } from './compiler';
6
7
  export type RenderMarkdownOptions = {
7
8
  components?: HTMLComponents<'permissive', {}>;
@@ -10,15 +11,15 @@ export type RenderMarkdownOptions = {
10
11
  preserveFrontmatter?: boolean;
11
12
  tagfilter?: boolean;
12
13
  };
13
- export declare const renderMarkdown: (content: string | ParsedMarkdown, options?: RenderMarkdownOptions) => Promise<JSX.Element>;
14
- export declare const useMarkdownRenderer: (options?: RenderMarkdownOptions) => (content: string | ParsedMarkdown) => Promise<JSX.Element>;
14
+ export declare const renderMarkdown: (content: string | ParsedMarkdown, options?: RenderMarkdownOptions) => Promise<SolidElement>;
15
+ export declare const useMarkdownRenderer: (options?: RenderMarkdownOptions) => (content: string | ParsedMarkdown) => Promise<SolidElement>;
15
16
  export type MarkdownRendererProps = RenderMarkdownOptions & {
16
17
  dictionaryKey: string;
17
18
  keyPath: KeyPath[];
18
19
  locale?: LocalesValues;
19
20
  children: string | ParsedMarkdown;
20
21
  };
21
- export declare const MarkdownRenderer: (props: MarkdownRendererProps) => JSX.Element;
22
+ export declare const MarkdownRenderer: (props: MarkdownRendererProps) => SolidElement;
22
23
  export type MarkdownMetadataRendererProps = MarkdownRendererProps & {
23
24
  metadataKeyPath: KeyPath[];
24
25
  };
@@ -1,5 +1,5 @@
1
1
  import { CompileOptions, ParsedMarkdown } from '@intlayer/core/markdown';
2
- import { JSX } from 'solid-js';
2
+ import { SolidElement } from '../solidTypes';
3
3
  /**
4
4
  * Intermediate AST produced by `parseMarkdown`.
5
5
  * Pass this to `compileMarkdown` to skip re-parsing when the same content is
@@ -40,4 +40,4 @@ export declare const parseMarkdown: (markdown?: string, options?: CompileOptions
40
40
  * const element = await compileMarkdown('# Hello **world**');
41
41
  * ```
42
42
  */
43
- export declare const compileMarkdown: (input?: string | ParsedMarkdown, options?: CompileOptions) => Promise<JSX.Element>;
43
+ export declare const compileMarkdown: (input?: string | ParsedMarkdown, options?: CompileOptions) => Promise<SolidElement>;
@@ -1,9 +1,9 @@
1
1
  import { DeepTransformContent as DeepTransformContentCore, IInterpreterPluginState as IInterpreterPluginStateCore, Plugins } from '@intlayer/core/interpreter';
2
2
  import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
3
3
  import { NodeType } from '@intlayer/types/nodeType';
4
- import { JSX } from 'solid-js';
5
4
  import { HTMLComponents } from './html/types';
6
5
  import { IntlayerNode } from './IntlayerNode';
6
+ import { SolidElement } from './solidTypes';
7
7
  import * as NodeTypes from '@intlayer/types/nodeType';
8
8
  /** ---------------------------------------------
9
9
  * INTLAYER NODE PLUGIN
@@ -17,7 +17,7 @@ export declare const intlayerNodePlugins: Plugins;
17
17
  export type SolidNodeCond<T> = T extends {
18
18
  props: any;
19
19
  key?: any;
20
- } ? JSX.Element : never;
20
+ } ? SolidElement : never;
21
21
  /** Translation plugin. Replaces node with a locale string if nodeType = Translation. */
22
22
  export declare const solidNodePlugins: Plugins;
23
23
  /** ---------------------------------------------
@@ -28,8 +28,8 @@ export type InsertionCond<T, _S, L extends LocalesValues> = T extends {
28
28
  [NodeTypes.INSERTION]: infer I;
29
29
  fields: readonly (infer F)[];
30
30
  } ? <V extends {
31
- [K in Extract<F, string>]: string | number | JSX.Element;
32
- }>(values: V) => I extends string ? V[keyof V] extends string | number ? IntlayerNode<string> : IntlayerNode<JSX.Element> : DeepTransformContent<I, L> : never;
31
+ [K in Extract<F, string>]: string | number | SolidElement;
32
+ }>(values: V) => I extends string ? V[keyof V] extends string | number ? IntlayerNode<string> : IntlayerNode<SolidElement> : DeepTransformContent<I, L> : never;
33
33
  /** Insertion plugin for Solid. Handles component/element insertion. */
34
34
  export declare const insertionPlugin: Plugins;
35
35
  /**
@@ -37,7 +37,7 @@ export declare const insertionPlugin: Plugins;
37
37
  */
38
38
  export type MarkdownStringCond<T> = T extends string ? IntlayerNode<string, {
39
39
  metadata: DeepTransformContent<string>;
40
- use: (components?: HTMLComponents<'permissive', {}>) => JSX.Element;
40
+ use: (components?: HTMLComponents<'permissive', {}>) => SolidElement;
41
41
  }> : never;
42
42
  /** Markdown string plugin. Replaces string node with a component that render the markdown. */
43
43
  export declare const markdownStringPlugin: Plugins;
@@ -47,7 +47,7 @@ export type MarkdownCond<T> = T extends {
47
47
  metadata?: infer U;
48
48
  tags?: infer U;
49
49
  } ? IntlayerNode<M, {
50
- use: (components?: HTMLComponents<'permissive', U>) => JSX.Element;
50
+ use: (components?: HTMLComponents<'permissive', U>) => SolidElement;
51
51
  metadata: DeepTransformContent<U>;
52
52
  }> : never;
53
53
  export declare const markdownPlugin: Plugins;
@@ -61,7 +61,7 @@ export type HTMLPluginCond<T> = T extends {
61
61
  } ? IntlayerNode<I, {
62
62
  use: (components?: HTMLComponents<'permissive', U>) => IntlayerNode<I>;
63
63
  }> : never;
64
- /** HTML plugin. Replaces node with a function that takes components => JSX.Element. */
64
+ /** HTML plugin. Replaces node with a function that takes components => SolidElement. */
65
65
  export declare const htmlPlugin: Plugins;
66
66
  /** ---------------------------------------------
67
67
  * PLUGINS RESULT
@@ -1,4 +1,5 @@
1
1
  import { Accessor, Component, Context } from 'solid-js';
2
+ import { SolidElement } from './solidTypes';
2
3
  /** Cleanup returned by an effect callback. */
3
4
  type EffectCleanup = void | (() => void);
4
5
  /**
@@ -84,9 +85,14 @@ export declare const lazyComponent: <T extends Component<any>>(load: () => Promi
84
85
  default: T;
85
86
  }>;
86
87
  };
88
+ /** Provider component of a context, in a shape valid for both majors. */
89
+ export type ContextProvider<T> = Component<{
90
+ value: T;
91
+ children?: SolidElement;
92
+ }>;
87
93
  /**
88
94
  * Provider component of a context: `Context.Provider` in Solid 1, the context
89
95
  * object itself in Solid 2.
90
96
  */
91
- export declare const getContextProvider: <T>(context: Context<T>) => Context<T>["Provider"];
97
+ export declare const getContextProvider: <T>(context: Context<T>) => ContextProvider<T>;
92
98
  export {};
@@ -1,2 +1,2 @@
1
- import { JSX } from 'solid-js';
2
- export declare const renderSolidElement: (element: JSX.Element) => any;
1
+ import { SolidElement } from '../solidTypes';
2
+ export declare const renderSolidElement: (element: SolidElement) => any;
@@ -0,0 +1,15 @@
1
+ import { Component, ComponentProps, ValidComponent } from 'solid-js';
2
+ /**
3
+ * Anything a component can render: `JSX.Element` in Solid 1, `Element` in
4
+ * Solid 2.
5
+ */
6
+ export type SolidElement = ReturnType<Component>;
7
+ /**
8
+ * Props of the intrinsic element `Tag`. Solid 1 types them in `solid-js`;
9
+ * Solid 2 keeps DOM attribute types in its web runtime, which this package
10
+ * cannot import, so they stay open there.
11
+ */
12
+ export type IntrinsicElementProps<Tag extends string> = Tag extends ValidComponent ? ComponentProps<Tag> : {
13
+ [attribute: string]: any;
14
+ children?: SolidElement;
15
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "solid-intlayer",
3
- "version": "9.9.0",
3
+ "version": "9.9.1",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Solid applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -114,14 +114,16 @@
114
114
  "typecheck": "tsc --noEmit --project tsconfig.types.json"
115
115
  },
116
116
  "dependencies": {
117
- "@intlayer/api": "9.9.0",
118
- "@intlayer/config": "9.9.0",
119
- "@intlayer/core": "9.9.0",
120
- "@intlayer/editor": "9.9.0",
121
- "@intlayer/types": "9.9.0"
117
+ "@intlayer/api": "9.9.1",
118
+ "@intlayer/config": "9.9.1",
119
+ "@intlayer/core": "9.9.1",
120
+ "@intlayer/editor": "9.9.1",
121
+ "@intlayer/types": "9.9.1"
122
122
  },
123
123
  "devDependencies": {
124
124
  "@solidjs/testing-library": "0.8.10",
125
+ "@solidjs/vite-plugin": "3.0.1",
126
+ "@solidjs/web": "2.0.4",
125
127
  "@testing-library/jest-dom": "8.0.0",
126
128
  "@testing-library/user-event": "14.6.13",
127
129
  "@types/node": "^26",
@@ -131,13 +133,13 @@
131
133
  "@utils/tsdown-config": "1.0.4",
132
134
  "jsdom": "31.0.1",
133
135
  "rimraf": "6.1.4",
134
- "solid-js": "2.0.3",
136
+ "solid-js": "2.0.4",
135
137
  "tsdown": "0.23.7",
136
138
  "typescript": "7.0.2",
137
139
  "vite": "8.3.8",
138
140
  "vite-plugin-dts": "5.1.2",
139
141
  "vite-plugin-solid": "2.11.17",
140
- "vitest": "5.1.1"
142
+ "vitest": "5.1.2"
141
143
  },
142
144
  "peerDependencies": {
143
145
  "@solidjs/web": ">=2.0.0",
@@ -149,7 +151,7 @@
149
151
  }
150
152
  },
151
153
  "optionalDependencies": {
152
- "@intlayer/analytics": "9.9.0"
154
+ "@intlayer/analytics": "9.9.1"
153
155
  },
154
156
  "engines": {
155
157
  "node": ">=14.18"