@hero-design/rn 0.0.0-mainIsReactNative.5 → 0.0.0-mainIsReactNative.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "0.0.0-mainIsReactNative.5",
3
+ "version": "0.0.0-mainIsReactNative.6",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -20,8 +20,7 @@
20
20
  "build:types": "tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json",
21
21
  "build": "yarn build:js && yarn build:types",
22
22
  "build:watch": "yarn build:js -w & yarn build:types -w",
23
- "publish:npm": "yarn publish --access public",
24
- "set-dev-env": "npm pkg set react-native=src/index.ts"
23
+ "publish:npm": "yarn publish --access public"
25
24
  },
26
25
  "dependencies": {
27
26
  "@emotion/native": "^11.11.0",
package/rollup.config.mjs CHANGED
@@ -8,9 +8,35 @@ import copy from 'rollup-plugin-copy';
8
8
  import flow from 'rollup-plugin-flow';
9
9
  import { visualizer } from 'rollup-plugin-visualizer';
10
10
  import glob from 'glob';
11
- import { fileURLToPath } from 'node:url';
11
+ import { fileURLToPath, pathToFileURL } from 'node:url';
12
+ import { readFileSync } from 'node:fs';
13
+ import { createRequire } from 'node:module';
12
14
  import pkg from './package.json' with { type: 'json' };
13
15
 
16
+ const require = createRequire(import.meta.url);
17
+
18
+ // Inline hero-editor/dist/app.js as a string literal so it can be injected
19
+ // into a WebView without triggering browser-only APIs at module init time.
20
+ const inlineHeroEditorApp = () => ({
21
+ name: 'inline-hero-editor-app',
22
+ resolveId(id) {
23
+ if (id === 'hero-editor/dist/app.js') {
24
+ return pathToFileURL(require.resolve('hero-editor/dist/app.js')).href;
25
+ }
26
+ return null;
27
+ },
28
+ load(id) {
29
+ if (!id.includes('hero-editor/dist/app.js')) return null;
30
+ try {
31
+ const filePath = id.startsWith('file://') ? fileURLToPath(id) : id;
32
+ const content = readFileSync(filePath, 'utf8');
33
+ return `export default ${JSON.stringify(content)};`;
34
+ } catch {
35
+ return null;
36
+ }
37
+ },
38
+ });
39
+
14
40
  const extensions = ['.js', '.jsx', '.ts', '.tsx'];
15
41
 
16
42
  const generateBuildStats = process.env.GENERATE_BUILD_STATS === 'true';
@@ -49,11 +75,12 @@ export default [
49
75
  'react-native-safe-area-context',
50
76
  'react-native-svg',
51
77
  'react-native-vector-icons',
52
- 'react-native-webview',
53
- "hero-editor"
78
+ 'react-native-webview'
54
79
  ],
55
80
  plugins: [
81
+ inlineHeroEditorApp(),
56
82
  replace({
83
+ preventAssignment: true,
57
84
  'process.env.NODE_ENV': JSON.stringify('production'),
58
85
  }),
59
86
  nodeResolve({ extensions, browser: false }),
@@ -1,3 +1,3 @@
1
- import * as heroEditorApp from 'hero-editor/dist/app.js';
1
+ import heroEditorApp from 'hero-editor/dist/app.js';
2
2
 
3
3
  export default heroEditorApp;
package/src/index.ts CHANGED
@@ -79,6 +79,7 @@ import Toolbar from './components/Toolbar';
79
79
  import Typography from './components/Typography';
80
80
  import Rate from './components/Rate';
81
81
  import RefreshControl from './components/RefreshControl';
82
+ import RichTextEditor from './components/RichTextEditor';
82
83
  import PageControl from './components/PageControl';
83
84
  import Portal from './components/Portal';
84
85
  import {
@@ -178,6 +179,7 @@ export {
178
179
  Typography,
179
180
  Rate,
180
181
  RefreshControl,
182
+ RichTextEditor,
181
183
  FloatingIsland,
182
184
  LocaleProvider,
183
185
  FilterTrigger,
@@ -1,2 +1,2 @@
1
- import * as heroEditorApp from 'hero-editor/dist/app.js';
1
+ import heroEditorApp from 'hero-editor/dist/app.js';
2
2
  export default heroEditorApp;
package/types/index.d.ts CHANGED
@@ -55,6 +55,7 @@ import Toolbar from './components/Toolbar';
55
55
  import Typography from './components/Typography';
56
56
  import Rate from './components/Rate';
57
57
  import RefreshControl from './components/RefreshControl';
58
+ import RichTextEditor from './components/RichTextEditor';
58
59
  import PageControl from './components/PageControl';
59
60
  import Portal from './components/Portal';
60
61
  import { ScrollViewWithFAB, SectionListWithFAB, FlatListWithFAB } from './components/AnimatedScroller';
@@ -64,6 +65,6 @@ import FloatingIsland from './components/FloatingIsland';
64
65
  import LocaleProvider from './components/LocaleProvider';
65
66
  import FilterTrigger from './components/FilterTrigger';
66
67
  import InlineLoader, { type InlineLoaderProps } from './components/InlineLoader';
67
- export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagLightSystemPalette, swagLightJobsSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, ehWorkDarkSystemPalette, ehWorkSystemPalette, ehJobsSystemPalette, ehWorkShadowPalette, ehJobsShadowPalette, ehWorkDarkShadowPalette, Accordion, Alert, AppCue, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Chart, Carousel, Chip, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, Error, FAB, FlatListWithFAB, Icon, Illustration, type IllustrationName, IllustrationList, Image, HeroDesignProvider, MapPin, List, PinInput, Progress, Portal, PageControl, Skeleton, Slider, Spinner, Swipeable, Radio, Search, SegmentedControl, ScrollViewWithFAB, SectionHeading, SectionList, SectionListWithFAB, Select, Success, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, Rate, RefreshControl, FloatingIsland, LocaleProvider, FilterTrigger, InlineLoader, type InlineLoaderProps, Confetti, type ConfettiProps, styled, };
68
+ export { theme, getTheme, useTheme, scale, ThemeProvider, ThemeSwitcher, withTheme, swagSystemPalette, swagLightSystemPalette, swagLightJobsSystemPalette, swagDarkSystemPalette, workSystemPalette, jobsSystemPalette, walletSystemPalette, eBensSystemPalette, ehWorkDarkSystemPalette, ehWorkSystemPalette, ehJobsSystemPalette, ehWorkShadowPalette, ehJobsShadowPalette, ehWorkDarkShadowPalette, Accordion, Alert, AppCue, Attachment, Avatar, useAvatarColors, Badge, BottomNavigation, BottomSheet, Box, Button, Calendar, Card, Chart, Carousel, Chip, Collapse, Checkbox, ContentNavigator, DatePicker, Divider, Drawer, Empty, Error, FAB, FlatListWithFAB, Icon, Illustration, type IllustrationName, IllustrationList, Image, HeroDesignProvider, MapPin, List, PinInput, Progress, Portal, PageControl, Skeleton, Slider, Spinner, Swipeable, Radio, Search, SegmentedControl, ScrollViewWithFAB, SectionHeading, SectionList, SectionListWithFAB, Select, Success, Switch, Tabs, Tag, TextInput, TimePicker, Toast, Toolbar, Typography, Rate, RefreshControl, RichTextEditor, FloatingIsland, LocaleProvider, FilterTrigger, InlineLoader, type InlineLoaderProps, Confetti, type ConfettiProps, styled, };
68
69
  export * from './types';
69
70
  export type { ShadowPalette };