@mapples/app 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -92,9 +92,9 @@ export default App;
92
92
 
93
93
  ## API Reference
94
94
 
95
- ### MapplesApp
95
+ ### MapplesApp (default export)
96
96
 
97
- The main component that provides the core Mapples ecosystem functionality.
97
+ The main component that provides the core Mapples ecosystem functionality. It wraps the app with `StyleProvider` and `RenderProvider` (using `@mapples/ui` components and optional `assets`), and handles font loading via `expo-font`.
98
98
 
99
99
  **Props:**
100
100
 
@@ -115,6 +115,18 @@ The main component that provides the core Mapples ecosystem functionality.
115
115
  </MapplesApp>
116
116
  ```
117
117
 
118
+ ### MapplesAppProvider
119
+
120
+ Alias for the same component as `MapplesApp`. Use either the default import or `MapplesAppProvider` when you want to make the provider role explicit.
121
+
122
+ ```tsx
123
+ import MapplesApp, { MapplesAppProvider } from '@mapples/app';
124
+
125
+ // These are equivalent:
126
+ <MapplesApp assets={assets} style={style}>{children}</MapplesApp>
127
+ <MapplesAppProvider assets={assets} style={style}>{children}</MapplesAppProvider>
128
+ ```
129
+
118
130
  ### Utility Functions
119
131
 
120
132
  #### `normalizeKey(key)`
@@ -1 +1 @@
1
- {"version":3,"file":"MapplesApp.d.ts","sourceRoot":"","sources":["../src/MapplesApp.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;AAYzE;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,kFAAkF;IAClF,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,kEAAkE;IAClE,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,4EAA4E;IAC5E,oBAAoB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAoBtD,CAAC;AAEF,eAAe,UAAU,CAAC"}
1
+ {"version":3,"file":"MapplesApp.d.ts","sourceRoot":"","sources":["../src/MapplesApp.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;AAYzE;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,KAAK,CAAC,EAAE,gBAAgB,CAAC;IACzB,kFAAkF;IAClF,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,kEAAkE;IAClE,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,4EAA4E;IAC5E,oBAAoB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAuBtD,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -1,6 +1,7 @@
1
+ import { Components } from '@mapples/components';
1
2
  import { RenderProvider } from '@mapples/render';
2
3
  import { StyleProvider, Styler } from '@mapples/style';
3
- import { Components } from '@mapples/ui';
4
+ import { UIComponents } from '@mapples/ui';
4
5
  import { useFonts } from 'expo-font';
5
6
  // @ts-ignore
6
7
  // eslint-disable-next-line import/no-unresolved
@@ -55,7 +56,7 @@ const MapplesApp = ({ children, style, assets, showFontLoadingIndicator, FontLoa
55
56
  return FontLoadingIndicator || null;
56
57
  }
57
58
  return (<StyleProvider style={Styler.init(style || styleConfig)}>
58
- <RenderProvider components={Components} assets={assets || assetsConfig}>
59
+ <RenderProvider components={{ ...Components, ...UIComponents }} assets={assets || assetsConfig}>
59
60
  {children}
60
61
  </RenderProvider>
61
62
  </StyleProvider>);
@@ -1 +1 @@
1
- {"version":3,"file":"MapplesApp.js","sourceRoot":"","sources":["../src/MapplesApp.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAa,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAoB,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,aAAa;AACb,gDAAgD;AAChD,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAC3C,aAAa;AACb,gDAAgD;AAChD,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAkBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,GAA2C,CAAC,EAC1D,QAAQ,EACR,KAAK,EACL,MAAM,EACN,wBAAwB,EACxB,oBAAoB,GACrB,EAAE,EAAE;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,IAAI,YAAY,CAAC,CAAC,CAAC;IAE9D,IAAI,CAAC,MAAM,IAAI,wBAAwB,EAAE,CAAC;QACxC,OAAO,oBAAoB,IAAI,IAAI,CAAC;IACtC,CAAC;IAED,OAAO,CACL,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,IAAI,WAAW,CAAC,CAAC,CACtD;MAAA,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,UAAU,CAAC,CAAC,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AAU,EAAE,GAAG,YAAY,EAAE,CAAC,CAC/C,MAAM,CAAC,CAAC,MAAM,IAAI,YAAY,CAAC,CAE/B;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,cAAc,CAClB;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,61 @@
1
+ import { FC, PropsWithChildren, JSX } from 'react';
2
+ import { AnyObject } from '@mapples/render';
3
+ import { StyleContextType } from '@mapples/style';
4
+ /**
5
+ * Props for the MapplesApp component.
6
+ *
7
+ * @interface MapplesAppProps
8
+ */
9
+ export interface MapplesAppProps {
10
+ /** Optional custom style configuration to override the default Mapples styling */
11
+ style: StyleContextType;
12
+ /** Optional custom assets configuration to override the default Mapples assets */
13
+ assets: AnyObject;
14
+ /** Whether to show a loading indicator while fonts are loading */
15
+ showFontLoadingIndicator?: boolean;
16
+ /** Custom loading indicator component to display while fonts are loading */
17
+ FontLoadingIndicator?: JSX.Element;
18
+ }
19
+ /**
20
+ * The main MapplesApp component that provides the core Mapples ecosystem functionality.
21
+ *
22
+ * This component sets up the essential providers for styling, rendering, and asset management
23
+ * that are required for all Mapples applications. It handles font loading and provides
24
+ * a unified entry point for the Mapples ecosystem.
25
+ *
26
+ * @component
27
+ * @param props - The component props
28
+ * @returns The configured Mapples app with all necessary providers
29
+ *
30
+ * @example
31
+ * ```tsx
32
+ * import MapplesApp from '@mapples/app';
33
+ *
34
+ * function App() {
35
+ * return (
36
+ * <MapplesApp>
37
+ * <YourAppContent />
38
+ * </MapplesApp>
39
+ * );
40
+ * }
41
+ * ```
42
+ *
43
+ * @example
44
+ * ```tsx
45
+ * import MapplesApp from '@mapples/app';
46
+ *
47
+ * function App() {
48
+ * return (
49
+ * <MapplesApp
50
+ * showFontLoadingIndicator={true}
51
+ * FontLoadingIndicator={<LoadingSpinner />}
52
+ * >
53
+ * <YourAppContent />
54
+ * </MapplesApp>
55
+ * );
56
+ * }
57
+ * ```
58
+ */
59
+ declare const MapplesApp: FC<PropsWithChildren<MapplesAppProps>>;
60
+ export default MapplesApp;
61
+ //# sourceMappingURL=MapplesAppProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapplesAppProvider.d.ts","sourceRoot":"","sources":["../src/MapplesAppProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAkB,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,gBAAgB,CAAC;AAMzE;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,KAAK,EAAE,gBAAgB,CAAC;IACxB,kFAAkF;IAClF,MAAM,EAAE,SAAS,CAAC;IAClB,kEAAkE;IAClE,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,4EAA4E;IAC5E,oBAAoB,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAuBtD,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,59 @@
1
+ import { Components } from '@mapples/components';
2
+ import { RenderProvider } from '@mapples/render';
3
+ import { StyleProvider, Styler } from '@mapples/style';
4
+ import { UIComponents } from '@mapples/ui';
5
+ import { useFonts } from 'expo-font';
6
+ import { remapFonts } from './utils';
7
+ /**
8
+ * The main MapplesApp component that provides the core Mapples ecosystem functionality.
9
+ *
10
+ * This component sets up the essential providers for styling, rendering, and asset management
11
+ * that are required for all Mapples applications. It handles font loading and provides
12
+ * a unified entry point for the Mapples ecosystem.
13
+ *
14
+ * @component
15
+ * @param props - The component props
16
+ * @returns The configured Mapples app with all necessary providers
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * import MapplesApp from '@mapples/app';
21
+ *
22
+ * function App() {
23
+ * return (
24
+ * <MapplesApp>
25
+ * <YourAppContent />
26
+ * </MapplesApp>
27
+ * );
28
+ * }
29
+ * ```
30
+ *
31
+ * @example
32
+ * ```tsx
33
+ * import MapplesApp from '@mapples/app';
34
+ *
35
+ * function App() {
36
+ * return (
37
+ * <MapplesApp
38
+ * showFontLoadingIndicator={true}
39
+ * FontLoadingIndicator={<LoadingSpinner />}
40
+ * >
41
+ * <YourAppContent />
42
+ * </MapplesApp>
43
+ * );
44
+ * }
45
+ * ```
46
+ */
47
+ const MapplesApp = ({ children, style, assets, showFontLoadingIndicator, FontLoadingIndicator, }) => {
48
+ const [loaded] = useFonts(remapFonts(assets));
49
+ if (!loaded && showFontLoadingIndicator) {
50
+ return FontLoadingIndicator || null;
51
+ }
52
+ return (<StyleProvider style={Styler.init(style)}>
53
+ <RenderProvider components={{ ...Components, ...UIComponents }} assets={assets}>
54
+ {children}
55
+ </RenderProvider>
56
+ </StyleProvider>);
57
+ };
58
+ export default MapplesApp;
59
+ //# sourceMappingURL=MapplesAppProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MapplesAppProvider.js","sourceRoot":"","sources":["../src/MapplesAppProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAa,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAoB,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAkBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,MAAM,UAAU,GAA2C,CAAC,EAC1D,QAAQ,EACR,KAAK,EACL,MAAM,EACN,wBAAwB,EACxB,oBAAoB,GACrB,EAAE,EAAE;IACH,MAAM,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;IAE9C,IAAI,CAAC,MAAM,IAAI,wBAAwB,EAAE,CAAC;QACxC,OAAO,oBAAoB,IAAI,IAAI,CAAC;IACtC,CAAC;IAED,OAAO,CACL,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CACvC;MAAA,CAAC,cAAc,CACb,UAAU,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,GAAG,YAAY,EAAE,CAAC,CAC/C,MAAM,CAAC,CAAC,MAAM,CAAC,CAEf;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,cAAc,CAClB;IAAA,EAAE,aAAa,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,UAAU,CAAC"}
package/dist/index.d.ts CHANGED
@@ -9,4 +9,5 @@
9
9
  export { default } from './MapplesApp';
