@adminide-stack/yantra-mobile 12.0.172 → 12.0.173

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 (88) hide show
  1. package/lib/features/apps/mobileAppCatalog.js +2 -2
  2. package/lib/features/apps/mobileAppCatalog.js.map +1 -1
  3. package/lib/features/chat/NotionPageWidgetCard.js +98 -0
  4. package/lib/features/chat/NotionPageWidgetCard.js.map +1 -0
  5. package/lib/features/chat/hostTranscriptProtocol.js +5 -1
  6. package/lib/features/chat/hostTranscriptProtocol.js.map +1 -1
  7. package/lib/features/chat/notionPageWidget.js +34 -0
  8. package/lib/features/chat/notionPageWidget.js.map +1 -0
  9. package/lib/features/games/cubeforge3D.js +11 -6
  10. package/lib/features/games/cubeforge3D.js.map +1 -1
  11. package/lib/features/games/vendored/core/cubeforge/items.js +2 -8
  12. package/lib/features/games/vendored/core/cubeforge/items.js.map +1 -1
  13. package/lib/features/games/vendored/core/cubeforge/recipes.js +1 -4
  14. package/lib/features/games/vendored/core/cubeforge/recipes.js.map +1 -1
  15. package/lib/features/games/vendored/core/cubeforge/skin.js +83 -0
  16. package/lib/features/games/vendored/core/cubeforge/skin.js.map +1 -0
  17. package/lib/features/games/vendored/core/cubeforge/worldgen.js +2 -38
  18. package/lib/features/games/vendored/core/cubeforge/worldgen.js.map +1 -1
  19. package/lib/features/games/vendored/core/engine/palette.js +2 -9
  20. package/lib/features/games/vendored/core/engine/palette.js.map +1 -1
  21. package/lib/features/games/vendored/core/lessons/lessons.js +2 -96
  22. package/lib/features/games/vendored/core/lessons/lessons.js.map +1 -1
  23. package/lib/features/games/vendored/ui/GamesRoot.js +87 -144
  24. package/lib/features/games/vendored/ui/GamesRoot.js.map +1 -1
  25. package/lib/features/games/vendored/ui/components/primitives.js +2 -50
  26. package/lib/features/games/vendored/ui/components/primitives.js.map +1 -1
  27. package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js +20 -3
  28. package/lib/features/games/vendored/ui/screens/Cubeforge3DHomeScreen.js.map +1 -1
  29. package/lib/features/games/vendored/ui/screens/SkinEditorScreen.js +169 -0
  30. package/lib/features/games/vendored/ui/screens/SkinEditorScreen.js.map +1 -0
  31. package/lib/features/games/vendored/ui/theme.js +1 -3
  32. package/lib/features/games/vendored/ui/theme.js.map +1 -1
  33. package/lib/features/notion/notionEditorModel.js +3 -1
  34. package/lib/features/notion/notionEditorModel.js.map +1 -1
  35. package/lib/screens/GamesNative/index.js +1 -1
  36. package/lib/screens/Home/components/homeCatalog.js +2 -2
  37. package/lib/screens/Home/components/homeCatalog.js.map +1 -1
  38. package/package.json +2 -2
  39. package/lib/features/games/vendored/core/classroom/permissions.js +0 -76
  40. package/lib/features/games/vendored/core/classroom/permissions.js.map +0 -1
  41. package/lib/features/games/vendored/core/classroom/resourceLink.js +0 -101
  42. package/lib/features/games/vendored/core/classroom/resourceLink.js.map +0 -1
  43. package/lib/features/games/vendored/core/classroom/rules.js +0 -83
  44. package/lib/features/games/vendored/core/classroom/rules.js.map +0 -1
  45. package/lib/features/games/vendored/core/classroom/worldSettings.js +0 -49
  46. package/lib/features/games/vendored/core/classroom/worldSettings.js.map +0 -1
  47. package/lib/features/games/vendored/core/cubeforge/cycle.js +0 -15
  48. package/lib/features/games/vendored/core/cubeforge/cycle.js.map +0 -1
  49. package/lib/features/games/vendored/core/cubeforge/inventory.js +0 -75
  50. package/lib/features/games/vendored/core/cubeforge/inventory.js.map +0 -1
  51. package/lib/features/games/vendored/core/cubeforge/save.js +0 -92
  52. package/lib/features/games/vendored/core/cubeforge/save.js.map +0 -1
  53. package/lib/features/games/vendored/core/cubeforge/session.js +0 -154
  54. package/lib/features/games/vendored/core/cubeforge/session.js.map +0 -1
  55. package/lib/features/games/vendored/core/engine/iso.js +0 -41
  56. package/lib/features/games/vendored/core/engine/iso.js.map +0 -1
  57. package/lib/features/games/vendored/core/engine/world.js +0 -148
  58. package/lib/features/games/vendored/core/engine/world.js.map +0 -1
  59. package/lib/features/games/vendored/core/games/catalog.js +0 -34
  60. package/lib/features/games/vendored/core/games/catalog.js.map +0 -1
  61. package/lib/features/games/vendored/core/logging/events.js +0 -24
  62. package/lib/features/games/vendored/core/logging/events.js.map +0 -1
  63. package/lib/features/games/vendored/core/logging/logger.js +0 -54
  64. package/lib/features/games/vendored/core/logging/logger.js.map +0 -1
  65. package/lib/features/games/vendored/core/session/gameSession.js +0 -317
  66. package/lib/features/games/vendored/core/session/gameSession.js.map +0 -1
  67. package/lib/features/games/vendored/core/storage/worldRepository.js +0 -192
  68. package/lib/features/games/vendored/core/storage/worldRepository.js.map +0 -1
  69. package/lib/features/games/vendored/core/store/reactive.js +0 -78
  70. package/lib/features/games/vendored/core/store/reactive.js.map +0 -1
  71. package/lib/features/games/vendored/ui/components/BlockPalette.js +0 -64
  72. package/lib/features/games/vendored/ui/components/BlockPalette.js.map +0 -1
  73. package/lib/features/games/vendored/ui/components/IsoCanvas.js +0 -124
  74. package/lib/features/games/vendored/ui/components/IsoCanvas.js.map +0 -1
  75. package/lib/features/games/vendored/ui/hooks/useReactiveQuery.js +0 -3
  76. package/lib/features/games/vendored/ui/hooks/useReactiveQuery.js.map +0 -1
  77. package/lib/features/games/vendored/ui/screens/ActivityScreen.js +0 -68
  78. package/lib/features/games/vendored/ui/screens/ActivityScreen.js.map +0 -1
  79. package/lib/features/games/vendored/ui/screens/BuilderScreen.js +0 -227
  80. package/lib/features/games/vendored/ui/screens/BuilderScreen.js.map +0 -1
  81. package/lib/features/games/vendored/ui/screens/ClassroomScreen.js +0 -95
  82. package/lib/features/games/vendored/ui/screens/ClassroomScreen.js.map +0 -1
  83. package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js +0 -342
  84. package/lib/features/games/vendored/ui/screens/CubeforgeScreen.js.map +0 -1
  85. package/lib/features/games/vendored/ui/screens/HubScreen.js +0 -131
  86. package/lib/features/games/vendored/ui/screens/HubScreen.js.map +0 -1
  87. package/lib/features/games/vendored/ui/screens/WorldListScreen.js +0 -134
  88. package/lib/features/games/vendored/ui/screens/WorldListScreen.js.map +0 -1
