@adminide-stack/yantra-mobile 12.0.171 → 12.0.172-alpha.0
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/lib/compute.js +51 -1
- package/lib/compute.js.map +1 -1
- package/lib/features/apps/AppsCatalog.js +10 -0
- package/lib/features/apps/AppsCatalog.js.map +1 -1
- package/lib/features/apps/mobileAppCatalog.js +9 -0
- package/lib/features/apps/mobileAppCatalog.js.map +1 -1
- package/lib/features/apps/nativeSurfaceTwin.js +2 -1
- package/lib/features/apps/nativeSurfaceTwin.js.map +1 -1
- package/lib/features/canvas/set/agent/prompt.js +4 -5
- package/lib/features/canvas/set/agent/prompt.js.map +1 -1
- package/lib/features/canvas/set/supplyLibrary.js +1294 -2
- package/lib/features/canvas/set/supplyLibrary.js.map +1 -1
- package/lib/features/games/cubeforge3D.js +26 -0
- package/lib/features/games/cubeforge3D.js.map +1 -0
- package/lib/features/games/vendored/core/classroom/permissions.js +76 -0
- package/lib/features/games/vendored/core/classroom/permissions.js.map +1 -0
- package/lib/features/games/vendored/core/classroom/resourceLink.js +101 -0
- package/lib/features/games/vendored/core/classroom/resourceLink.js.map +1 -0
- package/lib/features/games/vendored/core/classroom/rules.js +83 -0
- package/lib/features/games/vendored/core/classroom/rules.js.map +1 -0
- package/lib/features/games/vendored/core/classroom/worldSettings.js +49 -0
- package/lib/features/games/vendored/core/classroom/worldSettings.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/cycle.js +15 -0
- package/lib/features/games/vendored/core/cubeforge/cycle.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/inventory.js +75 -0
- package/lib/features/games/vendored/core/cubeforge/inventory.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/items.js +62 -0
- package/lib/features/games/vendored/core/cubeforge/items.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/nativeWorld.js +4 -0
- package/lib/features/games/vendored/core/cubeforge/nativeWorld.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/recipes.js +52 -0
- package/lib/features/games/vendored/core/cubeforge/recipes.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/save.js +92 -0
- package/lib/features/games/vendored/core/cubeforge/save.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/session.js +154 -0
- package/lib/features/games/vendored/core/cubeforge/session.js.map +1 -0
- package/lib/features/games/vendored/core/cubeforge/worldgen.js +44 -0
- package/lib/features/games/vendored/core/cubeforge/worldgen.js.map +1 -0
- package/lib/features/games/vendored/core/engine/iso.js +41 -0
- package/lib/features/games/vendored/core/engine/iso.js.map +1 -0
- package/lib/features/games/vendored/core/engine/palette.js +53 -0
- package/lib/features/games/vendored/core/engine/palette.js.map +1 -0
- package/lib/features/games/vendored/core/engine/world.js +148 -0
- package/lib/features/games/vendored/core/engine/world.js.map +1 -0
- package/lib/features/games/vendored/core/games/catalog.js +34 -0
- package/lib/features/games/vendored/core/games/catalog.js.map +1 -0
- package/lib/features/games/vendored/core/lessons/lessons.js +97 -0
- package/lib/features/games/vendored/core/lessons/lessons.js.map +1 -0
- package/lib/features/games/vendored/core/logging/events.js +24 -0
- package/lib/features/games/vendored/core/logging/events.js.map +1 -0
- package/lib/features/games/vendored/core/logging/logger.js +54 -0
- package/lib/features/games/vendored/core/logging/logger.js.map +1 -0
- package/lib/features/games/vendored/core/session/gameSession.js +317 -0
- package/lib/features/games/vendored/core/session/gameSession.js.map +1 -0
- package/lib/features/games/vendored/core/storage/worldRepository.js +192 -0
- package/lib/features/games/vendored/core/storage/worldRepository.js.map +1 -0
- package/lib/features/games/vendored/core/store/reactive.js +78 -0
- package/lib/features/games/vendored/core/store/reactive.js.map +1 -0
- package/lib/features/games/vendored/ui/GamesRoot.js +159 -0
- package/lib/features/games/vendored/ui/GamesRoot.js.map +1 -0
- package/lib/features/games/vendored/ui/components/BlockPalette.js +64 -0
- package/lib/features/games/vendored/ui/components/BlockPalette.js.map +1 -0
- package/lib/features/games/vendored/ui/components/IsoCanvas.js +124 -0
- package/lib/features/games/vendored/ui/components/IsoCanvas.js.map +1 -0
- package/lib/features/games/vendored/ui/components/primitives.js +257 -0
- package/lib/features/games/vendored/ui/components/primitives.js.map +1 -0
- package/lib/features/games/vendored/ui/hooks/useReactiveQuery.js +3 -0
- package/lib/features/games/vendored/ui/hooks/useReactiveQuery.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/ActivityScreen.js +68 -0
- package/lib/features/games/vendored/ui/screens/ActivityScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/BuilderScreen.js +227 -0
- package/lib/features/games/vendored/ui/screens/BuilderScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/ClassroomScreen.js +95 -0
- package/lib/features/games/vendored/ui/screens/ClassroomScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js +342 -0
- package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/HubScreen.js +131 -0
- package/lib/features/games/vendored/ui/screens/HubScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/ScreenHeader.js +51 -0
- package/lib/features/games/vendored/ui/screens/ScreenHeader.js.map +1 -0
- package/lib/features/games/vendored/ui/screens/WorldListScreen.js +134 -0
- package/lib/features/games/vendored/ui/screens/WorldListScreen.js.map +1 -0
- package/lib/features/games/vendored/ui/storage/asyncStorageAdapter.js +23 -0
- package/lib/features/games/vendored/ui/storage/asyncStorageAdapter.js.map +1 -0
- package/lib/features/games/vendored/ui/theme.js +53 -0
- package/lib/features/games/vendored/ui/theme.js.map +1 -0
- package/lib/routes.json +50 -0
- package/lib/screens/GamesNative/index.js +30 -0
- package/lib/screens/GamesNative/index.js.map +1 -0
- package/package.json +4 -4
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {useState,useEffect}from'react';import {View,ScrollView,StyleSheet,Text}from'react-native';import'../../core/engine/palette.js';import {SETTING_DESCRIPTIONS,SETTING_LABELS}from'../../core/classroom/worldSettings.js';import {evaluateRules}from'../../core/classroom/rules.js';import {validateResourceLinkUrl,RESOURCE_LINK_MAX_BUTTON_NAME,RESOURCE_LINK_MAX_URL}from'../../core/classroom/resourceLink.js';import {PERMISSION_LEVELS,PERMISSION_LABELS,PERMISSION_DESCRIPTIONS}from'../../core/classroom/permissions.js';import'../../core/lessons/lessons.js';import'../../core/cubeforge/items.js';import'../../core/cubeforge/recipes.js';import {spacing}from'../theme.js';import {useReactiveQuery}from'../hooks/useReactiveQuery.js';import {SectionHeader,Card,TextField,SettingRow,Toggle,SegmentedControl}from'../components/primitives.js';import {ScreenHeader}from'./ScreenHeader.js';const MASTER_KEYS = ["immutableWorld", "destructiveItems", "playerDamage", "mobsRestricted", "perfectWeather", "showBorderEffects"];
|
|
2
|
+
const ADVANCED_KEYS = ["tntExplodes", "respawnBlocksExplode", "fireSpreads", "pvp", "friendlyFire", "mobSpawning", "weatherCycle"];
|
|
3
|
+
function ClassroomScreen(props) {
|
|
4
|
+
const {
|
|
5
|
+
theme,
|
|
6
|
+
session,
|
|
7
|
+
onBack
|
|
8
|
+
} = props;
|
|
9
|
+
const state = useReactiveQuery(session.query);
|
|
10
|
+
const rules = evaluateRules(state.settings);
|
|
11
|
+
const [buttonName, setButtonName] = useState(state.settings.resourceLink.buttonName);
|
|
12
|
+
const [url, setUrl] = useState(state.settings.resourceLink.url);
|
|
13
|
+
const urlValidation = validateResourceLinkUrl(url);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (urlValidation.ok) {
|
|
16
|
+
session.setResourceLink({
|
|
17
|
+
buttonName,
|
|
18
|
+
url: urlValidation.empty ? "" : url
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}, [buttonName, url]);
|
|
22
|
+
const renderToggle = (key) => {
|
|
23
|
+
const rule = rules[key];
|
|
24
|
+
return /* @__PURE__ */ jsx(SettingRow, { theme, label: SETTING_LABELS[key], description: SETTING_DESCRIPTIONS[key], locked: rule.locked, lockedReason: rule.lockedReason, children: /* @__PURE__ */ jsx(Toggle, { theme, value: rule.value, disabled: rule.locked, onValueChange: (next) => session.setBooleanSetting(key, next) }) }, key);
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsxs(View, { style: {
|
|
27
|
+
flex: 1,
|
|
28
|
+
backgroundColor: theme.bg
|
|
29
|
+
}, children: [
|
|
30
|
+
/* @__PURE__ */ jsx(ScreenHeader, { theme, title: "Classroom", onBack, backLabel: "Done" }),
|
|
31
|
+
/* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.content, children: [
|
|
32
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.intro, {
|
|
33
|
+
color: theme.textMuted
|
|
34
|
+
}], children: "Set the rules for this world. Some rules lock others - for example, turning off destructive items also disables explosions and fire." }),
|
|
35
|
+
/* @__PURE__ */ jsx(SectionHeader, { theme, title: "World rules" }),
|
|
36
|
+
/* @__PURE__ */ jsx(Card, { theme, style: styles.group, children: MASTER_KEYS.map(renderToggle) }),
|
|
37
|
+
/* @__PURE__ */ jsx(SectionHeader, { theme, title: "Advanced rules" }),
|
|
38
|
+
/* @__PURE__ */ jsx(Card, { theme, style: styles.group, children: ADVANCED_KEYS.map(renderToggle) }),
|
|
39
|
+
/* @__PURE__ */ jsx(SectionHeader, { theme, title: "Resource link" }),
|
|
40
|
+
/* @__PURE__ */ jsxs(Card, { theme, style: {
|
|
41
|
+
gap: spacing.md
|
|
42
|
+
}, children: [
|
|
43
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.hint, {
|
|
44
|
+
color: theme.textMuted
|
|
45
|
+
}], children: "Add a button students can tap in the world to open a web page you choose. Only https and http links to public sites are allowed." }),
|
|
46
|
+
/* @__PURE__ */ jsx(TextField, { theme, label: "Button name", value: buttonName, onChangeText: setButtonName, placeholder: "Open Link", maxLength: RESOURCE_LINK_MAX_BUTTON_NAME }),
|
|
47
|
+
/* @__PURE__ */ jsx(TextField, { theme, label: "Link URL", value: url, onChangeText: setUrl, placeholder: "https://example.com/lesson", maxLength: RESOURCE_LINK_MAX_URL, autoCapitalize: "none", keyboardType: "url", error: "message" in urlValidation ? urlValidation.message : void 0 })
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ jsx(SectionHeader, { theme, title: "Players & permissions" }),
|
|
50
|
+
/* @__PURE__ */ jsxs(Card, { theme, style: styles.group, children: [
|
|
51
|
+
/* @__PURE__ */ jsx(SettingRow, { theme, label: "Host this world", description: "Let other players join your world.", children: /* @__PURE__ */ jsx(Toggle, { theme, value: state.permissions.hostEnabled, onValueChange: (next) => session.setHostEnabled(next) }) }),
|
|
52
|
+
/* @__PURE__ */ jsxs(View, { style: {
|
|
53
|
+
paddingTop: spacing.md,
|
|
54
|
+
gap: spacing.sm
|
|
55
|
+
}, children: [
|
|
56
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.permLabel, {
|
|
57
|
+
color: theme.text
|
|
58
|
+
}], children: "Default player permission" }),
|
|
59
|
+
/* @__PURE__ */ jsx(SegmentedControl, { theme, value: state.permissions.defaultLevel, onChange: (level) => session.setDefaultLevel(level), options: PERMISSION_LEVELS.map((level) => ({
|
|
60
|
+
value: level,
|
|
61
|
+
label: PERMISSION_LABELS[level]
|
|
62
|
+
})) }),
|
|
63
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.hint, {
|
|
64
|
+
color: theme.textMuted
|
|
65
|
+
}], children: PERMISSION_DESCRIPTIONS[state.permissions.defaultLevel] })
|
|
66
|
+
] })
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ jsx(View, { style: {
|
|
69
|
+
height: spacing.xxl
|
|
70
|
+
} })
|
|
71
|
+
] })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
const styles = StyleSheet.create({
|
|
75
|
+
content: {
|
|
76
|
+
padding: spacing.lg,
|
|
77
|
+
gap: spacing.sm
|
|
78
|
+
},
|
|
79
|
+
intro: {
|
|
80
|
+
fontSize: 14,
|
|
81
|
+
lineHeight: 20,
|
|
82
|
+
marginBottom: spacing.sm
|
|
83
|
+
},
|
|
84
|
+
group: {
|
|
85
|
+
paddingVertical: 0
|
|
86
|
+
},
|
|
87
|
+
hint: {
|
|
88
|
+
fontSize: 13,
|
|
89
|
+
lineHeight: 18
|
|
90
|
+
},
|
|
91
|
+
permLabel: {
|
|
92
|
+
fontSize: 15,
|
|
93
|
+
fontWeight: "600"
|
|
94
|
+
}
|
|
95
|
+
});export{ClassroomScreen};//# sourceMappingURL=ClassroomScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClassroomScreen.js","sources":["../../../../../../src/features/games/vendored/ui/screens/ClassroomScreen.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useEffect, useState } from 'react';\nimport { ScrollView, StyleSheet, Text, View } from 'react-native';\nimport {\n BOOLEAN_SETTING_KEYS,\n evaluateRules,\n PERMISSION_DESCRIPTIONS,\n PERMISSION_LABELS,\n PERMISSION_LEVELS,\n RESOURCE_LINK_MAX_BUTTON_NAME,\n RESOURCE_LINK_MAX_URL,\n SETTING_DESCRIPTIONS,\n SETTING_LABELS,\n validateResourceLinkUrl,\n type BooleanSettingKey,\n type GameSession,\n type PermissionLevel,\n} from '../../core';\nimport { spacing, type Theme } from '../theme';\nimport { useReactiveQuery } from '../hooks/useReactiveQuery';\nimport { Card, SectionHeader, SegmentedControl, SettingRow, TextField, Toggle } from '../components/primitives';\nimport { ScreenHeader } from './ScreenHeader';\n\nconst MASTER_KEYS: BooleanSettingKey[] = [\n 'immutableWorld',\n 'destructiveItems',\n 'playerDamage',\n 'mobsRestricted',\n 'perfectWeather',\n 'showBorderEffects',\n];\n\nconst ADVANCED_KEYS: BooleanSettingKey[] = [\n 'tntExplodes',\n 'respawnBlocksExplode',\n 'fireSpreads',\n 'pvp',\n 'friendlyFire',\n 'mobSpawning',\n 'weatherCycle',\n];\n\nexport function ClassroomScreen(props: { theme: Theme; session: GameSession; onBack: () => void }): React.ReactElement {\n const { theme, session, onBack } = props;\n const state = useReactiveQuery(session.query);\n const rules = evaluateRules(state.settings);\n\n const [buttonName, setButtonName] = useState(state.settings.resourceLink.buttonName);\n const [url, setUrl] = useState(state.settings.resourceLink.url);\n const urlValidation = validateResourceLinkUrl(url);\n\n // Commit a valid (or empty) resource link to the session as the teacher edits.\n useEffect(() => {\n if (urlValidation.ok) {\n session.setResourceLink({ buttonName, url: urlValidation.empty ? '' : url });\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [buttonName, url]);\n\n const renderToggle = (key: BooleanSettingKey) => {\n const rule = rules[key];\n return (\n <SettingRow\n key={key}\n theme={theme}\n label={SETTING_LABELS[key]}\n description={SETTING_DESCRIPTIONS[key]}\n locked={rule.locked}\n lockedReason={rule.lockedReason}\n >\n <Toggle\n theme={theme}\n value={rule.value}\n disabled={rule.locked}\n onValueChange={(next) => session.setBooleanSetting(key, next)}\n />\n </SettingRow>\n );\n };\n\n return (\n <View style={{ flex: 1, backgroundColor: theme.bg }}>\n <ScreenHeader theme={theme} title=\"Classroom\" onBack={onBack} backLabel=\"Done\" />\n <ScrollView contentContainerStyle={styles.content}>\n <Text style={[styles.intro, { color: theme.textMuted }]}>\n Set the rules for this world. Some rules lock others - for example, turning off destructive items\n also disables explosions and fire.\n </Text>\n\n <SectionHeader theme={theme} title=\"World rules\" />\n <Card theme={theme} style={styles.group}>\n {MASTER_KEYS.map(renderToggle)}\n </Card>\n\n <SectionHeader theme={theme} title=\"Advanced rules\" />\n <Card theme={theme} style={styles.group}>\n {ADVANCED_KEYS.map(renderToggle)}\n </Card>\n\n <SectionHeader theme={theme} title=\"Resource link\" />\n <Card theme={theme} style={{ gap: spacing.md }}>\n <Text style={[styles.hint, { color: theme.textMuted }]}>\n Add a button students can tap in the world to open a web page you choose. Only https and http\n links to public sites are allowed.\n </Text>\n <TextField\n theme={theme}\n label=\"Button name\"\n value={buttonName}\n onChangeText={setButtonName}\n placeholder=\"Open Link\"\n maxLength={RESOURCE_LINK_MAX_BUTTON_NAME}\n />\n <TextField\n theme={theme}\n label=\"Link URL\"\n value={url}\n onChangeText={setUrl}\n placeholder=\"https://example.com/lesson\"\n maxLength={RESOURCE_LINK_MAX_URL}\n autoCapitalize=\"none\"\n keyboardType=\"url\"\n error={'message' in urlValidation ? urlValidation.message : undefined}\n />\n </Card>\n\n <SectionHeader theme={theme} title=\"Players & permissions\" />\n <Card theme={theme} style={styles.group}>\n <SettingRow theme={theme} label=\"Host this world\" description=\"Let other players join your world.\">\n <Toggle\n theme={theme}\n value={state.permissions.hostEnabled}\n onValueChange={(next) => session.setHostEnabled(next)}\n />\n </SettingRow>\n <View style={{ paddingTop: spacing.md, gap: spacing.sm }}>\n <Text style={[styles.permLabel, { color: theme.text }]}>Default player permission</Text>\n <SegmentedControl\n theme={theme}\n value={state.permissions.defaultLevel}\n onChange={(level: PermissionLevel) => session.setDefaultLevel(level)}\n options={PERMISSION_LEVELS.map((level) => ({\n value: level,\n label: PERMISSION_LABELS[level],\n }))}\n />\n <Text style={[styles.hint, { color: theme.textMuted }]}>\n {PERMISSION_DESCRIPTIONS[state.permissions.defaultLevel]}\n </Text>\n </View>\n </Card>\n\n <View style={{ height: spacing.xxl }} />\n </ScrollView>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n content: { padding: spacing.lg, gap: spacing.sm },\n intro: { fontSize: 14, lineHeight: 20, marginBottom: spacing.sm },\n group: { paddingVertical: 0 },\n hint: { fontSize: 13, lineHeight: 18 },\n permLabel: { fontSize: 15, fontWeight: '600' },\n});\n"],"names":[],"mappings":"w5BAQA,MAAM,cAAmC,CAAC,gBAAA,EAAkB,oBAAoB,cAAgB,EAAA,gBAAA,EAAkB,kBAAkB,mBAAmB,CAAA;AACvJ,MAAM,aAAA,GAAqC,CAAC,aAAe,EAAA,sBAAA,EAAwB,eAAe,KAAO,EAAA,cAAA,EAAgB,eAAe,cAAc,CAAA;AAC/I,SAAS,gBAAgB,KAIT,EAAA;AACrB,EAAM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AA;AAAA,IACT,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA;AAEhB,CAAC,CAAA"}
|
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import*as React from'react';import {View,Text,StyleSheet,ScrollView,Pressable}from'react-native';import'../../core/engine/palette.js';import'../../core/lessons/lessons.js';import {itemByKey}from'../../core/cubeforge/items.js';import'../../core/cubeforge/recipes.js';import {spacing,radius}from'../theme.js';import {useReactiveQuery}from'../hooks/useReactiveQuery.js';import {Button,SegmentedControl,SectionHeader}from'../components/primitives.js';import {IsoCanvas}from'../components/IsoCanvas.js';import {ScreenHeader}from'./ScreenHeader.js';function CubeforgeScreen(props) {
|
|
2
|
+
const {
|
|
3
|
+
theme,
|
|
4
|
+
session,
|
|
5
|
+
onBack,
|
|
6
|
+
onPlay3D
|
|
7
|
+
} = props;
|
|
8
|
+
const state = useReactiveQuery(session.query);
|
|
9
|
+
const [tool, setTool] = React.useState("gather");
|
|
10
|
+
const onCellTap = (x, y) => {
|
|
11
|
+
if (tool === "gather") session.gather(x, y);
|
|
12
|
+
else session.place(x, y);
|
|
13
|
+
};
|
|
14
|
+
const night = state.phase === "night";
|
|
15
|
+
const energyPct = Math.round(state.energy / state.energyMax * 100);
|
|
16
|
+
return /* @__PURE__ */ jsxs(View, { style: {
|
|
17
|
+
flex: 1,
|
|
18
|
+
backgroundColor: theme.bg
|
|
19
|
+
}, children: [
|
|
20
|
+
/* @__PURE__ */ jsx(ScreenHeader, { theme, title: "Cubeforge", onBack, backLabel: "Games", right: /* @__PURE__ */ jsx(Text, { onPress: () => session.rest(), style: [styles.headerAction, {
|
|
21
|
+
color: theme.primary
|
|
22
|
+
}], children: "Rest" }) }),
|
|
23
|
+
/* @__PURE__ */ jsxs(ScrollView, { contentContainerStyle: styles.content, children: [
|
|
24
|
+
onPlay3D ? /* @__PURE__ */ jsxs(View, { style: [styles.play3d, {
|
|
25
|
+
backgroundColor: theme.surface,
|
|
26
|
+
borderColor: theme.border
|
|
27
|
+
}], children: [
|
|
28
|
+
/* @__PURE__ */ jsxs(View, { style: styles.play3dText, children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.statusValue, {
|
|
30
|
+
color: theme.text
|
|
31
|
+
}], children: "First-person 3D" }),
|
|
32
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.statusLabel, {
|
|
33
|
+
color: theme.textMuted
|
|
34
|
+
}], children: "Walk an endless world. Same rules, its own save." })
|
|
35
|
+
] }),
|
|
36
|
+
/* @__PURE__ */ jsx(Button, { theme, label: "Play in 3D", onPress: onPlay3D })
|
|
37
|
+
] }) : null,
|
|
38
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.statusRow, {
|
|
39
|
+
backgroundColor: theme.surface,
|
|
40
|
+
borderColor: theme.border
|
|
41
|
+
}], children: [
|
|
42
|
+
/* @__PURE__ */ jsxs(View, { style: styles.statusCell, children: [
|
|
43
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.statusValue, {
|
|
44
|
+
color: theme.text
|
|
45
|
+
}], children: [
|
|
46
|
+
night ? "\u{1F319}" : "\u2600\uFE0F",
|
|
47
|
+
" ",
|
|
48
|
+
night ? "Night" : "Day",
|
|
49
|
+
" ",
|
|
50
|
+
state.day
|
|
51
|
+
] }),
|
|
52
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.statusLabel, {
|
|
53
|
+
color: theme.textMuted
|
|
54
|
+
}], children: night ? "Rest to start a new day" : "Gather while it is light" })
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsxs(View, { style: styles.statusCellRight, children: [
|
|
57
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.statusValue, {
|
|
58
|
+
color: theme.text
|
|
59
|
+
}], children: [
|
|
60
|
+
"\u26A1 ",
|
|
61
|
+
state.energy,
|
|
62
|
+
"/",
|
|
63
|
+
state.energyMax
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsx(View, { style: [styles.energyTrack, {
|
|
66
|
+
backgroundColor: theme.surfaceAlt
|
|
67
|
+
}], children: /* @__PURE__ */ jsx(View, { style: [styles.energyFill, {
|
|
68
|
+
backgroundColor: energyColor(theme, energyPct),
|
|
69
|
+
width: `${energyPct}%`
|
|
70
|
+
}] }) })
|
|
71
|
+
] })
|
|
72
|
+
] }),
|
|
73
|
+
state.energy === 0 ? /* @__PURE__ */ jsx(View, { style: [styles.hint, {
|
|
74
|
+
backgroundColor: theme.surfaceAlt,
|
|
75
|
+
borderColor: theme.border
|
|
76
|
+
}], children: /* @__PURE__ */ jsxs(Text, { style: [styles.hintText, {
|
|
77
|
+
color: theme.textMuted
|
|
78
|
+
}], children: [
|
|
79
|
+
"\u{1F634} Out of energy. Tap ",
|
|
80
|
+
/* @__PURE__ */ jsx(Text, { style: {
|
|
81
|
+
color: theme.primary,
|
|
82
|
+
fontWeight: "700"
|
|
83
|
+
}, children: "Rest" }),
|
|
84
|
+
" ",
|
|
85
|
+
"to recover and begin the next day."
|
|
86
|
+
] }) }) : null,
|
|
87
|
+
/* @__PURE__ */ jsxs(View, { style: [styles.canvasWrap, {
|
|
88
|
+
backgroundColor: night ? theme.surfaceAlt : theme.surface,
|
|
89
|
+
borderColor: theme.border
|
|
90
|
+
}], children: [
|
|
91
|
+
/* @__PURE__ */ jsx(IsoCanvas, { bounds: state.bounds, blocks: state.blocks, theme, onCellTap }),
|
|
92
|
+
night ? /* @__PURE__ */ jsx(View, { pointerEvents: "none", style: [styles.nightTint, {
|
|
93
|
+
backgroundColor: theme.overlay
|
|
94
|
+
}] }) : null
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ jsx(SegmentedControl, { theme, value: tool, onChange: setTool, options: [{
|
|
97
|
+
value: "gather",
|
|
98
|
+
label: "\u26CF Gather"
|
|
99
|
+
}, {
|
|
100
|
+
value: "place",
|
|
101
|
+
label: "\u{1F9F1} Place"
|
|
102
|
+
}] }),
|
|
103
|
+
/* @__PURE__ */ jsx(SectionHeader, { theme, title: "Inventory" }),
|
|
104
|
+
state.inventory.length === 0 ? /* @__PURE__ */ jsx(Text, { style: [styles.empty, {
|
|
105
|
+
color: theme.textMuted
|
|
106
|
+
}], children: "Nothing yet - switch to Gather and tap the world to collect materials." }) : /* @__PURE__ */ jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, contentContainerStyle: styles.invRow, children: state.inventory.map((slot) => /* @__PURE__ */ jsx(ItemChip, { theme, slot, selected: slot.item.key === state.selectedItem, onPress: () => session.selectItem(slot.item.key) }, slot.item.key)) }),
|
|
107
|
+
/* @__PURE__ */ jsx(SectionHeader, { theme, title: "Craft" }),
|
|
108
|
+
/* @__PURE__ */ jsx(View, { style: [styles.craftCard, {
|
|
109
|
+
backgroundColor: theme.surface,
|
|
110
|
+
borderColor: theme.border
|
|
111
|
+
}], children: state.recipes.map((view, i) => /* @__PURE__ */ jsx(RecipeRow, { theme, view, last: i === state.recipes.length - 1, onCraft: () => session.craft(view.recipe.id) }, view.recipe.id)) }),
|
|
112
|
+
/* @__PURE__ */ jsx(View, { style: styles.toolbar, children: /* @__PURE__ */ jsx(Button, { theme, variant: "secondary", label: "Rest / Next day", onPress: () => session.rest(), style: styles.toolbarBtn }) }),
|
|
113
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.count, {
|
|
114
|
+
color: theme.textMuted
|
|
115
|
+
}], children: [
|
|
116
|
+
state.blockCount,
|
|
117
|
+
" blocks in your world"
|
|
118
|
+
] })
|
|
119
|
+
] })
|
|
120
|
+
] });
|
|
121
|
+
}
|
|
122
|
+
function ItemChip(props) {
|
|
123
|
+
const {
|
|
124
|
+
theme,
|
|
125
|
+
slot,
|
|
126
|
+
selected,
|
|
127
|
+
onPress
|
|
128
|
+
} = props;
|
|
129
|
+
const placeable = slot.item.placesBlock != null;
|
|
130
|
+
return /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityLabel: `${slot.item.name}, ${slot.count}`, accessibilityState: {
|
|
131
|
+
selected,
|
|
132
|
+
disabled: !placeable
|
|
133
|
+
}, disabled: !placeable, onPress, style: [styles.chip, {
|
|
134
|
+
backgroundColor: theme.surface,
|
|
135
|
+
borderColor: selected ? theme.primary : theme.border
|
|
136
|
+
}, selected && styles.chipActive, !placeable && {
|
|
137
|
+
opacity: 0.7
|
|
138
|
+
}], children: [
|
|
139
|
+
/* @__PURE__ */ jsx(View, { style: [styles.chipSwatch, {
|
|
140
|
+
backgroundColor: slot.item.color
|
|
141
|
+
}] }),
|
|
142
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.chipName, {
|
|
143
|
+
color: selected ? theme.text : theme.textMuted
|
|
144
|
+
}], numberOfLines: 1, children: slot.item.name }),
|
|
145
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.chipCount, {
|
|
146
|
+
color: theme.text
|
|
147
|
+
}], children: [
|
|
148
|
+
"\xD7",
|
|
149
|
+
slot.count
|
|
150
|
+
] })
|
|
151
|
+
] });
|
|
152
|
+
}
|
|
153
|
+
function RecipeRow(props) {
|
|
154
|
+
var _a, _b;
|
|
155
|
+
const {
|
|
156
|
+
theme,
|
|
157
|
+
view,
|
|
158
|
+
last,
|
|
159
|
+
onCraft
|
|
160
|
+
} = props;
|
|
161
|
+
const {
|
|
162
|
+
recipe,
|
|
163
|
+
canCraft
|
|
164
|
+
} = view;
|
|
165
|
+
const inputs = recipe.inputs.map((c) => {
|
|
166
|
+
var _a2, _b2;
|
|
167
|
+
return `${c.qty} ${(_b2 = (_a2 = itemByKey(c.item)) == null ? void 0 : _a2.name) != null ? _b2 : c.item}`;
|
|
168
|
+
}).join(" + ");
|
|
169
|
+
const outName = (_b = (_a = itemByKey(recipe.output.item)) == null ? void 0 : _a.name) != null ? _b : recipe.output.item;
|
|
170
|
+
return /* @__PURE__ */ jsxs(View, { style: [styles.recipeRow, !last && {
|
|
171
|
+
borderBottomColor: theme.border,
|
|
172
|
+
borderBottomWidth: 1
|
|
173
|
+
}], children: [
|
|
174
|
+
/* @__PURE__ */ jsxs(View, { style: {
|
|
175
|
+
flex: 1
|
|
176
|
+
}, children: [
|
|
177
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.recipeName, {
|
|
178
|
+
color: theme.text
|
|
179
|
+
}], children: [
|
|
180
|
+
recipe.output.qty > 1 ? `${recipe.output.qty} ` : "",
|
|
181
|
+
outName
|
|
182
|
+
] }),
|
|
183
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.recipeInputs, {
|
|
184
|
+
color: theme.textMuted
|
|
185
|
+
}], children: inputs })
|
|
186
|
+
] }),
|
|
187
|
+
/* @__PURE__ */ jsx(Button, { theme, variant: canCraft ? "primary" : "secondary", label: "Craft", disabled: !canCraft, onPress: onCraft, style: styles.craftBtn })
|
|
188
|
+
] });
|
|
189
|
+
}
|
|
190
|
+
function energyColor(theme, pct) {
|
|
191
|
+
if (pct <= 15) return theme.danger;
|
|
192
|
+
return theme.accent;
|
|
193
|
+
}
|
|
194
|
+
const styles = StyleSheet.create({
|
|
195
|
+
play3d: {
|
|
196
|
+
flexDirection: "row",
|
|
197
|
+
alignItems: "center",
|
|
198
|
+
gap: spacing.md,
|
|
199
|
+
padding: spacing.md,
|
|
200
|
+
borderRadius: radius.md,
|
|
201
|
+
borderWidth: StyleSheet.hairlineWidth
|
|
202
|
+
},
|
|
203
|
+
play3dText: {
|
|
204
|
+
flex: 1,
|
|
205
|
+
gap: 2
|
|
206
|
+
},
|
|
207
|
+
content: {
|
|
208
|
+
padding: spacing.lg,
|
|
209
|
+
gap: spacing.md,
|
|
210
|
+
paddingBottom: spacing.xxl
|
|
211
|
+
},
|
|
212
|
+
headerAction: {
|
|
213
|
+
fontSize: 16,
|
|
214
|
+
fontWeight: "600"
|
|
215
|
+
},
|
|
216
|
+
statusRow: {
|
|
217
|
+
flexDirection: "row",
|
|
218
|
+
gap: spacing.md,
|
|
219
|
+
borderRadius: radius.lg,
|
|
220
|
+
borderWidth: 1,
|
|
221
|
+
padding: spacing.md
|
|
222
|
+
},
|
|
223
|
+
statusCell: {
|
|
224
|
+
flex: 1,
|
|
225
|
+
gap: 4
|
|
226
|
+
},
|
|
227
|
+
statusCellRight: {
|
|
228
|
+
width: 130,
|
|
229
|
+
gap: 6,
|
|
230
|
+
alignItems: "flex-end"
|
|
231
|
+
},
|
|
232
|
+
statusValue: {
|
|
233
|
+
fontSize: 15,
|
|
234
|
+
fontWeight: "700"
|
|
235
|
+
},
|
|
236
|
+
statusLabel: {
|
|
237
|
+
fontSize: 12
|
|
238
|
+
},
|
|
239
|
+
energyTrack: {
|
|
240
|
+
width: "100%",
|
|
241
|
+
height: 8,
|
|
242
|
+
borderRadius: radius.pill,
|
|
243
|
+
overflow: "hidden"
|
|
244
|
+
},
|
|
245
|
+
energyFill: {
|
|
246
|
+
height: 8,
|
|
247
|
+
borderRadius: radius.pill
|
|
248
|
+
},
|
|
249
|
+
hint: {
|
|
250
|
+
borderRadius: radius.md,
|
|
251
|
+
borderWidth: 1,
|
|
252
|
+
padding: spacing.md
|
|
253
|
+
},
|
|
254
|
+
hintText: {
|
|
255
|
+
fontSize: 13,
|
|
256
|
+
lineHeight: 18
|
|
257
|
+
},
|
|
258
|
+
canvasWrap: {
|
|
259
|
+
borderRadius: radius.lg,
|
|
260
|
+
borderWidth: 1,
|
|
261
|
+
overflow: "hidden",
|
|
262
|
+
paddingVertical: spacing.sm,
|
|
263
|
+
position: "relative"
|
|
264
|
+
},
|
|
265
|
+
nightTint: {
|
|
266
|
+
position: "absolute",
|
|
267
|
+
top: 0,
|
|
268
|
+
left: 0,
|
|
269
|
+
right: 0,
|
|
270
|
+
bottom: 0
|
|
271
|
+
},
|
|
272
|
+
empty: {
|
|
273
|
+
fontSize: 13,
|
|
274
|
+
lineHeight: 18
|
|
275
|
+
},
|
|
276
|
+
invRow: {
|
|
277
|
+
gap: spacing.sm,
|
|
278
|
+
paddingVertical: spacing.xs,
|
|
279
|
+
paddingHorizontal: spacing.xs
|
|
280
|
+
},
|
|
281
|
+
chip: {
|
|
282
|
+
minWidth: 76,
|
|
283
|
+
borderRadius: radius.md,
|
|
284
|
+
borderWidth: 2,
|
|
285
|
+
paddingHorizontal: spacing.sm,
|
|
286
|
+
paddingVertical: spacing.xs,
|
|
287
|
+
alignItems: "center",
|
|
288
|
+
gap: 4
|
|
289
|
+
},
|
|
290
|
+
chipActive: {
|
|
291
|
+
transform: [{
|
|
292
|
+
translateY: -2
|
|
293
|
+
}]
|
|
294
|
+
},
|
|
295
|
+
chipSwatch: {
|
|
296
|
+
width: 34,
|
|
297
|
+
height: 24,
|
|
298
|
+
borderRadius: 6
|
|
299
|
+
},
|
|
300
|
+
chipName: {
|
|
301
|
+
fontSize: 11,
|
|
302
|
+
fontWeight: "600",
|
|
303
|
+
maxWidth: 72
|
|
304
|
+
},
|
|
305
|
+
chipCount: {
|
|
306
|
+
fontSize: 13,
|
|
307
|
+
fontWeight: "700"
|
|
308
|
+
},
|
|
309
|
+
craftCard: {
|
|
310
|
+
borderRadius: radius.lg,
|
|
311
|
+
borderWidth: 1,
|
|
312
|
+
paddingHorizontal: spacing.lg
|
|
313
|
+
},
|
|
314
|
+
recipeRow: {
|
|
315
|
+
flexDirection: "row",
|
|
316
|
+
alignItems: "center",
|
|
317
|
+
gap: spacing.md,
|
|
318
|
+
paddingVertical: spacing.md
|
|
319
|
+
},
|
|
320
|
+
recipeName: {
|
|
321
|
+
fontSize: 15,
|
|
322
|
+
fontWeight: "700"
|
|
323
|
+
},
|
|
324
|
+
recipeInputs: {
|
|
325
|
+
fontSize: 12,
|
|
326
|
+
marginTop: 2
|
|
327
|
+
},
|
|
328
|
+
craftBtn: {
|
|
329
|
+
minWidth: 96
|
|
330
|
+
},
|
|
331
|
+
toolbar: {
|
|
332
|
+
flexDirection: "row",
|
|
333
|
+
gap: spacing.sm
|
|
334
|
+
},
|
|
335
|
+
toolbarBtn: {
|
|
336
|
+
flex: 1
|
|
337
|
+
},
|
|
338
|
+
count: {
|
|
339
|
+
textAlign: "center",
|
|
340
|
+
fontSize: 12
|
|
341
|
+
}
|
|
342
|
+
});export{CubeforgeScreen};//# sourceMappingURL=CubeforgeScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CubeforgeScreen.js","sources":["../../../../../../src/features/games/vendored/ui/screens/CubeforgeScreen.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Pressable, ScrollView, StyleSheet, Text, View } from 'react-native';\nimport { itemByKey, type CubeforgeSession, type InventorySlot, type RecipeView } from '../../core';\nimport { radius, spacing, type Theme } from '../theme';\nimport { useReactiveQuery } from '../hooks/useReactiveQuery';\nimport { Button, SegmentedControl, SectionHeader } from '../components/primitives';\nimport { IsoCanvas } from '../components/IsoCanvas';\nimport { ScreenHeader } from './ScreenHeader';\n\ntype Tool = 'gather' | 'place';\n\nexport function CubeforgeScreen(props: {\n theme: Theme;\n session: CubeforgeSession;\n onBack: () => void;\n /** Shown only when the host provides a native 3D renderer. */\n onPlay3D?: () => void;\n}): React.ReactElement {\n const { theme, session, onBack, onPlay3D } = props;\n const state = useReactiveQuery(session.query);\n const [tool, setTool] = React.useState<Tool>('gather');\n\n const onCellTap = (x: number, y: number) => {\n if (tool === 'gather') session.gather(x, y);\n else session.place(x, y);\n };\n\n const night = state.phase === 'night';\n const energyPct = Math.round((state.energy / state.energyMax) * 100);\n\n return (\n <View style={{ flex: 1, backgroundColor: theme.bg }}>\n <ScreenHeader\n theme={theme}\n title=\"Cubeforge\"\n onBack={onBack}\n backLabel=\"Games\"\n right={\n <Text onPress={() => session.rest()} style={[styles.headerAction, { color: theme.primary }]}>\n Rest\n </Text>\n }\n />\n\n <ScrollView contentContainerStyle={styles.content}>\n {onPlay3D ? (\n <View style={[styles.play3d, { backgroundColor: theme.surface, borderColor: theme.border }]}>\n <View style={styles.play3dText}>\n <Text style={[styles.statusValue, { color: theme.text }]}>First-person 3D</Text>\n <Text style={[styles.statusLabel, { color: theme.textMuted }]}>\n Walk an endless world. Same rules, its own save.\n </Text>\n </View>\n <Button theme={theme} label=\"Play in 3D\" onPress={onPlay3D} />\n </View>\n ) : null}\n\n {/* Day/night + energy status */}\n <View style={[styles.statusRow, { backgroundColor: theme.surface, borderColor: theme.border }]}>\n <View style={styles.statusCell}>\n <Text style={[styles.statusValue, { color: theme.text }]}>\n {night ? '🌙' : '☀️'} {night ? 'Night' : 'Day'} {state.day}\n </Text>\n <Text style={[styles.statusLabel, { color: theme.textMuted }]}>\n {night ? 'Rest to start a new day' : 'Gather while it is light'}\n </Text>\n </View>\n <View style={styles.statusCellRight}>\n <Text style={[styles.statusValue, { color: theme.text }]}>\n ⚡ {state.energy}/{state.energyMax}\n </Text>\n <View style={[styles.energyTrack, { backgroundColor: theme.surfaceAlt }]}>\n <View\n style={[\n styles.energyFill,\n { backgroundColor: energyColor(theme, energyPct), width: `${energyPct}%` },\n ]}\n />\n </View>\n </View>\n </View>\n\n {state.energy === 0 ? (\n <View style={[styles.hint, { backgroundColor: theme.surfaceAlt, borderColor: theme.border }]}>\n <Text style={[styles.hintText, { color: theme.textMuted }]}>\n 😴 Out of energy. Tap <Text style={{ color: theme.primary, fontWeight: '700' }}>Rest</Text>{' '}\n to recover and begin the next day.\n </Text>\n </View>\n ) : null}\n\n {/* The world */}\n <View\n style={[\n styles.canvasWrap,\n { backgroundColor: night ? theme.surfaceAlt : theme.surface, borderColor: theme.border },\n ]}\n >\n <IsoCanvas bounds={state.bounds} blocks={state.blocks} theme={theme} onCellTap={onCellTap} />\n {night ? (\n <View pointerEvents=\"none\" style={[styles.nightTint, { backgroundColor: theme.overlay }]} />\n ) : null}\n </View>\n\n <SegmentedControl<Tool>\n theme={theme}\n value={tool}\n onChange={setTool}\n options={[\n { value: 'gather', label: '⛏ Gather' },\n { value: 'place', label: '🧱 Place' },\n ]}\n />\n\n {/* Inventory */}\n <SectionHeader theme={theme} title=\"Inventory\" />\n {state.inventory.length === 0 ? (\n <Text style={[styles.empty, { color: theme.textMuted }]}>\n Nothing yet - switch to Gather and tap the world to collect materials.\n </Text>\n ) : (\n <ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.invRow}>\n {state.inventory.map((slot) => (\n <ItemChip\n key={slot.item.key}\n theme={theme}\n slot={slot}\n selected={slot.item.key === state.selectedItem}\n onPress={() => session.selectItem(slot.item.key)}\n />\n ))}\n </ScrollView>\n )}\n\n {/* Crafting */}\n <SectionHeader theme={theme} title=\"Craft\" />\n <View style={[styles.craftCard, { backgroundColor: theme.surface, borderColor: theme.border }]}>\n {state.recipes.map((view, i) => (\n <RecipeRow\n key={view.recipe.id}\n theme={theme}\n view={view}\n last={i === state.recipes.length - 1}\n onCraft={() => session.craft(view.recipe.id)}\n />\n ))}\n </View>\n\n <View style={styles.toolbar}>\n <Button\n theme={theme}\n variant=\"secondary\"\n label=\"Rest / Next day\"\n onPress={() => session.rest()}\n style={styles.toolbarBtn}\n />\n </View>\n\n <Text style={[styles.count, { color: theme.textMuted }]}>{state.blockCount} blocks in your world</Text>\n </ScrollView>\n </View>\n );\n}\n\nfunction ItemChip(props: {\n theme: Theme;\n slot: InventorySlot;\n selected: boolean;\n onPress: () => void;\n}): React.ReactElement {\n const { theme, slot, selected, onPress } = props;\n const placeable = slot.item.placesBlock != null;\n return (\n <Pressable\n accessibilityRole=\"button\"\n accessibilityLabel={`${slot.item.name}, ${slot.count}`}\n accessibilityState={{ selected, disabled: !placeable }}\n disabled={!placeable}\n onPress={onPress}\n style={[\n styles.chip,\n { backgroundColor: theme.surface, borderColor: selected ? theme.primary : theme.border },\n selected && styles.chipActive,\n !placeable && { opacity: 0.7 },\n ]}\n >\n <View style={[styles.chipSwatch, { backgroundColor: slot.item.color }]} />\n <Text style={[styles.chipName, { color: selected ? theme.text : theme.textMuted }]} numberOfLines={1}>\n {slot.item.name}\n </Text>\n <Text style={[styles.chipCount, { color: theme.text }]}>×{slot.count}</Text>\n </Pressable>\n );\n}\n\nfunction RecipeRow(props: { theme: Theme; view: RecipeView; last: boolean; onCraft: () => void }): React.ReactElement {\n const { theme, view, last, onCraft } = props;\n const { recipe, canCraft } = view;\n const inputs = recipe.inputs.map((c) => `${c.qty} ${itemByKey(c.item)?.name ?? c.item}`).join(' + ');\n const outName = itemByKey(recipe.output.item)?.name ?? recipe.output.item;\n return (\n <View style={[styles.recipeRow, !last && { borderBottomColor: theme.border, borderBottomWidth: 1 }]}>\n <View style={{ flex: 1 }}>\n <Text style={[styles.recipeName, { color: theme.text }]}>\n {recipe.output.qty > 1 ? `${recipe.output.qty} ` : ''}\n {outName}\n </Text>\n <Text style={[styles.recipeInputs, { color: theme.textMuted }]}>{inputs}</Text>\n </View>\n <Button\n theme={theme}\n variant={canCraft ? 'primary' : 'secondary'}\n label=\"Craft\"\n disabled={!canCraft}\n onPress={onCraft}\n style={styles.craftBtn}\n />\n </View>\n );\n}\n\nfunction energyColor(theme: Theme, pct: number): string {\n if (pct <= 15) return theme.danger;\n return theme.accent;\n}\n\nconst styles = StyleSheet.create({\n play3d: {\n flexDirection: 'row',\n alignItems: 'center',\n gap: spacing.md,\n padding: spacing.md,\n borderRadius: radius.md,\n borderWidth: StyleSheet.hairlineWidth,\n },\n play3dText: { flex: 1, gap: 2 },\n content: { padding: spacing.lg, gap: spacing.md, paddingBottom: spacing.xxl },\n headerAction: { fontSize: 16, fontWeight: '600' },\n statusRow: {\n flexDirection: 'row',\n gap: spacing.md,\n borderRadius: radius.lg,\n borderWidth: 1,\n padding: spacing.md,\n },\n statusCell: { flex: 1, gap: 4 },\n statusCellRight: { width: 130, gap: 6, alignItems: 'flex-end' },\n statusValue: { fontSize: 15, fontWeight: '700' },\n statusLabel: { fontSize: 12 },\n energyTrack: { width: '100%', height: 8, borderRadius: radius.pill, overflow: 'hidden' },\n energyFill: { height: 8, borderRadius: radius.pill },\n hint: { borderRadius: radius.md, borderWidth: 1, padding: spacing.md },\n hintText: { fontSize: 13, lineHeight: 18 },\n canvasWrap: {\n borderRadius: radius.lg,\n borderWidth: 1,\n overflow: 'hidden',\n paddingVertical: spacing.sm,\n position: 'relative',\n },\n nightTint: { position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 },\n empty: { fontSize: 13, lineHeight: 18 },\n invRow: { gap: spacing.sm, paddingVertical: spacing.xs, paddingHorizontal: spacing.xs },\n chip: {\n minWidth: 76,\n borderRadius: radius.md,\n borderWidth: 2,\n paddingHorizontal: spacing.sm,\n paddingVertical: spacing.xs,\n alignItems: 'center',\n gap: 4,\n },\n chipActive: { transform: [{ translateY: -2 }] },\n chipSwatch: { width: 34, height: 24, borderRadius: 6 },\n chipName: { fontSize: 11, fontWeight: '600', maxWidth: 72 },\n chipCount: { fontSize: 13, fontWeight: '700' },\n craftCard: { borderRadius: radius.lg, borderWidth: 1, paddingHorizontal: spacing.lg },\n recipeRow: { flexDirection: 'row', alignItems: 'center', gap: spacing.md, paddingVertical: spacing.md },\n recipeName: { fontSize: 15, fontWeight: '700' },\n recipeInputs: { fontSize: 12, marginTop: 2 },\n craftBtn: { minWidth: 96 },\n toolbar: { flexDirection: 'row', gap: spacing.sm },\n toolbarBtn: { flex: 1 },\n count: { textAlign: 'center', fontSize: 12 },\n});\n"],"names":["_a","_b"],"mappings":"wkBASO,SAAS,gBAAgB,KAMT,EAAA;AACrB,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAM,MAAA,KAAA,GAAQ,gBAAiB,CAAA,OAAA,CAAQ,KAAK,CAAA;AAC5C,EAAA,MAAM,CAAC,IAAM,EAAA,OAAO,CAAI,GAAA,KAAA,CAAM,SAAe,QAAQ,CAAA;AACrD,EAAM,MAAA,SAAA,GAAY,CAAC,CAAA,EAAW,CAAc,KAAA;AAC1C,IAAA,IAAI,IAAS,KAAA,QAAA,EAAkB,OAAA,CAAA,MAAA,CAAO,GAAG,CAAC,CAAA;AAAA,SAAO,OAAA,CAAQ,KAAM,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,GACrE;AACA,EAAM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ACZ;AAAA,EACA,SAAW,EAAA;AAAA,IACT,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,SAAW,EAAA;AAAA,IACT,cAAc,MAAO,CAAA,EAAA;AAAA,IACrB,WAAa,EAAA,CAAA;AAAA,IACb,mBAAmB,OAAQ,CAAA;AAAA,GAC7B;AAAA,EACA,SAAW,EAAA;AAAA,IACT,aAAe,EAAA,KAAA;AAAA,IACf,UAAY,EAAA,QAAA;AAAA,IACZ,KAAK,OAAQ,CAAA,EAAA;AAAA,IACb,iBAAiB,OAAQ,CAAA;AAAA,GAC3B;AAAA,EACA,UAAY,EAAA;AAAA,IACV,QAAU,EAAA,EAAA;AAAA,IACV,UAAY,EAAA;AAAA,GACd;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,QAAU,EAAA,EAAA;AAAA,IACV,SAAW,EAAA;AAAA,GACb;AAAA,EACA,QAAU,EAAA;AAAA,IACR,QAAU,EAAA;AAAA,GACZ;AAAA,EACA,OAAS,EAAA;AAAA,IACP,aAAe,EAAA,KAAA;AAAA,IACf,KAAK,OAAQ,CAAA;AAAA,GACf;AAAA,EACA,UAAY,EAAA;AAAA,IACV,IAAM,EAAA;AAAA,GACR;AAAA,EACA,KAAO,EAAA;AAAA,IACL,SAAW,EAAA,QAAA;AAAA,IACX,QAAU,EAAA;AAAA;AAEd,CAAC,CAAA"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import {jsxs,jsx}from'react/jsx-runtime';import {View,ScrollView,StyleSheet,Text,Pressable}from'react-native';import'../../core/engine/palette.js';import'../../core/lessons/lessons.js';import {GAMES}from'../../core/games/catalog.js';import'../../core/cubeforge/items.js';import'../../core/cubeforge/recipes.js';import {spacing,radius}from'../theme.js';import {ScreenHeader}from'./ScreenHeader.js';function HubScreen(props) {
|
|
2
|
+
const {
|
|
3
|
+
theme,
|
|
4
|
+
onOpenGame,
|
|
5
|
+
onExit
|
|
6
|
+
} = props;
|
|
7
|
+
return /* @__PURE__ */ jsxs(View, { style: {
|
|
8
|
+
flex: 1,
|
|
9
|
+
backgroundColor: theme.bg
|
|
10
|
+
}, children: [
|
|
11
|
+
/* @__PURE__ */ jsx(ScreenHeader, { theme, title: "Yantra Games", onBack: onExit, backLabel: "Close" }),
|
|
12
|
+
/* @__PURE__ */ jsxs(ScrollView, { style: styles.scroll, contentContainerStyle: styles.content, children: [
|
|
13
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.intro, {
|
|
14
|
+
color: theme.textMuted
|
|
15
|
+
}], children: "Learning games, built right into Yantra. Pick one to start." }),
|
|
16
|
+
GAMES.map((game) => /* @__PURE__ */ jsx(GameTile, { theme, game, onOpen: () => onOpenGame(game.id) }, game.id))
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ jsxs(View, { style: styles.footer, children: [
|
|
19
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.footerBrand, {
|
|
20
|
+
color: theme.text
|
|
21
|
+
}], children: "Yantra Games" }),
|
|
22
|
+
/* @__PURE__ */ jsxs(Text, { style: [styles.footerNote, {
|
|
23
|
+
color: theme.textMuted
|
|
24
|
+
}], children: [
|
|
25
|
+
"Original learning games, made for Yantra \xB7 v",
|
|
26
|
+
APP_VERSION
|
|
27
|
+
] })
|
|
28
|
+
] })
|
|
29
|
+
] });
|
|
30
|
+
}
|
|
31
|
+
const APP_VERSION = "0.1.0";
|
|
32
|
+
function GameTile(props) {
|
|
33
|
+
const {
|
|
34
|
+
theme,
|
|
35
|
+
game,
|
|
36
|
+
onOpen
|
|
37
|
+
} = props;
|
|
38
|
+
const available = game.status === "available";
|
|
39
|
+
return /* @__PURE__ */ jsxs(Pressable, { accessibilityRole: "button", accessibilityState: {
|
|
40
|
+
disabled: !available
|
|
41
|
+
}, disabled: !available, onPress: onOpen, style: ({
|
|
42
|
+
pressed
|
|
43
|
+
}) => [styles.tile, {
|
|
44
|
+
backgroundColor: theme.surface,
|
|
45
|
+
borderColor: theme.border,
|
|
46
|
+
opacity: available ? pressed ? 0.9 : 1 : 0.6
|
|
47
|
+
}], children: [
|
|
48
|
+
/* @__PURE__ */ jsx(View, { style: [styles.badge, {
|
|
49
|
+
backgroundColor: game.accent
|
|
50
|
+
}] }),
|
|
51
|
+
/* @__PURE__ */ jsxs(View, { style: {
|
|
52
|
+
flex: 1
|
|
53
|
+
}, children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.tileTitle, {
|
|
55
|
+
color: theme.text
|
|
56
|
+
}], children: game.name }),
|
|
57
|
+
/* @__PURE__ */ jsx(Text, { style: [styles.tileTagline, {
|
|
58
|
+
color: theme.textMuted
|
|
59
|
+
}], children: game.tagline })
|
|
60
|
+
] }),
|
|
61
|
+
!available ? /* @__PURE__ */ jsx(Text, { style: [styles.soon, {
|
|
62
|
+
color: theme.textMuted,
|
|
63
|
+
borderColor: theme.border
|
|
64
|
+
}], children: "Soon" }) : /* @__PURE__ */ jsx(Text, { style: [styles.chevron, {
|
|
65
|
+
color: theme.textMuted
|
|
66
|
+
}], children: "\u203A" })
|
|
67
|
+
] });
|
|
68
|
+
}
|
|
69
|
+
const styles = StyleSheet.create({
|
|
70
|
+
scroll: {
|
|
71
|
+
flex: 1
|
|
72
|
+
},
|
|
73
|
+
content: {
|
|
74
|
+
padding: spacing.lg,
|
|
75
|
+
gap: spacing.md
|
|
76
|
+
},
|
|
77
|
+
intro: {
|
|
78
|
+
fontSize: 15,
|
|
79
|
+
lineHeight: 21,
|
|
80
|
+
marginBottom: spacing.xs
|
|
81
|
+
},
|
|
82
|
+
tile: {
|
|
83
|
+
flexDirection: "row",
|
|
84
|
+
alignItems: "center",
|
|
85
|
+
gap: spacing.md,
|
|
86
|
+
borderRadius: radius.lg,
|
|
87
|
+
borderWidth: 1,
|
|
88
|
+
padding: spacing.lg
|
|
89
|
+
},
|
|
90
|
+
badge: {
|
|
91
|
+
width: 44,
|
|
92
|
+
height: 44,
|
|
93
|
+
borderRadius: radius.md
|
|
94
|
+
},
|
|
95
|
+
tileTitle: {
|
|
96
|
+
fontSize: 18,
|
|
97
|
+
fontWeight: "700"
|
|
98
|
+
},
|
|
99
|
+
tileTagline: {
|
|
100
|
+
fontSize: 13,
|
|
101
|
+
lineHeight: 18,
|
|
102
|
+
marginTop: 2
|
|
103
|
+
},
|
|
104
|
+
soon: {
|
|
105
|
+
fontSize: 11,
|
|
106
|
+
fontWeight: "700",
|
|
107
|
+
borderWidth: 1,
|
|
108
|
+
borderRadius: radius.pill,
|
|
109
|
+
paddingHorizontal: spacing.sm,
|
|
110
|
+
paddingVertical: 3,
|
|
111
|
+
overflow: "hidden"
|
|
112
|
+
},
|
|
113
|
+
chevron: {
|
|
114
|
+
fontSize: 28,
|
|
115
|
+
fontWeight: "300"
|
|
116
|
+
},
|
|
117
|
+
footer: {
|
|
118
|
+
paddingTop: spacing.md,
|
|
119
|
+
paddingBottom: spacing.lg,
|
|
120
|
+
paddingHorizontal: spacing.lg,
|
|
121
|
+
alignItems: "center",
|
|
122
|
+
gap: 2
|
|
123
|
+
},
|
|
124
|
+
footerBrand: {
|
|
125
|
+
fontSize: 13,
|
|
126
|
+
fontWeight: "700"
|
|
127
|
+
},
|
|
128
|
+
footerNote: {
|
|
129
|
+
fontSize: 12
|
|
130
|
+
}
|
|
131
|
+
});export{HubScreen};//# sourceMappingURL=HubScreen.js.map
|