10
10
  export type { MapplesAppProps } from './MapplesApp';
11
11
  export { normalizeKey, remapFonts } from './utils';
12
+ export { default as MapplesAppProvider } from './MapplesAppProvider';
12
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,YAAY,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -8,4 +8,5 @@
8
8
  */
9
9
  export { default } from './MapplesApp';
10
10
  export { normalizeKey, remapFonts } from './utils';
11
+ export { default as MapplesAppProvider } from './MapplesAppProvider';
11
12
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
package/expo/index.js ADDED
@@ -0,0 +1,34 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const mapplesResolver = (resolver) => (context, moduleName, platform) => {
5
+ if (moduleName === 'mapples::style') {
6
+ const config = JSON.parse(
7
+ fs.readFileSync(path.resolve('./.mapplesrc.json'), 'utf-8'),
8
+ );
9
+ const stylePath = path.resolve(
10
+ `./${config.sourceDir}/${config.dirs.style}/style.json`,
11
+ );
12
+
13
+ return context.resolveRequest(context, stylePath, platform);
14
+ }
15
+
16
+ if (moduleName === 'mapples::assets') {
17
+ const config = JSON.parse(
18
+ fs.readFileSync(path.resolve('./.mapplesrc.json'), 'utf-8'),
19
+ );
20
+ const assetsPath = path.resolve(
21
+ `./${config.sourceDir}/${config.dirs.assets}/assetMap`,
22
+ );
23
+
24
+ return context.resolveRequest(context, assetsPath, platform);
25
+ }
26
+
27
+ if (resolver) {
28
+ return resolver(context, moduleName, platform);
29
+ }
30
+
31
+ return context.resolveRequest(context, moduleName, platform);
32
+ };
33
+
34
+ module.exports = { mapplesResolver };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapples/app",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {
@@ -31,6 +31,7 @@
31
31
  "dist",
32
32
  "app.plugin.js",
33
33
  "README.md",
34
- "package.json"
34
+ "package.json",
35
+ "expo/index.js"
35
36
  ]
36
37
  }
package/app.plugin.js DELETED
File without changes