@ankhorage/surface 0.0.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.
Files changed (135) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -0
  3. package/dist/context/FontContext.d.ts +20 -0
  4. package/dist/context/FontContext.d.ts.map +1 -0
  5. package/dist/context/FontContext.js +25 -0
  6. package/dist/context/FontContext.js.map +1 -0
  7. package/dist/context/TranslationContext.d.ts +22 -0
  8. package/dist/context/TranslationContext.d.ts.map +1 -0
  9. package/dist/context/TranslationContext.js +26 -0
  10. package/dist/context/TranslationContext.js.map +1 -0
  11. package/dist/core/responsive/ResponsiveProvider.d.ts +7 -0
  12. package/dist/core/responsive/ResponsiveProvider.d.ts.map +1 -0
  13. package/dist/core/responsive/ResponsiveProvider.js +20 -0
  14. package/dist/core/responsive/ResponsiveProvider.js.map +1 -0
  15. package/dist/core/responsive/breakpoints.d.ts +9 -0
  16. package/dist/core/responsive/breakpoints.d.ts.map +1 -0
  17. package/dist/core/responsive/breakpoints.js +9 -0
  18. package/dist/core/responsive/breakpoints.js.map +1 -0
  19. package/dist/core/responsive/getBreakpointFromWidth.d.ts +3 -0
  20. package/dist/core/responsive/getBreakpointFromWidth.d.ts.map +1 -0
  21. package/dist/core/responsive/getBreakpointFromWidth.js +10 -0
  22. package/dist/core/responsive/getBreakpointFromWidth.js.map +1 -0
  23. package/dist/core/responsive/index.d.ts +7 -0
  24. package/dist/core/responsive/index.d.ts.map +1 -0
  25. package/dist/core/responsive/index.js +6 -0
  26. package/dist/core/responsive/index.js.map +1 -0
  27. package/dist/core/responsive/resolve.d.ts +3 -0
  28. package/dist/core/responsive/resolve.d.ts.map +1 -0
  29. package/dist/core/responsive/resolve.js +21 -0
  30. package/dist/core/responsive/resolve.js.map +1 -0
  31. package/dist/core/responsive/types.d.ts +8 -0
  32. package/dist/core/responsive/types.d.ts.map +1 -0
  33. package/dist/core/responsive/types.js +2 -0
  34. package/dist/core/responsive/types.js.map +1 -0
  35. package/dist/core/responsive/useBreakpoint.d.ts +3 -0
  36. package/dist/core/responsive/useBreakpoint.d.ts.map +1 -0
  37. package/dist/core/responsive/useBreakpoint.js +7 -0
  38. package/dist/core/responsive/useBreakpoint.js.map +1 -0
  39. package/dist/index.d.ts +14 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +10 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/layout/Box.d.ts +10 -0
  44. package/dist/layout/Box.d.ts.map +1 -0
  45. package/dist/layout/Box.js +34 -0
  46. package/dist/layout/Box.js.map +1 -0
  47. package/dist/layout/Container.d.ts +11 -0
  48. package/dist/layout/Container.d.ts.map +1 -0
  49. package/dist/layout/Container.js +24 -0
  50. package/dist/layout/Container.js.map +1 -0
  51. package/dist/layout/Grid.d.ts +14 -0
  52. package/dist/layout/Grid.d.ts.map +1 -0
  53. package/dist/layout/Grid.js +51 -0
  54. package/dist/layout/Grid.js.map +1 -0
  55. package/dist/layout/Show.d.ts +9 -0
  56. package/dist/layout/Show.d.ts.map +1 -0
  57. package/dist/layout/Show.js +8 -0
  58. package/dist/layout/Show.js.map +1 -0
  59. package/dist/layout/Stack.d.ts +14 -0
  60. package/dist/layout/Stack.d.ts.map +1 -0
  61. package/dist/layout/Stack.js +37 -0
  62. package/dist/layout/Stack.js.map +1 -0
  63. package/dist/layout/Template.d.ts +18 -0
  64. package/dist/layout/Template.d.ts.map +1 -0
  65. package/dist/layout/Template.js +36 -0
  66. package/dist/layout/Template.js.map +1 -0
  67. package/dist/layout/helpers.d.ts +56 -0
  68. package/dist/layout/helpers.d.ts.map +1 -0
  69. package/dist/layout/helpers.js +91 -0
  70. package/dist/layout/helpers.js.map +1 -0
  71. package/dist/layout/index.d.ts +13 -0
  72. package/dist/layout/index.d.ts.map +1 -0
  73. package/dist/layout/index.js +7 -0
  74. package/dist/layout/index.js.map +1 -0
  75. package/dist/primitives/heading/Heading.d.ts +4 -0
  76. package/dist/primitives/heading/Heading.d.ts.map +1 -0
  77. package/dist/primitives/heading/Heading.js +30 -0
  78. package/dist/primitives/heading/Heading.js.map +1 -0
  79. package/dist/primitives/heading/index.d.ts +3 -0
  80. package/dist/primitives/heading/index.d.ts.map +1 -0
  81. package/dist/primitives/heading/index.js +2 -0
  82. package/dist/primitives/heading/index.js.map +1 -0
  83. package/dist/primitives/heading/resolveHeadingStyle.d.ts +5 -0
  84. package/dist/primitives/heading/resolveHeadingStyle.d.ts.map +1 -0
  85. package/dist/primitives/heading/resolveHeadingStyle.js +20 -0
  86. package/dist/primitives/heading/resolveHeadingStyle.js.map +1 -0
  87. package/dist/primitives/heading/types.d.ts +12 -0
  88. package/dist/primitives/heading/types.d.ts.map +1 -0
  89. package/dist/primitives/heading/types.js +2 -0
  90. package/dist/primitives/heading/types.js.map +1 -0
  91. package/dist/primitives/icon/Icon.d.ts +20 -0
  92. package/dist/primitives/icon/Icon.d.ts.map +1 -0
  93. package/dist/primitives/icon/Icon.js +19 -0
  94. package/dist/primitives/icon/Icon.js.map +1 -0
  95. package/dist/primitives/icon/index.d.ts +3 -0
  96. package/dist/primitives/icon/index.d.ts.map +1 -0
  97. package/dist/primitives/icon/index.js +2 -0
  98. package/dist/primitives/icon/index.js.map +1 -0
  99. package/dist/primitives/icon/resolveExpoIconComponent.d.ts +11 -0
  100. package/dist/primitives/icon/resolveExpoIconComponent.d.ts.map +1 -0
  101. package/dist/primitives/icon/resolveExpoIconComponent.js +24 -0
  102. package/dist/primitives/icon/resolveExpoIconComponent.js.map +1 -0
  103. package/dist/theme/ThemeContext.d.ts +27 -0
  104. package/dist/theme/ThemeContext.d.ts.map +1 -0
  105. package/dist/theme/ThemeContext.js +53 -0
  106. package/dist/theme/ThemeContext.js.map +1 -0
  107. package/dist/theme/colorEngine.d.ts +22 -0
  108. package/dist/theme/colorEngine.d.ts.map +1 -0
  109. package/dist/theme/colorEngine.js +348 -0
  110. package/dist/theme/colorEngine.js.map +1 -0
  111. package/dist/theme/createTheme.d.ts +5 -0
  112. package/dist/theme/createTheme.d.ts.map +1 -0
  113. package/dist/theme/createTheme.js +109 -0
  114. package/dist/theme/createTheme.js.map +1 -0
  115. package/dist/theme/index.d.ts +6 -0
  116. package/dist/theme/index.d.ts.map +1 -0
  117. package/dist/theme/index.js +6 -0
  118. package/dist/theme/index.js.map +1 -0
  119. package/dist/theme/resolveToken.d.ts +12 -0
  120. package/dist/theme/resolveToken.d.ts.map +1 -0
  121. package/dist/theme/resolveToken.js +19 -0
  122. package/dist/theme/resolveToken.js.map +1 -0
  123. package/dist/theme/types.d.ts +133 -0
  124. package/dist/theme/types.d.ts.map +1 -0
  125. package/dist/theme/types.js +2 -0
  126. package/dist/theme/types.js.map +1 -0
  127. package/dist/utils/deepEqual.d.ts +6 -0
  128. package/dist/utils/deepEqual.d.ts.map +1 -0
  129. package/dist/utils/deepEqual.js +36 -0
  130. package/dist/utils/deepEqual.js.map +1 -0
  131. package/dist/utils/deepMerge.d.ts +6 -0
  132. package/dist/utils/deepMerge.d.ts.map +1 -0
  133. package/dist/utils/deepMerge.js +26 -0
  134. package/dist/utils/deepMerge.js.map +1 -0
  135. package/package.json +62 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ankhorage contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,76 @@
