@rimori/react-client 0.4.18-next.1 → 0.4.18-next.3

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.
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { JSX } from 'react';
2
2
  import { Tool } from '@rimori/client';
3
3
  export interface BuddyAssistantAutoStart {
4
4
  /** Pre-written assistant message shown immediately (no AI call) */
package/dist/index.d.ts CHANGED
@@ -12,3 +12,4 @@ export { VoiceRecorder } from './components/ai/EmbeddedAssistent/VoiceRecorder';
12
12
  export { MarkdownEditor } from './components/editor/MarkdownEditor';
13
13
  export type { MarkdownEditorProps, EditorLabels } from './components/editor/MarkdownEditor';
14
14
  export { extractImageUrls } from './components/editor/imageUtils';
15
+ export { injectFederationCss } from './utils/injectFederationCss';
package/dist/index.js CHANGED
@@ -10,3 +10,4 @@ export { BuddyAssistant } from './components/ai/BuddyAssistant';
10
10
  export { VoiceRecorder } from './components/ai/EmbeddedAssistent/VoiceRecorder';
11
11
  export { MarkdownEditor } from './components/editor/MarkdownEditor';
12
12
  export { extractImageUrls } from './components/editor/imageUtils';
13
+ export { injectFederationCss } from './utils/injectFederationCss';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Inject a plugin's Tailwind CSS into the document when a federated module loads.
3
+ * Inserts BEFORE existing stylesheets so rimori-main's responsive classes (e.g. md:hidden)
4
+ * keep higher cascade priority and are not overridden by base utility classes from the plugin.
5
+ *
6
+ * @param pluginId - Unique plugin identifier used as the <style> element id (e.g. 'rimori-plugin-translator')
7
+ * @param cssText - The inlined CSS string (imported via `?inline`)
8
+ */
9
+ export declare function injectFederationCss(pluginId: string, cssText: string): void;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Inject a plugin's Tailwind CSS into the document when a federated module loads.
3
+ * Inserts BEFORE existing stylesheets so rimori-main's responsive classes (e.g. md:hidden)
4
+ * keep higher cascade priority and are not overridden by base utility classes from the plugin.
5
+ *
6
+ * @param pluginId - Unique plugin identifier used as the <style> element id (e.g. 'rimori-plugin-translator')
7
+ * @param cssText - The inlined CSS string (imported via `?inline`)
8
+ */
9
+ export function injectFederationCss(pluginId, cssText) {
10
+ if (typeof document === 'undefined' || !cssText)
11
+ return;
12
+ const id = `${pluginId}-css`;
13
+ if (document.getElementById(id))
14
+ return;
15
+ const style = document.createElement('style');
16
+ style.id = id;
17
+ style.textContent = cssText;
18
+ const firstStyle = document.head.querySelector('style, link[rel="stylesheet"]');
19
+ if (firstStyle) {
20
+ document.head.insertBefore(style, firstStyle);
21
+ }
22
+ else {
23
+ document.head.appendChild(style);
24
+ }
25
+ }
package/eslint.config.js CHANGED
@@ -1,53 +1,35 @@
1
- import js from '@eslint/js';
2
1
  import globals from 'globals';
3
2
  import reactHooks from 'eslint-plugin-react-hooks';
4
- import reactRefresh from 'eslint-plugin-react-refresh';
5
3
  import tseslint from 'typescript-eslint';
6
- import prettier from 'eslint-plugin-prettier';
7
4
  import prettierConfig from 'eslint-config-prettier';
8
5
 
9
6
  export default [
10
- { ignores: ['dist', 'node_modules', 'build', '*.js'] },
11
- js.configs.recommended,
12
- ...tseslint.configs.recommended,
7
+ { ignores: ['dist', 'node_modules', 'build', '*.js', '*.cjs', 'scripts/**'] },
8
+ ...tseslint.configs.recommended.map((config) => ({
9
+ ...config,
10
+ files: ['src/**/*.{ts,tsx}'],
11
+ })),
13
12
  prettierConfig,
14
13
  {
15
- files: ['**/*.{ts,tsx,js,jsx}'],
14
+ files: ['src/**/*.{ts,tsx}'],
16
15
  languageOptions: {
17
16
  ecmaVersion: 2020,
18
17
  globals: {
19
18
  ...globals.browser,
20
19
  ...globals.node,
21
- ...globals.jest,
22
20
  },
23
21
  sourceType: 'module',
24
22
  parserOptions: {
25
- projectService: true,
26
23
  tsconfigRootDir: import.meta.dirname,
27
24
  },
28
25
  },
29
26
  plugins: {
30
27
  'react-hooks': reactHooks,
31
- 'react-refresh': reactRefresh,
32
- prettier: prettier,
33
28
  },
34
29
  rules: {
35
30
  ...reactHooks.configs.recommended.rules,
36
- 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
37
- '@typescript-eslint/no-unused-vars': 'warn',
38
31
  '@typescript-eslint/no-explicit-any': 'warn',
39
- '@typescript-eslint/no-floating-promises': 'warn',
40
- '@typescript-eslint/no-unsafe-argument': 'warn',
41
- '@typescript-eslint/explicit-function-return-type': 'warn',
42
- '@typescript-eslint/explicit-module-boundary-types': 'warn',
43
- '@typescript-eslint/no-unsafe-assignment': 'warn',
44
- '@typescript-eslint/no-unsafe-member-access': 'warn',
45
- '@typescript-eslint/no-unsafe-call': 'warn',
46
- '@typescript-eslint/no-unsafe-return': 'warn',
47
- '@typescript-eslint/no-inferrable-types': 'warn',
48
- '@typescript-eslint/no-non-null-assertion': 'warn',
49
- '@typescript-eslint/ban-ts-comment': 'warn',
50
- 'prettier/prettier': 'error',
32
+ '@typescript-eslint/no-unused-vars': 'warn',
51
33
  },
52
34
  },
53
35
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rimori/react-client",
3
- "version": "0.4.18-next.1",
3
+ "version": "0.4.18-next.3",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,13 +21,13 @@
21
21
  "dev": "tsc -w --preserveWatchOutput",
22
22
  "dev:watch": "tsc -w --preserveWatchOutput",
23
23
  "css-dev": "sass --watch src/style.scss:dist/style.css",
24
- "lint": "eslint . --fix",
24
+ "lint": "npx eslint . --fix",
25
25
  "format": "prettier --write ."
26
26
  },
27
27
  "peerDependencies": {
28
- "@rimori/client": "2.5.29-next.1",
29
- "react": "^18.1.0",
30
- "react-dom": "^18.1.0"
28
+ "@rimori/client": "2.5.29-next.2",
29
+ "react": "^19.0.0",
30
+ "react-dom": "^19.0.0"
31
31
  },
32
32
  "dependencies": {
33
33
  "@tiptap/core": "^2.26.1",
@@ -48,13 +48,10 @@
48
48
  "tiptap-markdown": "^0.8.10"
49
49
  },
50
50
  "devDependencies": {
51
- "@eslint/js": "^9.37.0",
52
- "@rimori/client": "2.5.29-next.1",
53
- "@types/react": "^18.3.21",
51
+ "@rimori/client": "2.5.29-next.2",
52
+ "@types/react": "^19.0.0",
54
53
  "eslint-config-prettier": "^10.1.8",
55
- "eslint-plugin-prettier": "^5.5.4",
56
54
  "eslint-plugin-react-hooks": "^7.0.0",
57
- "eslint-plugin-react-refresh": "^0.4.23",
58
55
  "form-data": "^4.0.2",
59
56
  "globals": "^16.4.0",
60
57
  "node-fetch": "^3.3.2",
@@ -1,4 +1,4 @@
1
- import { useState, useEffect, useRef } from 'react';
1
+ import { JSX, useState, useEffect, useRef } from 'react';
2
2
  import { RimoriClient, MenuEntry } from '@rimori/client';
3
3
 
4
4
  export interface Position {
@@ -1,4 +1,4 @@
1
- import React, { useState, useEffect, useMemo, useRef } from 'react';
1
+ import React, { JSX, useState, useEffect, useMemo, useRef } from 'react';
2
2
  import { CircleAudioAvatar } from './EmbeddedAssistent/CircleAudioAvatar';
3
3
  import { VoiceRecorder } from './EmbeddedAssistent/VoiceRecorder';
4
4
  import { MessageSender, Tool } from '@rimori/client';
package/src/index.ts CHANGED
@@ -13,3 +13,4 @@ export { VoiceRecorder } from './components/ai/EmbeddedAssistent/VoiceRecorder';
13
13
  export { MarkdownEditor } from './components/editor/MarkdownEditor';
14
14
  export type { MarkdownEditorProps, EditorLabels } from './components/editor/MarkdownEditor';
15
15
  export { extractImageUrls } from './components/editor/imageUtils';
16
+ export { injectFederationCss } from './utils/injectFederationCss';
@@ -1,4 +1,4 @@
1
- import React, { createContext, useContext, ReactNode, useEffect, useState } from 'react';
1
+ import React, { createContext, useContext, JSX, ReactNode, useEffect, useState } from 'react';
2
2
  import { EventBusHandler, RimoriClient, StandaloneClient } from '@rimori/client';
3
3
  import type { UserInfo } from '@rimori/client';
4
4
  import posthog from 'posthog-js';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Inject a plugin's Tailwind CSS into the document when a federated module loads.
3
+ * Inserts BEFORE existing stylesheets so rimori-main's responsive classes (e.g. md:hidden)
4
+ * keep higher cascade priority and are not overridden by base utility classes from the plugin.
5
+ *
6
+ * @param pluginId - Unique plugin identifier used as the <style> element id (e.g. 'rimori-plugin-translator')
7
+ * @param cssText - The inlined CSS string (imported via `?inline`)
8
+ */
9
+ export function injectFederationCss(pluginId: string, cssText: string): void {
10
+ if (typeof document === 'undefined' || !cssText) return;
11
+
12
+ const id = `${pluginId}-css`;
13
+ if (document.getElementById(id)) return;
14
+
15
+ const style = document.createElement('style');
16
+ style.id = id;
17
+ style.textContent = cssText;
18
+
19
+ const firstStyle = document.head.querySelector('style, link[rel="stylesheet"]');
20
+ if (firstStyle) {
21
+ document.head.insertBefore(style, firstStyle);
22
+ } else {
23
+ document.head.appendChild(style);
24
+ }
25
+ }