@@ -0,0 +1,83 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
4
+ const SKIN_CELLS = 256;
5
+ const SKIN_PALETTE = ["#1f242a", "#f4f4f0", "#e0b48c", "#9c6b45", "#5c4028", "#bf4f3f", "#d9a33c", "#e9d36a", "#4f9f5f", "#2f6b45", "#3fbfb0", "#3f7fbf", "#2f4a6b", "#8f5fbf", "#d96a9a", "#7f8f9f"];
6
+ const SKIN_GRIDS = {
7
+ head: {
8
+ start: 0,
9
+ width: 8,
10
+ height: 8
11
+ },
12
+ body: {
13
+ start: 64,
14
+ width: 8,
15
+ height: 12
16
+ },
17
+ arms: {
18
+ start: 160,
19
+ width: 4,
20
+ height: 12
21
+ },
22
+ legs: {
23
+ start: 208,
24
+ width: 4,
25
+ height: 12
26
+ }
27
+ };
28
+ const TONES = [2, 3];
29
+ const HAIRS = [4, 0, 6, 15];
30
+ const OUTFITS = [[11, 12], [5, 4], [8, 9], [6, 4], [13, 12], [10, 9], [14, 12], [1, 15], [0, 15], [3, 4], [12, 0], [9, 4], [5, 0], [15, 12], [7, 4], [9, 0]];
31
+ const SKIN_PRESET_COUNT = OUTFITS.length;
32
+ function presetSkin(index) {
33
+ var _a, _b, _c;
34
+ const i = (index % SKIN_PRESET_COUNT + SKIN_PRESET_COUNT) % SKIN_PRESET_COUNT;
35
+ const [shirt, trousers] = (_a = OUTFITS[i]) != null ? _a : [11, 12];
36
+ const tone = (_b = TONES[i % 2]) != null ? _b : 2;
37
+ const hair = (_c = HAIRS[Math.floor(i / 2) % HAIRS.length]) != null ? _c : 4;
38
+ const cells = new Array(SKIN_CELLS).fill(0);
39
+ const paint = (grid, f) => {
40
+ for (let y = 0; y < grid.height; y += 1) {
41
+ for (let x = 0; x < grid.width; x += 1) cells[grid.start + y * grid.width + x] = f(x, y);
42
+ }
43
+ };
44
+ paint(SKIN_GRIDS.head, (x, y) => {
45
+ if (y <= 1) return hair;
46
+ if (y === 2 && (x === 0 || x === 7)) return hair;
47
+ if (y === 3 && (x === 2 || x === 5)) return 1;
48
+ if (y === 4 && (x === 2 || x === 5)) return 0;
49
+ if (y === 6 && (x === 3 || x === 4)) return 5;
50
+ return tone;
51
+ });
52
+ paint(SKIN_GRIDS.body, (x, y) => {
53
+ if (y === 11) return trousers;
54
+ return x >= 3 && x < 5 && y < 2 ? tone : shirt;
55
+ });
56
+ paint(SKIN_GRIDS.arms, (_x, y) => y >= 9 ? tone : shirt);
57
+ paint(SKIN_GRIDS.legs, (_x, y) => y >= 10 ? 0 : trousers);
58
+ return cells;
59
+ }
60
+ function skinToHex(cells) {
61
+ return cells.map((c) => (c & 15).toString(16)).join("");
62
+ }
63
+ function skinFromHex(hex) {
64
+ if (!/^[0-9a-f]{256}$/.test(hex)) return null;
65
+ return Array.from(hex, (c) => parseInt(c, 16));
66
+ }
67
+ class SkinRepository {
68
+ constructor(storage, orgName) {
69
+ this.storage = storage;
70
+ __publicField(this, "key");
71
+ this.key = `yantra-games:cubeforge3d-skin:${orgName || "default"}`;
72
+ }
73
+ async load() {
74
+ const raw = await this.storage.getItem(this.key);
75
+ return raw ? skinFromHex(raw) : null;
76
+ }
77
+ async save(cells) {
78
+ await this.storage.setItem(this.key, skinToHex(cells));
79
+ }
80
+ async clear() {
81
+ await this.storage.removeItem(this.key);
82
+ }
83
+ }export{SKIN_CELLS,SKIN_GRIDS,SKIN_PALETTE,SKIN_PRESET_COUNT,SkinRepository,presetSkin,skinFromHex,skinToHex};//# sourceMappingURL=skin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skin.js","sources":["../../../../../../src/features/games/vendored/core/cubeforge/skin.ts"],"sourcesContent":["/**\n * Player skins for Cubeforge 3D: 256 cells on a fixed 16-colour palette, one\n * hex digit per cell. The same format as `native/cubeforge/src/game/skin.rs`.\n */\nimport type { KeyValueStorage } from '../storage/storage';\n\nexport const SKIN_CELLS = 256;\n\nexport const SKIN_PALETTE = [\n '#1f242a',\n '#f4f4f0',\n '#e0b48c',\n '#9c6b45',\n '#5c4028',\n '#bf4f3f',\n '#d9a33c',\n '#e9d36a',\n '#4f9f5f',\n '#2f6b45',\n '#3fbfb0',\n '#3f7fbf',\n '#2f4a6b',\n '#8f5fbf',\n '#d96a9a',\n '#7f8f9f',\n] as const;\n\nexport type SkinPart = 'head' | 'body' | 'arms' | 'legs';\n\nexport interface SkinGrid {\n start: number;\n width: number;\n height: number;\n}\n\nexport const SKIN_GRIDS: Record<SkinPart, SkinGrid> = {\n head: { start: 0, width: 8, height: 8 },\n body: { start: 64, width: 8, height: 12 },\n arms: { start: 160, width: 4, height: 12 },\n legs: { start: 208, width: 4, height: 12 },\n};\n\nconst TONES = [2, 3];\nconst HAIRS = [4, 0, 6, 15];\n/** Shirt and trousers of each ready-made person. */\nconst OUTFITS: readonly (readonly [number, number])[] = [\n [11, 12],\n [5, 4],\n [8, 9],\n [6, 4],\n [13, 12],\n [10, 9],\n [14, 12],\n [1, 15],\n [0, 15],\n [3, 4],\n [12, 0],\n [9, 4],\n [5, 0],\n [15, 12],\n [7, 4],\n [9, 0],\n];\n\nexport const SKIN_PRESET_COUNT = OUTFITS.length;\n\n/** One of the ready-made people, as cell values. */\nexport function presetSkin(index: number): number[] {\n const i = ((index % SKIN_PRESET_COUNT) + SKIN_PRESET_COUNT) % SKIN_PRESET_COUNT;\n const [shirt, trousers] = OUTFITS[i] ?? [11, 12];\n const tone = TONES[i % 2] ?? 2;\n const hair = HAIRS[Math.floor(i / 2) % HAIRS.length] ?? 4;\n const cells = new Array<number>(SKIN_CELLS).fill(0);\n const paint = (grid: SkinGrid, f: (x: number, y: number) => number) => {\n for (let y = 0; y < grid.height; y += 1) {\n for (let x = 0; x < grid.width; x += 1) cells[grid.start + y * grid.width + x] = f(x, y);\n }\n };\n paint(SKIN_GRIDS.head, (x, y) => {\n if (y <= 1) return hair;\n if (y === 2 && (x === 0 || x === 7)) return hair;\n if (y === 3 && (x === 2 || x === 5)) return 1;\n if (y === 4 && (x === 2 || x === 5)) return 0;\n if (y === 6 && (x === 3 || x === 4)) return 5;\n return tone;\n });\n paint(SKIN_GRIDS.body, (x, y) => {\n if (y === 11) return trousers;\n return x >= 3 && x < 5 && y < 2 ? tone : shirt;\n });\n paint(SKIN_GRIDS.arms, (_x, y) => (y >= 9 ? tone : shirt));\n paint(SKIN_GRIDS.legs, (_x, y) => (y >= 10 ? 0 : trousers));\n return cells;\n}\n\nexport function skinToHex(cells: readonly number[]): string {\n return cells.map((c) => (c & 15).toString(16)).join('');\n}\n\n/** Cells from hex, or null if the text is not a skin. */\nexport function skinFromHex(hex: string): number[] | null {\n if (!/^[0-9a-f]{256}$/.test(hex)) return null;\n return Array.from(hex, (c) => parseInt(c, 16));\n}\n\n/** Remembers this person's painted skin on the device, across worlds. */\nexport class SkinRepository {\n private readonly key: string;\n\n constructor(\n private readonly storage: KeyValueStorage,\n orgName: string,\n ) {\n this.key = `yantra-games:cubeforge3d-skin:${orgName || 'default'}`;\n }\n\n async load(): Promise<number[] | null> {\n const raw = await this.storage.getItem(this.key);\n return raw ? skinFromHex(raw) : null;\n }\n\n async save(cells: readonly number[]): Promise<void> {\n await this.storage.setItem(this.key, skinToHex(cells));\n }\n\n async clear(): Promise<void> {\n await this.storage.removeItem(this.key);\n }\n}\n"],"names":[],"mappings":";;;AAKO,MAAM,UAAa,GAAA;AACnB,MAAM,eAAe,CAAC,SAAA,EAAW,SAAW,EAAA,SAAA,EAAW,WAAW,SAAW,EAAA,SAAA,EAAW,SAAW,EAAA,SAAA,EAAW,WAAW,SAAW,EAAA,SAAA,EAAW,WAAW,SAAW,EAAA,SAAA,EAAW,WAAW,SAAS;AAOpM,MAAM,UAAyC,GAAA;AAAA,EACpD,IAAM,EAAA;AAAA,IACJ,KAAO,E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GO,MAAM,cAAe,CAAA;AAAA,EAE1B,WAAA,CAA6B,SAA0B,OAAiB,EAAA;AAA3C,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAD7B,IAAiB,aAAA,CAAA,IAAA,EAAA,KAAA,CAAA;AAEf,IAAK,IAAA,CAAA,GAAA,GAAM,CAAiC,8BAAA,EAAA,OAAA,IAAW,SAAS,CAAA,CAAA;AAAA;AAClE,EACA,MAAM,IAAiC,GAAA;AACrC,IAAA,MAAM,MAAM,MAAM,IAAA,CAAK,OAAQ,CAAA,OAAA,CAAQ,KAAK,GAAG,CAAA;AAC/C,IAAO,OAAA,GAAA,GAAM,WAAY,CAAA,GAAG,CAAI,GAAA,IAAA;AAAA;AAClC,EACA,MAAM,KAAK,KAAyC,EAAA;AAClD,IAAA,MAAM,KAAK,OAAQ,CAAA,OAAA,CAAQ,KAAK,GAAK,EAAA,SAAA,CAAU,KAAK,CAAC,CAAA;AAAA;AACvD,EACA,MAAM,KAAuB,GAAA;AAC3B,IAAA,MAAM,IAAK,CAAA,OAAA,CAAQ,UAAW,CAAA,IAAA,CAAK,GAAG,CAAA;AAAA;AAE1C"}
@@ -1,44 +1,8 @@
1
- import {DEFAULT_BOUNDS,VoxelWorld}from'../engine/world.js';function mulberry32(seed) {
2
- let a = seed >>> 0;
3
- return () => {
4
- a = a + 1831565813 | 0;
5
- let t = Math.imul(a ^ a >>> 15, 1 | a);
6
- t = t + Math.imul(t ^ t >>> 7, 61 | t) ^ t;
7
- return ((t ^ t >>> 14) >>> 0) / 4294967296;
8
- };
9
- }
10
- function seedFromString(input) {
1
+ import'../engine/palette.js';function seedFromString(input) {
11
2
  let h = 2166136261;
12
3
  for (let i = 0; i < input.length; i += 1) {
13
4
  h ^= input.charCodeAt(i);
14
5
  h = Math.imul(h, 16777619);
15
6
  }
16
7
  return h >>> 0;
17
- }
18
- const GRASS = 1;
19
- const SOIL = 2;
20
- const STONE = 3;
21
- const WOOD = 4;
22
- const SAND = 6;
23
- function generateWorld(seed, bounds = DEFAULT_BOUNDS) {
24
- const world = VoxelWorld.create(bounds);
25
- const rnd = mulberry32(seed || 1);
26
- for (let x = 0; x < bounds.x; x += 1) {
27
- for (let y = 0; y < bounds.y; y += 1) {
28
- const r = rnd();
29
- const ground = r < 0.12 ? SAND : r < 0.26 ? SOIL : GRASS;
30
- world.place(x, y, 0, ground);
31
- if (bounds.z > 1 && rnd() < 0.06) world.place(x, y, 1, STONE);
32
- }
33
- }
34
- const treeCount = Math.max(3, Math.floor(bounds.x * bounds.y / 24));
35
- for (let i = 0; i < treeCount; i += 1) {
36
- const x = Math.floor(rnd() * bounds.x);
37
- const y = Math.floor(rnd() * bounds.y);
38
- const height = 2 + Math.floor(rnd() * 2);
39
- for (let z = 1; z <= height && z < bounds.z; z += 1) {
40
- world.place(x, y, z, WOOD);
41
- }
42
- }
43
- return world;
44
- }export{generateWorld,seedFromString};//# sourceMappingURL=worldgen.js.map
8
+ }export{seedFromString};//# sourceMappingURL=worldgen.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"worldgen.js","sources":["../../../../../../src/features/games/vendored/core/cubeforge/worldgen.ts"],"sourcesContent":["/**\n * Cubeforge world generation.\n *\n * A small, deterministic, seeded generator: a grass/soil/sand ground layer with\n * scattered stone outcrops and a handful of wood \"trees\" to gather. Deterministic\n * (same seed -> same world) so it is unit-testable and a player's world is stable\n * across sessions. Original implementation.\n */\n\nimport { VoxelWorld, DEFAULT_BOUNDS, type WorldBounds } from '../engine/world';\n\n/** mulberry32 - a tiny, fast, well-distributed 32-bit PRNG. */\nfunction mulberry32(seed: number): () => number {\n let a = seed >>> 0;\n return () => {\n a = (a + 0x6d2b79f5) | 0;\n let t = Math.imul(a ^ (a >>> 15), 1 | a);\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/** Turn an arbitrary string (e.g. an org name) into a stable 32-bit seed. */\nexport function seedFromString(input: string): number {\n let h = 2166136261;\n for (let i = 0; i < input.length; i += 1) {\n h ^= input.charCodeAt(i);\n h = Math.imul(h, 16777619);\n }\n return h >>> 0;\n}\n\n// Block ids from the shared palette.\nconst GRASS = 1;\nconst SOIL = 2;\nconst STONE = 3;\nconst WOOD = 4;\nconst SAND = 6;\n\nexport function generateWorld(seed: number, bounds: WorldBounds = DEFAULT_BOUNDS): VoxelWorld {\n const world = VoxelWorld.create(bounds);\n const rnd = mulberry32(seed || 1);\n\n // Ground layer with soil / sand patches.\n for (let x = 0; x < bounds.x; x += 1) {\n for (let y = 0; y < bounds.y; y += 1) {\n const r = rnd();\n const ground = r < 0.12 ? SAND : r < 0.26 ? SOIL : GRASS;\n world.place(x, y, 0, ground);\n // Occasional stone outcrop one block high.\n if (bounds.z > 1 && rnd() < 0.06) world.place(x, y, 1, STONE);\n }\n }\n\n // A few trees: short wood columns the player can harvest.\n const treeCount = Math.max(3, Math.floor((bounds.x * bounds.y) / 24));\n for (let i = 0; i < treeCount; i += 1) {\n const x = Math.floor(rnd() * bounds.x);\n const y = Math.floor(rnd() * bounds.y);\n const height = 2 + Math.floor(rnd() * 2); // 2-3 tall\n for (let z = 1; z <= height && z < bounds.z; z += 1) {\n // place() no-ops on an occupied cell (e.g. a stone outcrop), which is fine.\n world.place(x, y, z, WOOD);\n }\n }\n\n return world;\n}\n"],"names":[],"mappings":"2DAYA,SAAS,WAAW,IAA4B,EAAA;AAC9C,EAAA,IAAI,IAAI,IAAS,KAAA,CAAA;AACjB,EAAA,OAAO,MAAM;AACX,IAAA,CAAA,GAAI,IAAI,UAAa,GAAA,CAAA;AACrB,IAAA,IAAI,IAAI,IAAK,CAAA,IAAA,CAAK,IAAI,CAAM,KAAA,EAAA,EAAI,IAAI,CAAC,CAAA;AACrC,IAAI,CAAA,GAAA,CAAA,GAAI,KAAK,IAAK,CAAA,CAAA,GAAI,MAAM,CAAG,EAAA,EAAA,GAAK,CAAC,CAAI,GAAA,CAAA;AACzC,IAAS,OAAA,CAAA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I,EAAA,GAAI,IAAM,EAAA,KAAA,CAAM,KAAM,CAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,KAAK,CAAA;AAAA;AAC9D;AAIF,EAAM,MAAA,SAAA,GAAY,IAAK,CAAA,GAAA,CAAI,CAAG,EAAA,IAAA,CAAK,KAAM,CAAA,MAAA,CAAO,CAAI,GAAA,MAAA,CAAO,CAAI,GAAA,EAAE,CAAC,CAAA;AAClE,EAAA,KAAA,IAAS,CAAI,GAAA,CAAA,EAAG,CAAI,GAAA,SAAA,EAAW,KAAK,CAAG,EAAA;AACrC,IAAA,MAAM,IAAI,IAAK,CAAA,KAAA,CAAM,GAAI,EAAA,GAAI,OAAO,CAAC,CAAA;AACrC,IAAA,MAAM,IAAI,IAAK,CAAA,KAAA,CAAM,GAAI,EAAA,GAAI,OAAO,CAAC,CAAA;AACrC,IAAA,MAAM,SAAS,CAAI,GAAA,IAAA,CAAK,KAAM,CAAA,GAAA,KAAQ,CAAC,CAAA;AACvC,IAAS,KAAA,IAAA,CAAA,GAAI,GAAG,CAAK,IAAA,MAAA,IAAU,IAAI,MAAO,CAAA,CAAA,EAAG,KAAK,CAAG,EAAA;AAEnD,MAAA,KAAA,CAAM,KAAM,CAAA,CAAA,EAAG,CAAG,EAAA,CAAA,EAAG,IAAI,CAAA;AAAA;AAC3B;AAEF,EAAO,OAAA,KAAA;AACT"}
1
+ {"version":3,"file":"worldgen.js","sources":["../../../../../../src/features/games/vendored/core/cubeforge/worldgen.ts"],"sourcesContent":["/**\n * Cubeforge world generation.\n *\n * A small, deterministic, seeded generator: a grass/soil/sand ground layer with\n * scattered stone outcrops and a handful of wood \"trees\" to gather. Deterministic\n * (same seed -> same world) so it is unit-testable and a player's world is stable\n * across sessions. Original implementation.\n */\n\nimport { VoxelWorld, DEFAULT_BOUNDS, type WorldBounds } from '../engine/world';\n\n/** mulberry32 - a tiny, fast, well-distributed 32-bit PRNG. */\nfunction mulberry32(seed: number): () => number {\n let a = seed >>> 0;\n return () => {\n a = (a + 0x6d2b79f5) | 0;\n let t = Math.imul(a ^ (a >>> 15), 1 | a);\n t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;\n return ((t ^ (t >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/** Turn an arbitrary string (e.g. an org name) into a stable 32-bit seed. */\nexport function seedFromString(input: string): number {\n let h = 2166136261;\n for (let i = 0; i < input.length; i += 1) {\n h ^= input.charCodeAt(i);\n h = Math.imul(h, 16777619);\n }\n return h >>> 0;\n}\n\n// Block ids from the shared palette.\nconst GRASS = 1;\nconst SOIL = 2;\nconst STONE = 3;\nconst WOOD = 4;\nconst SAND = 6;\n\nexport function generateWorld(seed: number, bounds: WorldBounds = DEFAULT_BOUNDS): VoxelWorld {\n const world = VoxelWorld.create(bounds);\n const rnd = mulberry32(seed || 1);\n\n // Ground layer with soil / sand patches.\n for (let x = 0; x < bounds.x; x += 1) {\n for (let y = 0; y < bounds.y; y += 1) {\n const r = rnd();\n const ground = r < 0.12 ? SAND : r < 0.26 ? SOIL : GRASS;\n world.place(x, y, 0, ground);\n // Occasional stone outcrop one block high.\n if (bounds.z > 1 && rnd() < 0.06) world.place(x, y, 1, STONE);\n }\n }\n\n // A few trees: short wood columns the player can harvest.\n const treeCount = Math.max(3, Math.floor((bounds.x * bounds.y) / 24));\n for (let i = 0; i < treeCount; i += 1) {\n const x = Math.floor(rnd() * bounds.x);\n const y = Math.floor(rnd() * bounds.y);\n const height = 2 + Math.floor(rnd() * 2); // 2-3 tall\n for (let z = 1; z <= height && z < bounds.z; z += 1) {\n // place() no-ops on an occupied cell (e.g. a stone outcrop), which is fine.\n world.place(x, y, z, WOOD);\n }\n }\n\n return world;\n}\n"],"names":[],"mappings":"6BAuBO,SAAS,eAAe,KAAuB,EAAA;AACpD,EAAA,IAAI,CAAI,GAAA,UAAA;AACR,EAAA,KAAA,IAAS,IAAI,CAAG,EAAA,CAAA,GAAI,KAAM,CAAA,MAAA,EAAQ,KAAK,CAAG,EAAA;AACxC,IAAK,CAAA,IAAA,KAAA,CAAM,WAAW,CAAC,CAAA;AACvB,IAAI,CAAA,GAAA,IAAA,CAAK,IAAK,CAAA,CAAA,EAAG,QAAQ,CAAA;AAAA;AAE3B,EAAA,OAAO,CAAM,KAAA,CAAA;AACf"}
@@ -1,4 +1,3 @@
1
- const EMPTY = 0;
2
1
  const BLOCKS = [{
3
2
  id: 1,
4
3
  key: "grass",
@@ -40,14 +39,8 @@ const BLOCKS = [{
40
39
  name: "Glass",
41
40
  faces: ["#bfe9ef", "#a3d6df", "#8bc3cf"]
42
41
  }];
43
- const BY_ID = new Map(BLOCKS.map((b) => [b.id, b]));
42
+ new Map(BLOCKS.map((b) => [b.id, b]));
44
43
  const BY_KEY = new Map(BLOCKS.map((b) => [b.key, b]));
45
- function blockById(id) {
46
- return BY_ID.get(id);
47
- }
48
44
  function blockByKey(key) {
49
45
  return BY_KEY.get(key);
50
- }
51
- function isValidBlockId(id) {
52
- return id !== EMPTY && BY_ID.has(id);
53
- }export{BLOCKS,EMPTY,blockById,blockByKey,isValidBlockId};//# sourceMappingURL=palette.js.map
46
+ }export{BLOCKS,blockByKey};//# sourceMappingURL=palette.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"palette.js","sources":["../../../../../../src/features/games/vendored/core/engine/palette.ts"],"sourcesContent":["/**\n * The block palette for the block-building game. Original art direction: a small,\n * friendly set of material blocks, each with top / left / right face shades for\n * the isometric renderer. Ids are stable and used in saved worlds.\n */\n\nexport type BlockId = number;\n\nexport const EMPTY: BlockId = 0;\n\nexport interface BlockType {\n readonly id: BlockId;\n readonly key: string;\n readonly name: string;\n /** [top, left, right] face colors, light to dark. */\n readonly faces: readonly [string, string, string];\n}\n\nexport const BLOCKS: readonly BlockType[] = [\n { id: 1, key: 'grass', name: 'Grass', faces: ['#7cc86b', '#5aa64f', '#49893f'] },\n { id: 2, key: 'soil', name: 'Soil', faces: ['#b07a4e', '#95623b', '#7a4e2c'] },\n { id: 3, key: 'stone', name: 'Stone', faces: ['#b9bdc6', '#9aa0aa', '#7f858f'] },\n { id: 4, key: 'wood', name: 'Wood', faces: ['#d6a86a', '#b98a4f', '#9c7039'] },\n { id: 5, key: 'water', name: 'Water', faces: ['#5bb3e6', '#3f95cc', '#2f7cae'] },\n { id: 6, key: 'sand', name: 'Sand', faces: ['#ead9a0', '#d4bf7f', '#bca564'] },\n { id: 7, key: 'brick', name: 'Brick', faces: ['#d1684f', '#b34e38', '#953c29'] },\n { id: 8, key: 'glass', name: 'Glass', faces: ['#bfe9ef', '#a3d6df', '#8bc3cf'] },\n];\n\nconst BY_ID = new Map<BlockId, BlockType>(BLOCKS.map((b) => [b.id, b]));\nconst BY_KEY = new Map<string, BlockType>(BLOCKS.map((b) => [b.key, b]));\n\nexport function blockById(id: BlockId): BlockType | undefined {\n return BY_ID.get(id);\n}\n\nexport function blockByKey(key: string): BlockType | undefined {\n return BY_KEY.get(key);\n}\n\nexport function isValidBlockId(id: BlockId): boolean {\n return id !== EMPTY && BY_ID.has(id);\n}\n"],"names":[],"mappings":"AAOO,MAAM,KAAiB,GAAA;AAQvB,MAAM,SAA+B,CAAC;AAAA,EAC3C,EAAI,EAAA,CAAA;AAAA,EACJ,GAAK,EAAA,OAAA;AAAA,EACL,IAAM,EAAA,OAAA;AAAA,EACN,KAAO,EAAA,CAAC,SAAW,EAAA,SAAA,EAAW,SAAS;AACzC,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,CAAA;AAAA,EACJ,GAAK,EAAA,MAAA;AAAA,EACL,IAAM,EAAA,MAAA;AAAA,EACN,KAAO,EAAA,CAAC,SAAW,EAAA,SAAA,EAAW,SAAS;AACzC,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,CAAA;AAAA,EACJ,GAAK,EAAA,OAAA;AAAA,EACL,IAAM,EAAA,OAAA;AAAA,EACN,KAAO,EAAA,CAAC,SAAW,EAAA,SAAA,EAAW,SAAS;AACzC,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,CAAA;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AA;AACvB;AACO,SAAS,eAAe,EAAsB,EAAA;AACnD,EAAA,OAAO,EAAO,KAAA,KAAA,IAAS,KAAM,CAAA,GAAA,CAAI,EAAE,CAAA;AACrC"}
1
+ {"version":3,"file":"palette.js","sources":["../../../../../../src/features/games/vendored/core/engine/palette.ts"],"sourcesContent":["/**\n * The block palette for the block-building game. Original art direction: a small,\n * friendly set of material blocks, each with top / left / right face shades for\n * the isometric renderer. Ids are stable and used in saved worlds.\n */\n\nexport type BlockId = number;\n\nexport const EMPTY: BlockId = 0;\n\nexport interface BlockType {\n readonly id: BlockId;\n readonly key: string;\n readonly name: string;\n /** [top, left, right] face colors, light to dark. */\n readonly faces: readonly [string, string, string];\n}\n\nexport const BLOCKS: readonly BlockType[] = [\n { id: 1, key: 'grass', name: 'Grass', faces: ['#7cc86b', '#5aa64f', '#49893f'] },\n { id: 2, key: 'soil', name: 'Soil', faces: ['#b07a4e', '#95623b', '#7a4e2c'] },\n { id: 3, key: 'stone', name: 'Stone', faces: ['#b9bdc6', '#9aa0aa', '#7f858f'] },\n { id: 4, key: 'wood', name: 'Wood', faces: ['#d6a86a', '#b98a4f', '#9c7039'] },\n { id: 5, key: 'water', name: 'Water', faces: ['#5bb3e6', '#3f95cc', '#2f7cae'] },\n { id: 6, key: 'sand', name: 'Sand', faces: ['#ead9a0', '#d4bf7f', '#bca564'] },\n { id: 7, key: 'brick', name: 'Brick', faces: ['#d1684f', '#b34e38', '#953c29'] },\n { id: 8, key: 'glass', name: 'Glass', faces: ['#bfe9ef', '#a3d6df', '#8bc3cf'] },\n];\n\nconst BY_ID = new Map<BlockId, BlockType>(BLOCKS.map((b) => [b.id, b]));\nconst BY_KEY = new Map<string, BlockType>(BLOCKS.map((b) => [b.key, b]));\n\nexport function blockById(id: BlockId): BlockType | undefined {\n return BY_ID.get(id);\n}\n\nexport function blockByKey(key: string): BlockType | undefined {\n return BY_KEY.get(key);\n}\n\nexport function isValidBlockId(id: BlockId): boolean {\n return id !== EMPTY && BY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AA,CAAA;AAAA,EACJ,GAAK,EAAA,OAAA;AAAA,EACL,IAAM,EAAA,OAAA;AAAA,EACN,KAAO,EAAA,CAAC,SAAW,EAAA,SAAA,EAAW,SAAS;AACzC,CAAC;AACa,IAAI,GAAA,CAAwB,MAAO,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAC,CAAE,CAAA,EAAA,EAAI,CAAC,CAAC,CAAC;AACpE,MAAM,MAAA,GAAS,IAAI,GAAA,CAAuB,MAAO,CAAA,GAAA,CAAI,CAAK,CAAA,KAAA,CAAC,CAAE,CAAA,GAAA,EAAK,CAAC,CAAC,CAAC,CAAA;AAI9D,SAAS,WAAW,GAAoC,EAAA;AAC7D,EAAO,OAAA,MAAA,CAAO,IAAI,GAAG,CAAA;AACvB"}
@@ -1,97 +1,3 @@
1
1
  import {blockByKey}from'../engine/palette.js';var _a, _b;
2
- const grass = (_a = blockByKey("grass")) == null ? void 0 : _a.id;
3
- (_b = blockByKey("stone")) == null ? void 0 : _b.id;
4
- const LESSONS = [{
5
- id: "first-blocks",
6
- title: "First Blocks",
7
- summary: "Tap the ground to place your first five blocks.",
8
- goal: {
9
- kind: "placeCount",
10
- target: 5
11
- }
12
- }, {
13
- id: "solid-ground",
14
- title: "Solid Ground",
15
- summary: "Lay a 3 x 3 floor of grass to stand on.",
16
- goal: grass !== void 0 ? {
17
- kind: "placeCount",
18
- target: 9,
19
- block: grass
20
- } : {
21
- kind: "placeCount",
22
- target: 9
23
- }
24
- }, {
25
- id: "raise-a-pillar",
26
- title: "Raise a Pillar",
27
- summary: "Stack four stone blocks straight up.",
28
- goal: buildPillar()
29
- }, {
30
- id: "build-an-arch",
31
- title: "Build an Arch",
32
- summary: "Place the blocks to complete a small arch.",
33
- goal: {
34
- kind: "buildShape",
35
- cells: [{
36
- x: 3,
37
- y: 5,
38
- z: 0
39
- }, {
40
- x: 3,
41
- y: 5,
42
- z: 1
43
- }, {
44
- x: 3,
45
- y: 5,
46
- z: 2
47
- }, {
48
- x: 4,
49
- y: 5,
50
- z: 2
51
- }, {
52
- x: 5,
53
- y: 5,
54
- z: 2
55
- }, {
56
- x: 5,
57
- y: 5,
58
- z: 1
59
- }, {
60
- x: 5,
61
- y: 5,
62
- z: 0
63
- }]
64
- }
65
- }];
66
- function buildPillar(block) {
67
- const cells = [0, 1, 2, 3].map((z) => ({
68
- x: 6,
69
- y: 6,
70
- z
71
- }));
72
- return {
73
- kind: "buildShape",
74
- cells
75
- };
76
- }
77
- function evaluateLesson(lesson, blocks) {
78
- const goal = lesson.goal;
79
- if (goal.kind === "placeCount") {
80
- const count = goal.block === void 0 ? blocks.length : blocks.reduce((n, b) => b.block === goal.block ? n + 1 : n, 0);
81
- return clampProgress(count, goal.target);
82
- }
83
- const present = new Set(blocks.map((b) => `${b.x},${b.y},${b.z}`));
84
- let matched = 0;
85
- for (const cell of goal.cells) {
86
- if (present.has(`${cell.x},${cell.y},${cell.z}`)) matched += 1;
87
- }
88
- return clampProgress(matched, goal.cells.length);
89
- }
90
- function clampProgress(rawCurrent, target) {
91
- const current = Math.max(0, Math.min(rawCurrent, target));
92
- return {
93
- current,
94
- target,
95
- done: rawCurrent >= target
96
- };
97
- }export{LESSONS,evaluateLesson};//# sourceMappingURL=lessons.js.map
2
+ (_a = blockByKey("grass")) == null ? void 0 : _a.id;
3
+ (_b = blockByKey("stone")) == null ? void 0 : _b.id;//# sourceMappingURL=lessons.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lessons.js","sources":["../../../../../../src/features/games/vendored/core/lessons/lessons.ts"],"sourcesContent":["/**\n * Guided lessons for the block-building game. Original content.\n *\n * Progress is clamped to the target so a completed lesson never reads like\n * \"15 of 5\" when a learner keeps building past the goal.\n */\n\nimport { blockByKey } from '../engine/palette';\nimport type { BlockId } from '../engine/palette';\nimport type { PlacedBlock } from '../engine/world';\n\nexport type LessonGoal =\n | { kind: 'placeCount'; target: number; block?: BlockId }\n | { kind: 'buildShape'; cells: readonly { x: number; y: number; z: number }[] };\n\nexport interface Lesson {\n readonly id: string;\n readonly title: string;\n readonly summary: string;\n readonly goal: LessonGoal;\n}\n\nexport interface LessonProgress {\n /** Progress toward the goal, clamped to [0, target]. */\n readonly current: number;\n readonly target: number;\n readonly done: boolean;\n}\n\nconst grass = blockByKey('grass')?.id;\nconst stone = blockByKey('stone')?.id;\n\nexport const LESSONS: readonly Lesson[] = [\n {\n id: 'first-blocks',\n title: 'First Blocks',\n summary: 'Tap the ground to place your first five blocks.',\n goal: { kind: 'placeCount', target: 5 },\n },\n {\n id: 'solid-ground',\n title: 'Solid Ground',\n summary: 'Lay a 3 x 3 floor of grass to stand on.',\n goal: grass !== undefined ? { kind: 'placeCount', target: 9, block: grass } : { kind: 'placeCount', target: 9 },\n },\n {\n id: 'raise-a-pillar',\n title: 'Raise a Pillar',\n summary: 'Stack four stone blocks straight up.',\n goal: buildPillar(stone),\n },\n {\n id: 'build-an-arch',\n title: 'Build an Arch',\n summary: 'Place the blocks to complete a small arch.',\n goal: {\n kind: 'buildShape',\n cells: [\n { x: 3, y: 5, z: 0 },\n { x: 3, y: 5, z: 1 },\n { x: 3, y: 5, z: 2 },\n { x: 4, y: 5, z: 2 },\n { x: 5, y: 5, z: 2 },\n { x: 5, y: 5, z: 1 },\n { x: 5, y: 5, z: 0 },\n ],\n },\n },\n];\n\nfunction buildPillar(block: BlockId | undefined): LessonGoal {\n const cells = [0, 1, 2, 3].map((z) => ({ x: 6, y: 6, z }));\n // Represent as a shape so it must be an actual stacked pillar, not any 4 blocks.\n return { kind: 'buildShape', cells };\n void block;\n}\n\n/** Evaluate how far a world has progressed through a lesson. */\nexport function evaluateLesson(lesson: Lesson, blocks: readonly PlacedBlock[]): LessonProgress {\n const goal = lesson.goal;\n if (goal.kind === 'placeCount') {\n const count =\n goal.block === undefined ? blocks.length : blocks.reduce((n, b) => (b.block === goal.block ? n + 1 : n), 0);\n return clampProgress(count, goal.target);\n }\n\n const present = new Set(blocks.map((b) => `${b.x},${b.y},${b.z}`));\n let matched = 0;\n for (const cell of goal.cells) {\n if (present.has(`${cell.x},${cell.y},${cell.z}`)) matched += 1;\n }\n return clampProgress(matched, goal.cells.length);\n}\n\nfunction clampProgress(rawCurrent: number, target: number): LessonProgress {\n const current = Math.max(0, Math.min(rawCurrent, target));\n return { current, target, done: rawCurrent >= target };\n}\n\nexport function lessonById(id: string): Lesson | undefined {\n return LESSONS.find((l) => l.id === id);\n}\n"],"names":[],"mappings":"8CAAA,IAAA,EAAA,EAAA,EAAA;AAkCA,MAAM,KAAQ,GAAA,CAAA,EAAA,GAAA,UAAA,CAAW,OAAO,CAAA,KAAlB,IAAqB,GAAA,MAAA,GAAA,EAAA,CAAA,EAAA;AACrB,CAAA,EAAA,GAAA,UAAA,CAAW,OAAO,CAAA,KAAlB,IAAqB,GAAA,MAAA,GAAA,EAAA,CAAA;AAC5B,MAAM,UAA6B,CAAC;AAAA,EACzC,EAAI,EAAA,cAAA;AAAA,EACJ,KAAO,EAAA,cAAA;AAAA,EACP,OAAS,EAAA,iDAAA;AAAA,EACT,IAAM,EAAA;AAAA,IACJ,IAAM,EAAA,YAAA;AAAA,IACN,MAAQ,EAAA;AAAA;AAEZ,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,cAAA;AAAA,EACJ,KAAO,EAAA,cAAA;AAAA,EACP,OAAS,EAAA,yCAAA;AAAA,EACT,IAAA,EAAM,UAAU,MAAY,GAAA;AAAA,IAC1B,IAAM,EAAA,YAAA;AAAA,IACN,MAAQ,EAAA,CAAA;AAAA,IACR,KAAO,EAAA;AAAA,GACL,GAAA;AAAA,IACF,IAAM,EAAA,YAAA;AAAA,IACN,MAAQ,EAAA;AAAA;AAEZ,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,gBAAA;AAAA,EACJ,KAAO,EAAA,gBAAA;AAAA,EACP,OAAS,EAAA,sCAAA;AAAA,EACT,IAAA,EAAM,YAAiB;AACzB,CAAG,EAAA;AAAA,EACD,EAAI,EAAA,eAAA;AAAA,EACJ,KAAO,EAA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AAK,SAAS,YAAc,EAAA;AAC9B,IAAA,MAAM,QAAQ,IAAK,CAAA,KAAA,KAAU,SAAY,MAAO,CAAA,MAAA,GAAS,OAAO,MAAO,CAAA,CAAC,CAAG,EAAA,CAAA,KAAM,EAAE,KAAU,KAAA,IAAA,CAAK,QAAQ,CAAI,GAAA,CAAA,GAAI,GAAG,CAAC,CAAA;AACtH,IAAO,OAAA,aAAA,CAAc,KAAO,EAAA,IAAA,CAAK,MAAM,CAAA;AAAA;AAEzC,EAAA,MAAM,UAAU,IAAI,GAAA,CAAI,MAAO,CAAA,GAAA,CAAI,OAAK,CAAG,EAAA,CAAA,CAAE,CAAC,CAAA,CAAA,EAAI,EAAE,CAAC,CAAA,CAAA,EAAI,CAAE,CAAA,CAAC,EAAE,CAAC,CAAA;AAC/D,EAAA,IAAI,OAAU,GAAA,CAAA;AACd,EAAW,KAAA,MAAA,IAAA,IAAQ,KAAK,KAAO,EAAA;AAC7B,IAAA,IAAI,OAAQ,CAAA,GAAA,CAAI,CAAG,EAAA,IAAA,CAAK,CAAC,CAAA,CAAA,EAAI,IAAK,CAAA,CAAC,CAAI,CAAA,EAAA,IAAA,CAAK,CAAC,CAAA,CAAE,GAAc,OAAA,IAAA,CAAA;AAAA;AAE/D,EAAA,OAAO,aAAc,CAAA,OAAA,EAAS,IAAK,CAAA,KAAA,CAAM,MAAM,CAAA;AACjD;AACA,SAAS,aAAA,CAAc,YAAoB,MAAgC,EAAA;AACzE,EAAM,MAAA,OAAA,GAAU,KAAK,GAAI,CAAA,CAAA,EAAG,KAAK,GAAI,CAAA,UAAA,EAAY,MAAM,CAAC,CAAA;AACxD,EAAO,OAAA;AAAA,IACL,OAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAM,UAAc,IAAA;AAAA,GACtB;AACF"}
1
+ {"version":3,"file":"lessons.js","sources":["../../../../../../src/features/games/vendored/core/lessons/lessons.ts"],"sourcesContent":["/**\n * Guided lessons for the block-building game. Original content.\n *\n * Progress is clamped to the target so a completed lesson never reads like\n * \"15 of 5\" when a learner keeps building past the goal.\n */\n\nimport { blockByKey } from '../engine/palette';\nimport type { BlockId } from '../engine/palette';\nimport type { PlacedBlock } from '../engine/world';\n\nexport type LessonGoal =\n | { kind: 'placeCount'; target: number; block?: BlockId }\n | { kind: 'buildShape'; cells: readonly { x: number; y: number; z: number }[] };\n\nexport interface Lesson {\n readonly id: string;\n readonly title: string;\n readonly summary: string;\n readonly goal: LessonGoal;\n}\n\nexport interface LessonProgress {\n /** Progress toward the goal, clamped to [0, target]. */\n readonly current: number;\n readonly target: number;\n readonly done: boolean;\n}\n\nconst grass = blockByKey('grass')?.id;\nconst stone = blockByKey('stone')?.id;\n\nexport const LESSONS: readonly Lesson[] = [\n {\n id: 'first-blocks',\n title: 'First Blocks',\n summary: 'Tap the ground to place your first five blocks.',\n goal: { kind: 'placeCount', target: 5 },\n },\n {\n id: 'solid-ground',\n title: 'Solid Ground',\n summary: 'Lay a 3 x 3 floor of grass to stand on.',\n goal: grass !== undefined ? { kind: 'placeCount', target: 9, block: grass } : { kind: 'placeCount', target: 9 },\n },\n {\n id: 'raise-a-pillar',\n title: 'Raise a Pillar',\n summary: 'Stack four stone blocks straight up.',\n goal: buildPillar(stone),\n },\n {\n id: 'build-an-arch',\n title: 'Build an Arch',\n summary: 'Place the blocks to complete a small arch.',\n goal: {\n kind: 'buildShape',\n cells: [\n { x: 3, y: 5, z: 0 },\n { x: 3, y: 5, z: 1 },\n { x: 3, y: 5, z: 2 },\n { x: 4, y: 5, z: 2 },\n { x: 5, y: 5, z: 2 },\n { x: 5, y: 5, z: 1 },\n { x: 5, y: 5, z: 0 },\n ],\n },\n },\n];\n\nfunction buildPillar(block: BlockId | undefined): LessonGoal {\n const cells = [0, 1, 2, 3].map((z) => ({ x: 6, y: 6, z }));\n // Represent as a shape so it must be an actual stacked pillar, not any 4 blocks.\n return { kind: 'buildShape', cells };\n void block;\n}\n\n/** Evaluate how far a world has progressed through a lesson. */\nexport function evaluateLesson(lesson: Lesson, blocks: readonly PlacedBlock[]): LessonProgress {\n const goal = lesson.goal;\n if (goal.kind === 'placeCount') {\n const count =\n goal.block === undefined ? blocks.length : blocks.reduce((n, b) => (b.block === goal.block ? n + 1 : n), 0);\n return clampProgress(count, goal.target);\n }\n\n const present = new Set(blocks.map((b) => `${b.x},${b.y},${b.z}`));\n let matched = 0;\n for (const cell of goal.cells) {\n if (present.has(`${cell.x},${cell.y},${cell.z}`)) matched += 1;\n }\n return clampProgress(matched, goal.cells.length);\n}\n\nfunction clampProgress(rawCurrent: number, target: number): LessonProgress {\n const current = Math.max(0, Math.min(rawCurrent, target));\n return { current, target, done: rawCurrent >= target };\n}\n\nexport function lessonById(id: string): Lesson | undefined {\n return LESSONS.find((l) => l.id === id);\n}\n"],"names":[],"mappings":"8CAAA,IAAA,EAAA,EAAA,EAAA;AAkCc,CAAA,EAAA,GAAA,UAAA,CAAW,OAAO,CAAA,KAAlB,IAAqB,GAAA,MAAA,GAAA,EAAA,CAAA;AACrB,CAAA,EAAA,GAAA,UAAA,CAAW,OAAO,CAAA,KAAlB,IAAqB,GAAA,MAAA,GAAA,EAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import {jsxs,jsx}from'react/jsx-runtime';import {useMemo,useState,useRef,useCallback,useEffect}from'react';import {useColorScheme,View}from'react-native';import'../core/engine/palette.js';import {GameSession}from'../core/session/gameSession.js';import {GameLogger}from'../core/logging/logger.js';import'../core/lessons/lessons.js';import {WorldRepository}from'../core/storage/worldRepository.js';import {gameById,BLOCKWRIGHT_ID,CUBEFORGE_ID}from'../core/games/catalog.js';import'../core/cubeforge/items.js';import'../core/cubeforge/recipes.js';import {seedFromString}from'../core/cubeforge/worldgen.js';import {CubeforgeSession}from'../core/cubeforge/session.js';import {CubeforgeRepository}from'../core/cubeforge/save.js';import {NativeWorldRepository}from'../core/cubeforge/nativeWorlds.js';import {sharedWorldKey,parseInviteCode}from'../core/cubeforge/sharedWorlds.js';import {getTheme}from'./theme.js';import {createAsyncStorageAdapter}from'./storage/asyncStorageAdapter.js';import {HubScreen}from'./screens/HubScreen.js';import {WorldListScreen}from'./screens/WorldListScreen.js';import {BuilderScreen}from'./screens/BuilderScreen.js';import {ClassroomScreen}from'./screens/ClassroomScreen.js';import {ActivityScreen}from'./screens/ActivityScreen.js';import {CubeforgeScreen}from'./screens/CubeforgeScreen.js';import {Cubeforge3DHomeScreen}from'./screens/Cubeforge3DHomeScreen.js';var __defProp = Object.defineProperty;
1
+ import {jsxs,jsx}from'react/jsx-runtime';import {useMemo,useState,useEffect,useCallback}from'react';import {useColorScheme,View,StyleSheet,Text}from'react-native';import'../core/engine/palette.js';import'../core/lessons/lessons.js';import'../core/cubeforge/items.js';import'../core/cubeforge/recipes.js';import {seedFromString}from'../core/cubeforge/worldgen.js';import {nativeWorldKey}from'../core/cubeforge/nativeWorld.js';import {NativeWorldRepository}from'../core/cubeforge/nativeWorlds.js';import {SkinRepository,skinToHex}from'../core/cubeforge/skin.js';import {sharedWorldKey,parseInviteCode}from'../core/cubeforge/sharedWorlds.js';import {Cubeforge3DHomeScreen}from'./screens/Cubeforge3DHomeScreen.js';import {ScreenHeader}from'./screens/ScreenHeader.js';import {SkinEditorScreen}from'./screens/SkinEditorScreen.js';import {createAsyncStorageAdapter}from'./storage/asyncStorageAdapter.js';import {getTheme,spacing}from'./theme.js';var __defProp = Object.defineProperty;
2
2
  var __defProps = Object.defineProperties;
3
3
  var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
@@ -17,15 +17,12 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- const FALLBACK_NAME = "Blockwright";
21
20
  function YantraGames(props) {
22
- var _a, _b, _c, _d, _e;
21
+ var _a;
23
22
  const {
24
23
  orgName,
25
24
  onExit,
26
25
  storage: storageProp,
27
- logSink,
28
- multiplayer,
29
26
  cubeforge3D: Cubeforge3D,
30
27
  cubeforgeFriends: friends,
31
28
  cubeforgeInvite,
@@ -33,105 +30,30 @@ function YantraGames(props) {
33
30
  deleteCubeforge3DSave
34
31
  } = props;
35
32
  const systemScheme = useColorScheme();
36
- const mode = (_a = props.theme) != null ? _a : systemScheme === "dark" ? "dark" : "light";
37
- const theme = getTheme(mode);
33
+ const theme = getTheme((_a = props.theme) != null ? _a : systemScheme === "dark" ? "dark" : "light");
38
34
  const storage = useMemo(() => storageProp != null ? storageProp : createAsyncStorageAdapter(), [storageProp]);
39
- const repo = useMemo(() => new WorldRepository(storage, orgName || "default"), [storage, orgName]);
40
- const logger = useMemo(() => new GameLogger(logSink ? [logSink] : []), [logSink]);
41
- const cubeRepo = useMemo(() => new CubeforgeRepository(storage, orgName || "default"), [storage, orgName]);
42
- const nativeWorlds = useMemo(() => new NativeWorldRepository(storage, orgName || "default"), [storage, orgName]);
43
- const [screen, setScreen] = useState({
44
- name: "hub"
45
- });
46
- const [session, setSession] = useState(null);
47
- const [cube, setCube] = useState(null);
48
- const recordRef = useRef(null);
49
- const gameName = (_c = (_b = gameById(BLOCKWRIGHT_ID)) == null ? void 0 : _b.name) != null ? _c : FALLBACK_NAME;
50
- const openWorld = useCallback(async (worldId) => {
51
- var _a2;
52
- const record = (_a2 = await repo.load(worldId)) != null ? _a2 : await repo.create("New World");
53
- recordRef.current = record;
54
- const transport = multiplayer == null ? void 0 : multiplayer.connect(record.id);
55
- setSession(new GameSession({
56
- world: record.world,
57
- settings: record.settings,
58
- permissions: record.permissions,
59
- actingLevel: "operator",
60
- logger,
61
- worldId: record.id,
62
- transport
63
- }));
64
- setScreen({
65
- name: "builder"
66
- });
67
- }, [repo, logger, multiplayer]);
35
+ const worlds = useMemo(() => new NativeWorldRepository(storage, orgName || "default"), [storage, orgName]);
36
+ const skins = useMemo(() => new SkinRepository(storage, orgName || "default"), [storage, orgName]);
37
+ const [skin, setSkin] = useState(null);
68
38
  useEffect(() => {
69
- if (!session) return;
70
- let timer;
71
- const persist = () => {
72
- const rec = recordRef.current;
73
- if (!rec) return;
74
- const next = __spreadProps(__spreadValues({}, rec), {
75
- settings: session.exportSettings(),
76
- permissions: session.exportPermissions(),
77
- world: session.exportWorld()
78
- });
79
- recordRef.current = next;
80
- void repo.save(next);
81
- };
82
- const unsub = session.query.subscribe(() => {
83
- if (timer) clearTimeout(timer);
84
- timer = setTimeout(persist, 500);
85
- });
86
- return () => {
87
- if (timer) clearTimeout(timer);
88
- unsub();
89
- persist();
90
- session.dispose();
91
- };
92
- }, [session, repo]);
93
- const closeWorld = useCallback(() => {
94
- setSession(null);
95
- recordRef.current = null;
96
- setScreen({
97
- name: "worlds"
98
- });
99
- }, []);
100
- const openCubeforge = useCallback(async () => {
101
- const saved = await cubeRepo.load();
102
- const seed = seedFromString(orgName || "default");
103
- setCube(new CubeforgeSession(saved != null ? saved : {
104
- seed
105
- }));
106
- setScreen({
107
- name: "cubeforge"
108
- });
109
- }, [cubeRepo, orgName]);
110
- const closeCubeforge = useCallback(() => {
111
- setCube(null);
112
- setScreen({
113
- name: "hub"
114
- });
115
- }, []);
116
- useEffect(() => {
117
- if (!cube) return;
118
- let timer;
119
- const persist = () => {
120
- void cubeRepo.save(cube.serialize());
121
- };
122
- const unsub = cube.query.subscribe(() => {
123
- if (timer) clearTimeout(timer);
124
- timer = setTimeout(persist, 500);
125
- });
39
+ let live = true;
40
+ skins.load().then((cells) => {
41
+ if (live) setSkin(cells);
42
+ }).catch(() => void 0);
126
43
  return () => {
127
- if (timer) clearTimeout(timer);
128
- unsub();
129
- persist();
44
+ live = false;
130
45
  };
131
- }, [cube, cubeRepo]);
46
+ }, [skins]);
47
+ const [screen, setScreen] = useState(() => cubeforgeInvite ? {
48
+ name: "worlds"
49
+ } : {
50
+ name: "game",
51
+ seed: seedFromString(orgName || "default"),
52
+ worldKey: nativeWorldKey(orgName)
53
+ });
132
54
  const playSolo = useCallback((world) => {
133
55
  setScreen({
134
- name: "cubeforge3d",
56
+ name: "game",
135
57
  seed: world.seed,
136
58
  worldKey: world.key
137
59
  });
@@ -140,7 +62,7 @@ function YantraGames(props) {
140
62
  if (!friends) return;
141
63
  const room = await friends.roomAccess(world);
142
64
  setScreen({
143
- name: "cubeforge3d",
65
+ name: "game",
144
66
  seed: world.seed,
145
67
  worldKey: sharedWorldKey(world.id),
146
68
  shared: world,
@@ -148,23 +70,21 @@ function YantraGames(props) {
148
70
  });
149
71
  }, [friends]);
150
72
  const refreshRoom = useCallback(() => {
151
- if (screen.name !== "cubeforge3d" || !screen.shared || !friends) return;
73
+ if (screen.name !== "game" || !screen.shared || !friends) return;
152
74
  const {
153
75
  shared
154
76
  } = screen;
155
- friends.roomAccess(shared, {
156
- renewToken: true
157
- }).then((room) => setScreen((s) => {
77
+ friends.roomAccess(shared).then((room) => setScreen((s) => {
158
78
  var _a2;
159
- return s.name === "cubeforge3d" && ((_a2 = s.shared) == null ? void 0 : _a2.id) === shared.id ? __spreadProps(__spreadValues({}, s), {
79
+ return s.name === "game" && ((_a2 = s.shared) == null ? void 0 : _a2.id) === shared.id ? __spreadProps(__spreadValues({}, s), {
160
80
  room
161
81
  }) : s;
162
82
  })).catch(() => setScreen({
163
- name: "cubeforge3d-home"
83
+ name: "worlds"
164
84
  }));
165
85
  }, [friends, screen]);
166
86
  useEffect(() => {
167
- if (!cubeforgeInvite || !friends || !Cubeforge3D) return;
87
+ if (!cubeforgeInvite || !friends || !Cubeforge3D) return void 0;
168
88
  let live = true;
169
89
  const code = parseInviteCode(cubeforgeInvite);
170
90
  const accept = async () => {
@@ -181,43 +101,66 @@ function YantraGames(props) {
181
101
  live = false;
182
102
  };
183
103
  }, [cubeforgeInvite, friends, Cubeforge3D, playShared, onCubeforgeInviteHandled]);
184
- const worldName = (_e = (_d = recordRef.current) == null ? void 0 : _d.name) != null ? _e : gameName;
185
- return /* @__PURE__ */ jsxs(View, { style: {
186
- flex: 1,
187
- backgroundColor: theme.bg
188
- }, children: [
189
- screen.name === "hub" ? /* @__PURE__ */ jsx(HubScreen, { theme, onExit, onOpenGame: (gameId) => {
190
- if (gameId === BLOCKWRIGHT_ID) setScreen({
104
+ if (!Cubeforge3D) {
105
+ return /* @__PURE__ */ jsxs(View, { style: [styles.fill, {
106
+ backgroundColor: theme.bg
107
+ }], children: [
108
+ /* @__PURE__ */ jsx(ScreenHeader, { theme, title: "Cubeforge", onBack: onExit, backLabel: "Close" }),
109
+ /* @__PURE__ */ jsxs(View, { style: styles.message, children: [
110
+ /* @__PURE__ */ jsx(Text, { style: [styles.title, {
111
+ color: theme.text
112
+ }], children: "Cubeforge is not on this device yet" }),
113
+ /* @__PURE__ */ jsx(Text, { style: [styles.body, {
114
+ color: theme.textMuted
115
+ }], children: "It is a 3D game that needs the latest Yantra app on a 64-bit phone." })
116
+ ] })
117
+ ] });
118
+ }
119
+ if (screen.name === "worlds") {
120
+ return /* @__PURE__ */ jsx(Cubeforge3DHomeScreen, { theme, worlds, friends, onBack: () => onExit == null ? void 0 : onExit(), onPlaySolo: playSolo, onPlayShared: playShared, onDeleteSave: deleteCubeforge3DSave, onEditAvatar: () => setScreen({
121
+ name: "avatar"
122
+ }) });
123
+ }
124
+ if (screen.name === "avatar") {
125
+ return /* @__PURE__ */ jsx(SkinEditorScreen, { theme, initial: skin, onBack: () => setScreen({
126
+ name: "worlds"
127
+ }), onSave: (cells) => {
128
+ setSkin(cells);
129
+ void skins.save(cells);
130
+ setScreen({
191
131
  name: "worlds"
192
132
  });
193
- else if (gameId === CUBEFORGE_ID) void openCubeforge();
194
- } }) : null,
195
- screen.name === "cubeforge" && cube ? /* @__PURE__ */ jsx(CubeforgeScreen, { theme, session: cube, onBack: closeCubeforge, onPlay3D: Cubeforge3D ? () => setScreen({
196
- name: "cubeforge3d-home"
197
- }) : void 0 }) : null,
198
- screen.name === "cubeforge3d-home" ? /* @__PURE__ */ jsx(Cubeforge3DHomeScreen, { theme, worlds: nativeWorlds, friends, onBack: () => setScreen(cube ? {
199
- name: "cubeforge"
200
- } : {
201
- name: "hub"
202
- }), onPlaySolo: playSolo, onPlayShared: playShared, onDeleteSave: deleteCubeforge3DSave }) : null,
203
- screen.name === "cubeforge3d" && Cubeforge3D ? /* @__PURE__ */ jsx(Cubeforge3D, { seed: screen.seed, worldKey: screen.worldKey, room: screen.room, onExit: () => setScreen({
204
- name: "cubeforge3d-home"
205
- }), onRoomClosed: () => setScreen({
206
- name: "cubeforge3d-home"
207
- }), onTokenExpired: refreshRoom }) : null,
208
- screen.name === "worlds" ? /* @__PURE__ */ jsx(WorldListScreen, { theme, repo, gameName, onOpenWorld: openWorld, onBack: () => setScreen({
209
- name: "hub"
210
- }) }) : null,
211
- screen.name === "builder" && session ? /* @__PURE__ */ jsx(BuilderScreen, { theme, session, logger, worldName, onOpenClassroom: () => setScreen({
212
- name: "classroom"
213
- }), onOpenActivity: () => setScreen({
214
- name: "activity"
215
- }), onBack: closeWorld }) : null,
216
- screen.name === "classroom" && session ? /* @__PURE__ */ jsx(ClassroomScreen, { theme, session, onBack: () => setScreen({
217
- name: "builder"
218
- }) }) : null,
219
- screen.name === "activity" && session ? /* @__PURE__ */ jsx(ActivityScreen, { theme, logger, onBack: () => setScreen({
220
- name: "builder"
221
- }) }) : null
222
- ] });
223
- }export{YantraGames,YantraGames as default};//# sourceMappingURL=GamesRoot.js.map
133
+ } });
134
+ }
135
+ const leaveWorld = () => {
136
+ if (friends) setScreen({
137
+ name: "worlds"
138
+ });
139
+ else onExit == null ? void 0 : onExit();
140
+ };
141
+ return /* @__PURE__ */ jsx(Cubeforge3D, { seed: screen.seed, worldKey: screen.worldKey, room: screen.room, skin: skin ? skinToHex(skin) : void 0, onExit: leaveWorld, onRoomClosed: () => setScreen({
142
+ name: "worlds"
143
+ }), onTokenExpired: refreshRoom });
144
+ }
145
+ const styles = StyleSheet.create({
146
+ fill: {
147
+ flex: 1
148
+ },
149
+ message: {
150
+ flex: 1,
151
+ alignItems: "center",
152
+ justifyContent: "center",
153
+ padding: spacing.lg,
154
+ gap: spacing.sm
155
+ },
156
+ title: {
157
+ fontSize: 18,
158
+ fontWeight: "700",
159
+ textAlign: "center"
160
+ },
161
+ body: {
162
+ fontSize: 15,
163
+ lineHeight: 21,
164
+ textAlign: "center"
165
+ }
166
+ });export{YantraGames,YantraGames as default};//# sourceMappingURL=GamesRoot.js.map