1
+ # @ankhorage/surface
2
+
3
+ `@ankhorage/surface` is the render-foundation package extracted from Ankhorage.
4
+ It owns layout primitives, responsive helpers, theming, typography, generic font and
5
+ translation bridges, and built-in Expo-backed icon rendering.
6
+
7
+ It does not own manifest rendering, action execution, Studio authoring, plugin orchestration,
8
+ or CLI generation. Those concerns stay in the Ankhorage monorepo.
9
+
10
+ ## Installation
11
+
12
+ Install Surface with its required shared contract package and React Native peers:
13
+
14
+ ```bash
15
+ bun add @ankhorage/surface @ankhorage/contracts
16
+ bun add react react-native
17
+ ```
18
+
19
+ If you use the built-in `Icon` primitive, install the Expo icon peers in the host app too:
20
+
21
+ ```bash
22
+ bun add @expo/vector-icons expo-font
23
+ ```
24
+
25
+ ## Basic Usage
26
+
27
+ ```tsx
28
+ import { Box, Heading, Icon, Stack, ThemeProvider } from '@ankhorage/surface';
29
+
30
+ const theme = {
31
+ id: 'app',
32
+ name: 'App',
33
+ mode: 'light',
34
+ colors: {
35
+ primary: '#2563eb',
36
+ },
37
+ };
38
+
39
+ export function Example() {
40
+ return (
41
+ <ThemeProvider initialConfig={theme}>
42
+ <Stack gap="m">
43
+ <Heading level={1}>Hello</Heading>
44
+ <Box p="m">
45
+ <Icon name="home" provider="Ionicons" />
46
+ </Box>
47
+ </Stack>
48
+ </ThemeProvider>
49
+ );
50
+ }
51
+ ```
52
+
53
+ ## Theming
54
+
55
+ Serialized theme configuration types are imported from `@ankhorage/contracts`.
56
+ Surface owns theme creation, resolved runtime theme objects, token lookup, and component
57
+ consumption of those tokens.
58
+
59
+ ## Scope
60
+
61
+ `@ankhorage/surface` includes:
62
+
63
+ - layout primitives
64
+ - heading and icon primitives
65
+ - theme creation and theme context
66
+ - responsive utilities
67
+ - generic font and translation bridges
68
+ - render-only utilities
69
+
70
+ `@ankhorage/surface` does not include:
71
+
72
+ - manifest rendering
73
+ - runtime action execution
74
+ - Studio panels or authoring metadata
75
+ - CLI or project scaffolding logic
76
+ - low-code configuration workflows
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ /**
3
+ * Runtime font state consumed by theme and text primitives.
4
+ */
5
+ export interface FontRuntime {
6
+ /** true when the active font assets have finished loading */
7
+ fontsLoaded: boolean;
8
+ /** The currently active font family id */
9
+ activeFontId: string | null;
10
+ /** Update the active font family id */
11
+ setActiveFontId: (id: string) => void;
12
+ }
13
+ export declare function FontProvider(props: {
14
+ fontsLoaded: boolean;
15
+ activeFontId?: string | null;
16
+ children: React.ReactNode;
17
+ onActiveFontChange?: (id: string) => void;
18
+ }): React.JSX.Element;
19
+ export declare function useFontContext(): FontRuntime;
20
+ //# sourceMappingURL=FontContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FontContext.d.ts","sourceRoot":"","sources":["../../src/context/FontContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAE5E;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6DAA6D;IAC7D,WAAW,EAAE,OAAO,CAAC;IAErB,0CAA0C;IAC1C,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B,uCAAuC;IACvC,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAUD,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kBAAkB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CAC3C,qBAuBA;AAED,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
@@ -0,0 +1,25 @@
1
+ import React, { createContext, useContext, useMemo, useState } from 'react';
2
+ const fallbackRuntime = {
3
+ fontsLoaded: true,
4
+ activeFontId: null,
5
+ setActiveFontId: () => { },
6
+ };
7
+ const FontContext = createContext(fallbackRuntime);
8
+ export function FontProvider(props) {
9
+ const { fontsLoaded, activeFontId: initialActiveFontId = null, children, onActiveFontChange, } = props;
10
+ const [activeFontId, setActiveFontIdState] = useState(initialActiveFontId);
11
+ const value = useMemo(() => ({
12
+ fontsLoaded,
13
+ activeFontId,
14
+ setActiveFontId: (id) => {
15
+ setActiveFontIdState(id);
16
+ if (onActiveFontChange)
17
+ onActiveFontChange(id);
18
+ },
19
+ }), [fontsLoaded, activeFontId, onActiveFontChange]);
20
+ return <FontContext.Provider value={value}>{children}</FontContext.Provider>;
21
+ }
22
+ export function useFontContext() {
23
+ return useContext(FontContext);
24
+ }
25
+ //# sourceMappingURL=FontContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FontContext.js","sourceRoot":"","sources":["../../src/context/FontContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAgB5E,MAAM,eAAe,GAAgB;IACnC,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;AAEnD,MAAM,UAAU,YAAY,CAAC,KAK5B;IACC,MAAM,EACJ,WAAW,EACX,YAAY,EAAE,mBAAmB,GAAG,IAAI,EACxC,QAAQ,EACR,kBAAkB,GACnB,GAAG,KAAK,CAAC;IAEV,MAAM,CAAC,YAAY,EAAE,oBAAoB,CAAC,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAC;IAE3E,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,WAAW;QACX,YAAY;QACZ,eAAe,EAAE,CAAC,EAAU,EAAE,EAAE;YAC9B,oBAAoB,CAAC,EAAE,CAAC,CAAC;YACzB,IAAI,kBAAkB;gBAAE,kBAAkB,CAAC,EAAE,CAAC,CAAC;QACjD,CAAC;KACF,CAAC,EACF,CAAC,WAAW,EAAE,YAAY,EAAE,kBAAkB,CAAC,CAChD,CAAC;IAEF,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;AAC/E,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ /**
3
+ * Minimal translation runtime surface.
4
+ * Do not import i18next types here; keep Surface runtime-agnostic.
5
+ */
6
+ export interface I18nInstance {
7
+ changeLanguage: (lng: string) => Promise<unknown>;
8
+ language?: string;
9
+ t?: Translator;
10
+ }
11
+ export type Translator = (key: string, options?: Record<string, unknown>) => string;
12
+ export interface TranslationRuntime {
13
+ t: Translator;
14
+ i18n: I18nInstance | null;
15
+ }
16
+ export declare function TranslationProvider(props: {
17
+ t: Translator;
18
+ i18n?: I18nInstance | null;
19
+ children: React.ReactNode;
20
+ }): React.JSX.Element;
21
+ export declare function useTranslationContext(): TranslationRuntime;
22
+ //# sourceMappingURL=TranslationContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TranslationContext.d.ts","sourceRoot":"","sources":["../../src/context/TranslationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,CAAC,CAAC,EAAE,UAAU,CAAC;CAChB;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC;AAEpF,MAAM,WAAW,kBAAkB;IACjC,CAAC,EAAE,UAAU,CAAC;IACd,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;CAC3B;AASD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IACzC,CAAC,EAAE,UAAU,CAAC;IACd,IAAI,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC3B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAmBA;AAED,wBAAgB,qBAAqB,IAAI,kBAAkB,CAE1D"}
@@ -0,0 +1,26 @@
1
+ import React, { createContext, useContext, useMemo } from 'react';
2
+ const fallbackRuntime = {
3
+ t: (key) => key,
4
+ i18n: null,
5
+ };
6
+ const TranslationContext = createContext(fallbackRuntime);
7
+ export function TranslationProvider(props) {
8
+ const { t, i18n, children } = props;
9
+ const value = useMemo(() => ({
10
+ t: (key, options) => {
11
+ if (i18n?.t) {
12
+ const result = i18n.t(key, options);
13
+ // If translation returns the key, it's missing in the current dictionary
14
+ if (result !== key)
15
+ return result;
16
+ }
17
+ return t(key, options);
18
+ },
19
+ i18n: i18n ?? null,
20
+ }), [t, i18n, i18n?.language]);
21
+ return <TranslationContext.Provider value={value}>{children}</TranslationContext.Provider>;
22
+ }
23
+ export function useTranslationContext() {
24
+ return useContext(TranslationContext);
25
+ }
26
+ //# sourceMappingURL=TranslationContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TranslationContext.js","sourceRoot":"","sources":["../../src/context/TranslationContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAmBlE,MAAM,eAAe,GAAuB;IAC1C,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG;IACf,IAAI,EAAE,IAAI;CACX,CAAC;AAEF,MAAM,kBAAkB,GAAG,aAAa,CAAC,eAAe,CAAC,CAAC;AAE1D,MAAM,UAAU,mBAAmB,CAAC,KAInC;IACC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEpC,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,CAAC,EAAE,CAAC,GAAW,EAAE,OAAiC,EAAE,EAAE;YACpD,IAAI,IAAI,EAAE,CAAC,EAAE,CAAC;gBACZ,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;gBACpC,yEAAyE;gBACzE,IAAI,MAAM,KAAK,GAAG;oBAAE,OAAO,MAAM,CAAC;YACpC,CAAC;YACD,OAAO,CAAC,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QACzB,CAAC;QACD,IAAI,EAAE,IAAI,IAAI,IAAI;KACnB,CAAC,EACF,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAC1B,CAAC;IAEF,OAAO,CAAC,kBAAkB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,CAAC;AAC7F,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,OAAO,UAAU,CAAC,kBAAkB,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { ResponsiveRuntime } from './types';
3
+ export declare function ResponsiveProvider({ children }: {
4
+ children: React.ReactNode;
5
+ }): React.JSX.Element;
6
+ export declare function useResponsiveRuntime(): ResponsiveRuntime;
7
+ //# sourceMappingURL=ResponsiveProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResponsiveProvider.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/ResponsiveProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAIlE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIjD,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,qBAY7E;AAED,wBAAgB,oBAAoB,IAAI,iBAAiB,CAQxD"}
@@ -0,0 +1,20 @@
1
+ import React, { createContext, useContext, useMemo } from 'react';
2
+ import { useWindowDimensions } from 'react-native';
3
+ import { getBreakpointFromWidth } from './getBreakpointFromWidth';
4
+ const ResponsiveContext = createContext(null);
5
+ export function ResponsiveProvider({ children }) {
6
+ const { width } = useWindowDimensions();
7
+ const value = useMemo(() => ({
8
+ breakpoint: getBreakpointFromWidth(width),
9
+ width,
10
+ }), [width]);
11
+ return <ResponsiveContext.Provider value={value}>{children}</ResponsiveContext.Provider>;
12
+ }
13
+ export function useResponsiveRuntime() {
14
+ const runtime = useContext(ResponsiveContext);
15
+ if (!runtime) {
16
+ throw new Error('useResponsiveRuntime must be used within a ResponsiveProvider');
17
+ }
18
+ return runtime;
19
+ }
20
+ //# sourceMappingURL=ResponsiveProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResponsiveProvider.js","sourceRoot":"","sources":["../../../src/core/responsive/ResponsiveProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,MAAM,iBAAiB,GAAG,aAAa,CAA2B,IAAI,CAAC,CAAC;AAExE,MAAM,UAAU,kBAAkB,CAAC,EAAE,QAAQ,EAAiC;IAC5E,MAAM,EAAE,KAAK,EAAE,GAAG,mBAAmB,EAAE,CAAC;IAExC,MAAM,KAAK,GAAG,OAAO,CACnB,GAAG,EAAE,CAAC,CAAC;QACL,UAAU,EAAE,sBAAsB,CAAC,KAAK,CAAC;QACzC,KAAK;KACN,CAAC,EACF,CAAC,KAAK,CAAC,CACR,CAAC;IAEF,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,oBAAoB;IAClC,MAAM,OAAO,GAAG,UAAU,CAAC,iBAAiB,CAAC,CAAC;IAE9C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,9 @@
1
+ export declare const BREAKPOINTS: {
2
+ readonly base: 0;
3
+ readonly sm: 480;
4
+ readonly md: 768;
5
+ readonly lg: 1024;
6
+ readonly xl: 1280;
7
+ };
8
+ export declare const BREAKPOINT_ORDER: readonly ["base", "sm", "md", "lg", "xl"];
9
+ //# sourceMappingURL=breakpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/breakpoints.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;CAMd,CAAC;AAEX,eAAO,MAAM,gBAAgB,2CAA4C,CAAC"}
@@ -0,0 +1,9 @@
1
+ export const BREAKPOINTS = {
2
+ base: 0,
3
+ sm: 480,
4
+ md: 768,
5
+ lg: 1024,
6
+ xl: 1280,
7
+ };
8
+ export const BREAKPOINT_ORDER = ['base', 'sm', 'md', 'lg', 'xl'];
9
+ //# sourceMappingURL=breakpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"breakpoints.js","sourceRoot":"","sources":["../../../src/core/responsive/breakpoints.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,CAAC;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,GAAG;IACP,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;CACA,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Breakpoint } from './types';
2
+ export declare function getBreakpointFromWidth(width: number): Breakpoint;
3
+ //# sourceMappingURL=getBreakpointFromWidth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBreakpointFromWidth.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/getBreakpointFromWidth.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAMhE"}
@@ -0,0 +1,10 @@
1
+ import { BREAKPOINT_ORDER, BREAKPOINTS } from './breakpoints';
2
+ export function getBreakpointFromWidth(width) {
3
+ let active = 'base';
4
+ for (const key of BREAKPOINT_ORDER) {
5
+ if (width >= BREAKPOINTS[key])
6
+ active = key;
7
+ }
8
+ return active;
9
+ }
10
+ //# sourceMappingURL=getBreakpointFromWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBreakpointFromWidth.js","sourceRoot":"","sources":["../../../src/core/responsive/getBreakpointFromWidth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG9D,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,IAAI,MAAM,GAAe,MAAM,CAAC;IAChC,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;QACnC,IAAI,KAAK,IAAI,WAAW,CAAC,GAAG,CAAC;YAAE,MAAM,GAAG,GAAG,CAAC;IAC9C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { BREAKPOINT_ORDER, BREAKPOINTS } from './breakpoints';
2
+ export { getBreakpointFromWidth } from './getBreakpointFromWidth';
3
+ export { resolveResponsive } from './resolve';
4
+ export { ResponsiveProvider, useResponsiveRuntime } from './ResponsiveProvider';
5
+ export type { Breakpoint, Responsive, ResponsiveRuntime } from './types';
6
+ export { useBreakpoint } from './useBreakpoint';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAChF,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { BREAKPOINT_ORDER, BREAKPOINTS } from './breakpoints';
2
+ export { getBreakpointFromWidth } from './getBreakpointFromWidth';
3
+ export { resolveResponsive } from './resolve';
4
+ export { ResponsiveProvider, useResponsiveRuntime } from './ResponsiveProvider';
5
+ export { useBreakpoint } from './useBreakpoint';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/responsive/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Breakpoint, Responsive } from './types';
2
+ export declare function resolveResponsive<T>(value: Responsive<T> | undefined, breakpoint: Breakpoint): T | undefined;
3
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/resolve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAMtD,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,EAChC,UAAU,EAAE,UAAU,GACrB,CAAC,GAAG,SAAS,CAaf"}
@@ -0,0 +1,21 @@
1
+ import { BREAKPOINT_ORDER } from './breakpoints';
2
+ function isResponsiveRecord(value) {
3
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
4
+ }
5
+ export function resolveResponsive(value, breakpoint) {
6
+ if (value === undefined)
7
+ return undefined;
8
+ if (!isResponsiveRecord(value))
9
+ return value;
10
+ const activeIndex = BREAKPOINT_ORDER.indexOf(breakpoint);
11
+ for (let i = activeIndex; i >= 0; i -= 1) {
12
+ const key = BREAKPOINT_ORDER[i];
13
+ if (!key)
14
+ continue;
15
+ const candidate = value[key];
16
+ if (candidate !== undefined)
17
+ return candidate;
18
+ }
19
+ return undefined;
20
+ }
21
+ //# sourceMappingURL=resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/core/responsive/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD,SAAS,kBAAkB,CAAI,KAAoB;IACjD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAAgC,EAChC,UAAsB;IAEtB,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE7C,MAAM,WAAW,GAAG,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACzD,KAAK,IAAI,CAAC,GAAG,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;QAChC,IAAI,CAAC,GAAG;YAAE,SAAS;QACnB,MAAM,SAAS,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,SAAS,KAAK,SAAS;YAAE,OAAO,SAAS,CAAC;IAChD,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { BREAKPOINTS } from './breakpoints';
2
+ export type Breakpoint = keyof typeof BREAKPOINTS;
3
+ export type Responsive<T> = T | Partial<Record<Breakpoint, T>>;
4
+ export interface ResponsiveRuntime {
5
+ breakpoint: Breakpoint;
6
+ width: number;
7
+ }
8
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,WAAW,CAAC;AAElD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/responsive/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ import type { Breakpoint } from './types';
2
+ export declare function useBreakpoint(): Breakpoint;
3
+ //# sourceMappingURL=useBreakpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBreakpoint.d.ts","sourceRoot":"","sources":["../../../src/core/responsive/useBreakpoint.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,aAAa,IAAI,UAAU,CAG1C"}
@@ -0,0 +1,7 @@
1
+ import { useWindowDimensions } from 'react-native';
2
+ import { getBreakpointFromWidth } from './getBreakpointFromWidth';
3
+ export function useBreakpoint() {
4
+ const { width } = useWindowDimensions();
5
+ return getBreakpointFromWidth(width);
6
+ }
7
+ //# sourceMappingURL=useBreakpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBreakpoint.js","sourceRoot":"","sources":["../../../src/core/responsive/useBreakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,MAAM,UAAU,aAAa;IAC3B,MAAM,EAAE,KAAK,EAAE,GAAG,mBAAmB,EAAE,CAAC;IACxC,OAAO,sBAAsB,CAAC,KAAK,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export type { FontRuntime } from './context/FontContext';
2
+ export { FontProvider, useFontContext } from './context/FontContext';
3
+ export type { I18nInstance, TranslationRuntime, Translator } from './context/TranslationContext';
4
+ export { TranslationProvider, useTranslationContext } from './context/TranslationContext';
5
+ export * from './core/responsive';
6
+ export * from './layout';
7
+ export type { HeadingLevel, HeadingProps } from './primitives/heading';
8
+ export { Heading } from './primitives/heading';
9
+ export type { IconProps, IconProvider } from './primitives/icon';
10
+ export { Icon } from './primitives/icon';
11
+ export * from './theme';
12
+ export { isDeepEqual } from './utils/deepEqual';
13
+ export { deepMerge } from './utils/deepMerge';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { FontProvider, useFontContext } from './context/FontContext';
2
+ export { TranslationProvider, useTranslationContext } from './context/TranslationContext';
3
+ export * from './core/responsive';
4
+ export * from './layout';
5
+ export { Heading } from './primitives/heading';
6
+ export { Icon } from './primitives/icon';
7
+ export * from './theme';
8
+ export { isDeepEqual } from './utils/deepEqual';
9
+ export { deepMerge } from './utils/deepMerge';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { type ViewProps as ReactNativeViewProps } from 'react-native';
3
+ import { type BoxStyleProps } from './helpers';
4
+ export interface BoxProps extends BoxStyleProps {
5
+ children?: React.ReactNode;
6
+ pointerEvents?: ReactNativeViewProps['pointerEvents'];
7
+ testID?: string;
8
+ }
9
+ export declare function Box({ children, pointerEvents, style, testID, ...props }: BoxProps): React.JSX.Element;
10
+ //# sourceMappingURL=Box.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../src/layout/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAIL,KAAK,SAAS,IAAI,oBAAoB,EAEvC,MAAM,cAAc,CAAC;AAItB,OAAO,EAAE,KAAK,aAAa,EAAoB,MAAM,WAAW,CAAC;AAEjE,MAAM,WAAW,QAAS,SAAQ,aAAa;IAC7C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,aAAa,CAAC,EAAE,oBAAoB,CAAC,eAAe,CAAC,CAAC;IACtD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AA2BD,wBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,QAAQ,qBAgBjF"}
@@ -0,0 +1,34 @@
1
+ import React from 'react';
2
+ import { Platform, View, } from 'react-native';
3
+ import { useResponsiveRuntime } from '../core/responsive';
4
+ import { useTheme } from '../theme/ThemeContext';
5
+ import { resolveBoxStyles } from './helpers';
6
+ function resolvePointerEventsStyle(pointerEvents) {
7
+ if (Platform.OS !== 'web' || pointerEvents === undefined)
8
+ return null;
9
+ if (pointerEvents === 'auto' || pointerEvents === 'none') {
10
+ return { pointerEvents };
11
+ }
12
+ return null;
13
+ }
14
+ function resolveViewPointerEvents(pointerEvents) {
15
+ if (pointerEvents === undefined)
16
+ return undefined;
17
+ if (Platform.OS !== 'web')
18
+ return pointerEvents;
19
+ if (pointerEvents === 'box-none' || pointerEvents === 'box-only') {
20
+ return pointerEvents;
21
+ }
22
+ return undefined;
23
+ }
24
+ export function Box({ children, pointerEvents, style, testID, ...props }) {
25
+ const { theme } = useTheme();
26
+ const { breakpoint } = useResponsiveRuntime();
27
+ const resolved = resolveBoxStyles(theme, breakpoint, props);
28
+ const pointerEventsStyle = resolvePointerEventsStyle(pointerEvents);
29
+ const viewPointerEvents = resolveViewPointerEvents(pointerEvents);
30
+ return (<View pointerEvents={viewPointerEvents} testID={testID} style={[resolved, pointerEventsStyle, style]}>
31
+ {children}
32
+ </View>);
33
+ }
34
+ //# sourceMappingURL=Box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Box.js","sourceRoot":"","sources":["../../src/layout/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EAER,IAAI,GAGL,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAsB,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAQjE,SAAS,yBAAyB,CAChC,aAAgE;IAEhE,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,aAAa,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAEtE,IAAI,aAAa,KAAK,MAAM,IAAI,aAAa,KAAK,MAAM,EAAE,CAAC;QACzD,OAAO,EAAE,aAAa,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,wBAAwB,CAC/B,aAAgE;IAEhE,IAAI,aAAa,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAClD,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK;QAAE,OAAO,aAAa,CAAC;IAEhD,IAAI,aAAa,KAAK,UAAU,IAAI,aAAa,KAAK,UAAU,EAAE,CAAC;QACjE,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,EAAY;IAChF,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC9C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,kBAAkB,GAAG,yBAAyB,CAAC,aAAa,CAAC,CAAC;IACpE,MAAM,iBAAiB,GAAG,wBAAwB,CAAC,aAAa,CAAC,CAAC;IAElE,OAAO,CACL,CAAC,IAAI,CACH,aAAa,CAAC,CAAC,iBAAiB,CAAC,CACjC,MAAM,CAAC,CAAC,MAAM,CAAC,CACf,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAA6B,CAAC,CAAC,CAErE;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { type Responsive } from '../core/responsive';
3
+ import type { AnkhTheme } from '../theme/types';
4
+ import { type BoxProps } from './Box';
5
+ export interface ContainerProps extends Omit<BoxProps, 'children'> {
6
+ children?: React.ReactNode;
7
+ maxWidth?: Responsive<number>;
8
+ px?: Responsive<number | keyof AnkhTheme['spacing']>;
9
+ }
10
+ export declare function Container({ children, maxWidth, px, ...props }: ContainerProps): React.JSX.Element;
11
+ //# sourceMappingURL=Container.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../src/layout/Container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAqB,KAAK,UAAU,EAAwB,MAAM,oBAAoB,CAAC;AAE9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG3C,MAAM,WAAW,cAAe,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IAChE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IAC9B,EAAE,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;CACtD;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,QAAsD,EACtD,EAAiC,EACjC,GAAG,KAAK,EACT,EAAE,cAAc,qBAsBhB"}
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { resolveResponsive, useResponsiveRuntime } from '../core/responsive';
4
+ import { useTheme } from '../theme/ThemeContext';
5
+ import { Box } from './Box';
6
+ import { resolveSpacing } from './helpers';
7
+ export function Container({ children, maxWidth = { base: Number.MAX_SAFE_INTEGER, lg: 1120 }, px = { base: 16, md: 24, lg: 32 }, ...props }) {
8
+ const { theme } = useTheme();
9
+ const { breakpoint } = useResponsiveRuntime();
10
+ const activeMaxWidth = resolveResponsive(maxWidth, breakpoint);
11
+ const activePx = resolveSpacing(theme, resolveResponsive(px, breakpoint));
12
+ return (<Box {...props} width="100%" style={[{ width: '100%' }, props.style]}>
13
+ <View style={{
14
+ width: '100%',
15
+ maxWidth: activeMaxWidth,
16
+ alignSelf: 'center',
17
+ paddingLeft: activePx,
18
+ paddingRight: activePx,
19
+ }}>
20
+ {children}
21
+ </View>
22
+ </Box>);
23
+ }
24
+ //# sourceMappingURL=Container.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Container.js","sourceRoot":"","sources":["../../src/layout/Container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAmB,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,GAAG,EAAiB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAQ3C,MAAM,UAAU,SAAS,CAAC,EACxB,QAAQ,EACR,QAAQ,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,gBAAgB,EAAE,EAAE,EAAE,IAAI,EAAE,EACtD,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EACjC,GAAG,KAAK,EACO;IACf,MAAM,EAAE,KAAK,EAAE,GAAG,QAAQ,EAAE,CAAC;IAC7B,MAAM,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAE9C,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,EAAE,iBAAiB,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IAE1E,OAAO,CACL,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CACnE;MAAA,CAAC,IAAI,CACH,KAAK,CAAC,CAAC;YACL,KAAK,EAAE,MAAM;YACb,QAAQ,EAAE,cAAc;YACxB,SAAS,EAAE,QAAQ;YACnB,WAAW,EAAE,QAAQ;YACrB,YAAY,EAAE,QAAQ;SACvB,CAAC,CAEF;QAAA,CAAC,QAAQ,CACX;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { type Responsive } from '../core/responsive';
3
+ import { type BoxProps } from './Box';
4
+ import { type SpaceValue } from './helpers';
5
+ export interface GridProps extends Omit<BoxProps, 'children'> {
6
+ children?: React.ReactNode;
7
+ cols: Responsive<number>;
8
+ gap?: Responsive<SpaceValue>;
9
+ rowGap?: Responsive<SpaceValue>;
10
+ colGap?: Responsive<SpaceValue>;
11
+ minItemWidth?: Responsive<number>;
12
+ }
13
+ export declare function Grid({ children, cols, gap, rowGap, colGap, minItemWidth, ...props }: GridProps): React.JSX.Element;
14
+ //# sourceMappingURL=Grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../src/layout/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAqB,KAAK,UAAU,EAAwB,MAAM,oBAAoB,CAAC;AAE9F,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAkB,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5D,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC3D,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;IACzB,GAAG,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAC7B,MAAM,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAChC,YAAY,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;CACnC;AAED,wBAAgB,IAAI,CAAC,EACnB,QAAQ,EACR,IAAI,EACJ,GAAO,EACP,MAAM,EACN,MAAM,EACN,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,SAAS,qBAyDX"}
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import { View } from 'react-native';
3
+ import { resolveResponsive, useResponsiveRuntime } from '../core/responsive';
4
+ import { useTheme } from '../theme/ThemeContext';
5
+ import { Box } from './Box';
6
+ import { resolveSpacing } from './helpers';
7
+ export function Grid({ children, cols, gap = 0, rowGap, colGap, minItemWidth, ...props }) {
8
+ const { theme } = useTheme();
9
+ const { breakpoint } = useResponsiveRuntime();
10
+ const activeCols = Math.max(1, Math.floor(resolveResponsive(cols, breakpoint) ?? 1));
11
+ const defaultGap = resolveResponsive(gap, breakpoint) ?? 0;
12
+ const activeRowGap = resolveResponsive(rowGap, breakpoint) ?? defaultGap;
13
+ const activeColGap = resolveResponsive(colGap, breakpoint) ?? defaultGap;
14
+ const rowSpacing = Number(resolveSpacing(theme, activeRowGap) ?? 0);
15
+ const colSpacing = Number(resolveSpacing(theme, activeColGap) ?? 0);
16
+ const activeMinItemWidth = resolveResponsive(minItemWidth, breakpoint);
17
+ const basisPercent = `${100 / activeCols}%`;
18
+ const nodes = React.Children.toArray(children);
19
+ return (<Box {...props}>
20
+ <View style={{
21
+ flexDirection: 'row',
22
+ flexWrap: 'wrap',
23
+ marginTop: -rowSpacing / 2,
24
+ marginLeft: -colSpacing / 2,
25
+ marginRight: -colSpacing / 2,
26
+ }}>
27
+ {nodes.map((node, index) => {
28
+ const itemStyle = activeMinItemWidth !== undefined
29
+ ? {
30
+ minWidth: activeMinItemWidth,
31
+ flexBasis: activeMinItemWidth,
32
+ flexGrow: 1,
33
+ }
34
+ : {
35
+ width: basisPercent,
36
+ flexBasis: basisPercent,
37
+ };
38
+ return (<View key={String(index)} style={{
39
+ paddingTop: rowSpacing / 2,
40
+ paddingBottom: rowSpacing / 2,
41
+ paddingLeft: colSpacing / 2,
42
+ paddingRight: colSpacing / 2,
43
+ ...itemStyle,
44
+ }}>
45
+ {node}
46
+ </View>);
47
+ })}
48
+ </View>
49
+ </Box>);
50
+ }
51
+ //# sourceMappingURL=Grid.js.map