@pie-element/cli 0.1.1 → 0.1.2-next.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.
Files changed (281) hide show
  1. package/README.md +48 -10
  2. package/dist/commands/dev/demo/index.d.ts +1 -1
  3. package/dist/commands/dev/demo/index.js +21 -0
  4. package/dist/commands/dev/demo/index.js.map +1 -1
  5. package/dist/commands/dev/test-bundler.d.ts +0 -1
  6. package/dist/commands/dev/test-bundler.js +2 -10
  7. package/dist/commands/dev/test-bundler.js.map +1 -1
  8. package/dist/commands/docs/generate.d.ts +16 -0
  9. package/dist/commands/docs/generate.js +150 -0
  10. package/dist/commands/docs/generate.js.map +1 -0
  11. package/dist/commands/docs/verify.d.ts +12 -0
  12. package/dist/commands/docs/verify.js +40 -0
  13. package/dist/commands/docs/verify.js.map +1 -0
  14. package/dist/commands/packages/create-controllers.d.ts +0 -1
  15. package/dist/commands/packages/create-controllers.js.map +1 -1
  16. package/dist/commands/packages/create-lib-react.d.ts +0 -1
  17. package/dist/commands/packages/create-lib-react.js +1 -3
  18. package/dist/commands/packages/create-lib-react.js.map +1 -1
  19. package/dist/commands/packages/create-react-elements.d.ts +0 -1
  20. package/dist/commands/packages/create-react-elements.js +2 -3
  21. package/dist/commands/packages/create-react-elements.js.map +1 -1
  22. package/dist/commands/packages/enable-publishing.d.ts +0 -1
  23. package/dist/commands/packages/enable-publishing.js +26 -23
  24. package/dist/commands/packages/enable-publishing.js.map +1 -1
  25. package/dist/commands/packages/init-synced-elements.d.ts +0 -1
  26. package/dist/commands/packages/init-synced-elements.js +1 -1
  27. package/dist/commands/packages/init-synced-elements.js.map +1 -1
  28. package/dist/commands/upstream/analyze-esm.d.ts +0 -1
  29. package/dist/commands/upstream/analyze-esm.js +5 -1
  30. package/dist/commands/upstream/analyze-esm.js.map +1 -1
  31. package/dist/commands/upstream/check.d.ts +0 -1
  32. package/dist/commands/upstream/check.js.map +1 -1
  33. package/dist/commands/upstream/deps.d.ts +0 -1
  34. package/dist/commands/upstream/deps.js.map +1 -1
  35. package/dist/commands/upstream/sync.d.ts +11 -2
  36. package/dist/commands/upstream/sync.js +364 -25
  37. package/dist/commands/upstream/sync.js.map +1 -1
  38. package/dist/commands/upstream/track.d.ts +0 -1
  39. package/dist/commands/upstream/track.js.map +1 -1
  40. package/dist/commands/upstream/update.d.ts +0 -1
  41. package/dist/commands/upstream/update.js +37 -7
  42. package/dist/commands/upstream/update.js.map +1 -1
  43. package/dist/commands/verify/controllers.d.ts +0 -1
  44. package/dist/commands/verify/controllers.js +213 -59
  45. package/dist/commands/verify/controllers.js.map +1 -1
  46. package/dist/commands/verify/dependency-integrity.d.ts +18 -0
  47. package/dist/commands/verify/dependency-integrity.js +147 -0
  48. package/dist/commands/verify/dependency-integrity.js.map +1 -0
  49. package/dist/commands/verify/react-build.d.ts +0 -1
  50. package/dist/commands/verify/react-build.js.map +1 -1
  51. package/dist/index.d.ts +0 -1
  52. package/dist/index.js.map +1 -1
  53. package/dist/lib/docs/contract-validator.d.ts +12 -0
  54. package/dist/lib/docs/contract-validator.js +38 -0
  55. package/dist/lib/docs/contract-validator.js.map +1 -0
  56. package/dist/lib/docs/contracts.d.ts +11 -0
  57. package/dist/lib/docs/contracts.js +241 -0
  58. package/dist/lib/docs/contracts.js.map +1 -0
  59. package/dist/lib/docs/discovery.d.ts +10 -0
  60. package/dist/lib/docs/discovery.js +91 -0
  61. package/dist/lib/docs/discovery.js.map +1 -0
  62. package/dist/lib/docs/generator.d.ts +14 -0
  63. package/dist/lib/docs/generator.js +450 -0
  64. package/dist/lib/docs/generator.js.map +1 -0
  65. package/dist/lib/docs/source-extractor.d.ts +2 -0
  66. package/dist/lib/docs/source-extractor.js +209 -0
  67. package/dist/lib/docs/source-extractor.js.map +1 -0
  68. package/dist/lib/docs/types.d.ts +77 -0
  69. package/dist/lib/docs/types.js +2 -0
  70. package/dist/lib/docs/types.js.map +1 -0
  71. package/dist/lib/upstream/repo-utils.d.ts +0 -1
  72. package/dist/lib/upstream/repo-utils.js.map +1 -1
  73. package/dist/lib/upstream/sync-compatibility.d.ts +0 -1
  74. package/dist/lib/upstream/sync-compatibility.js.map +1 -1
  75. package/dist/lib/upstream/sync-constants.d.ts +35 -7
  76. package/dist/lib/upstream/sync-constants.js +40 -11
  77. package/dist/lib/upstream/sync-constants.js.map +1 -1
  78. package/dist/lib/upstream/sync-controllers-strategy.d.ts +0 -1
  79. package/dist/lib/upstream/sync-controllers-strategy.js +14 -4
  80. package/dist/lib/upstream/sync-controllers-strategy.js.map +1 -1
  81. package/dist/lib/upstream/sync-demo-metadata.d.ts +0 -1
  82. package/dist/lib/upstream/sync-demo-metadata.js +1 -1
  83. package/dist/lib/upstream/sync-demo-metadata.js.map +1 -1
  84. package/dist/lib/upstream/sync-entry-discovery.d.ts +3 -0
  85. package/dist/lib/upstream/sync-entry-discovery.js +23 -0
  86. package/dist/lib/upstream/sync-entry-discovery.js.map +1 -0
  87. package/dist/lib/upstream/sync-externals.d.ts +7 -7
  88. package/dist/lib/upstream/sync-externals.js +51 -35
  89. package/dist/lib/upstream/sync-externals.js.map +1 -1
  90. package/dist/lib/upstream/sync-filesystem.d.ts +0 -1
  91. package/dist/lib/upstream/sync-filesystem.js.map +1 -1
  92. package/dist/lib/upstream/sync-imports.d.ts +82 -62
  93. package/dist/lib/upstream/sync-imports.js +658 -185
  94. package/dist/lib/upstream/sync-imports.js.map +1 -1
  95. package/dist/lib/upstream/sync-package-json.d.ts +0 -1
  96. package/dist/lib/upstream/sync-package-json.js +7 -0
  97. package/dist/lib/upstream/sync-package-json.js.map +1 -1
  98. package/dist/lib/upstream/sync-package-manager.d.ts +14 -4
  99. package/dist/lib/upstream/sync-package-manager.js +405 -72
  100. package/dist/lib/upstream/sync-package-manager.js.map +1 -1
  101. package/dist/lib/upstream/sync-pielib-strategy.d.ts +2 -1
  102. package/dist/lib/upstream/sync-pielib-strategy.js +228 -110
  103. package/dist/lib/upstream/sync-pielib-strategy.js.map +1 -1
  104. package/dist/lib/upstream/sync-presets.d.ts +52 -0
  105. package/dist/lib/upstream/sync-presets.js +175 -0
  106. package/dist/lib/upstream/sync-presets.js.map +1 -0
  107. package/dist/lib/upstream/sync-react-strategy.d.ts +6 -1
  108. package/dist/lib/upstream/sync-react-strategy.js +342 -134
  109. package/dist/lib/upstream/sync-react-strategy.js.map +1 -1
  110. package/dist/lib/upstream/sync-source-edit.d.ts +14 -0
  111. package/dist/lib/upstream/sync-source-edit.js +89 -0
  112. package/dist/lib/upstream/sync-source-edit.js.map +1 -0
  113. package/dist/lib/upstream/sync-source-tree.d.ts +22 -0
  114. package/dist/lib/upstream/sync-source-tree.js +99 -0
  115. package/dist/lib/upstream/sync-source-tree.js.map +1 -0
  116. package/dist/lib/upstream/sync-strategy.d.ts +1 -1
  117. package/dist/lib/upstream/sync-strategy.js.map +1 -1
  118. package/dist/lib/upstream/sync-summary.d.ts +0 -1
  119. package/dist/lib/upstream/sync-summary.js.map +1 -1
  120. package/dist/lib/upstream/sync-transforms.d.ts +13 -11
  121. package/dist/lib/upstream/sync-transforms.js +23 -17
  122. package/dist/lib/upstream/sync-transforms.js.map +1 -1
  123. package/dist/lib/upstream/sync-vite-config.d.ts +13 -1
  124. package/dist/lib/upstream/sync-vite-config.js +65 -46
  125. package/dist/lib/upstream/sync-vite-config.js.map +1 -1
  126. package/dist/utils/compatibility.d.ts +13 -1
  127. package/dist/utils/compatibility.js +143 -2
  128. package/dist/utils/compatibility.js.map +1 -1
  129. package/dist/utils/conversion.d.ts +0 -1
  130. package/dist/utils/conversion.js.map +1 -1
  131. package/dist/utils/dependency-integrity.d.ts +37 -0
  132. package/dist/utils/dependency-integrity.js +557 -0
  133. package/dist/utils/dependency-integrity.js.map +1 -0
  134. package/dist/utils/git.d.ts +0 -1
  135. package/dist/utils/git.js.map +1 -1
  136. package/dist/utils/logger.d.ts +0 -1
  137. package/dist/utils/logger.js.map +1 -1
  138. package/dist/utils/package-json.d.ts +0 -1
  139. package/dist/utils/package-json.js.map +1 -1
  140. package/package.json +25 -8
  141. package/.compatibility/report.json +0 -2491
  142. package/.turbo/turbo-build.log +0 -1
  143. package/CHANGELOG.md +0 -8
  144. package/REFACTORING.md +0 -131
  145. package/bin/dev.js +0 -5
  146. package/dist/commands/dev/demo/index.d.ts.map +0 -1
  147. package/dist/commands/dev/test-bundler.d.ts.map +0 -1
  148. package/dist/commands/mathquill/migrate.d.ts +0 -20
  149. package/dist/commands/mathquill/migrate.d.ts.map +0 -1
  150. package/dist/commands/mathquill/migrate.js +0 -240
  151. package/dist/commands/mathquill/migrate.js.map +0 -1
  152. package/dist/commands/mathquill/status.d.ts +0 -20
  153. package/dist/commands/mathquill/status.d.ts.map +0 -1
  154. package/dist/commands/mathquill/status.js +0 -231
  155. package/dist/commands/mathquill/status.js.map +0 -1
  156. package/dist/commands/packages/create-controllers.d.ts.map +0 -1
  157. package/dist/commands/packages/create-lib-react.d.ts.map +0 -1
  158. package/dist/commands/packages/create-react-elements.d.ts.map +0 -1
  159. package/dist/commands/packages/enable-publishing.d.ts.map +0 -1
  160. package/dist/commands/packages/init-synced-elements.d.ts.map +0 -1
  161. package/dist/commands/upstream/analyze-esm.d.ts.map +0 -1
  162. package/dist/commands/upstream/check.d.ts.map +0 -1
  163. package/dist/commands/upstream/deps.d.ts.map +0 -1
  164. package/dist/commands/upstream/sync-mathquill.d.ts +0 -12
  165. package/dist/commands/upstream/sync-mathquill.d.ts.map +0 -1
  166. package/dist/commands/upstream/sync-mathquill.js +0 -97
  167. package/dist/commands/upstream/sync-mathquill.js.map +0 -1
  168. package/dist/commands/upstream/sync.d.ts.map +0 -1
  169. package/dist/commands/upstream/track.d.ts.map +0 -1
  170. package/dist/commands/upstream/update.d.ts.map +0 -1
  171. package/dist/commands/verify/controllers.d.ts.map +0 -1
  172. package/dist/commands/verify/react-build.d.ts.map +0 -1
  173. package/dist/index.d.ts.map +0 -1
  174. package/dist/lib/mathquill/extension-generator.d.ts +0 -9
  175. package/dist/lib/mathquill/extension-generator.d.ts.map +0 -1
  176. package/dist/lib/mathquill/extension-generator.js +0 -107
  177. package/dist/lib/mathquill/extension-generator.js.map +0 -1
  178. package/dist/lib/mathquill/khan-extractor.d.ts +0 -16
  179. package/dist/lib/mathquill/khan-extractor.d.ts.map +0 -1
  180. package/dist/lib/mathquill/khan-extractor.js +0 -148
  181. package/dist/lib/mathquill/khan-extractor.js.map +0 -1
  182. package/dist/lib/mathquill/learnosity-extractor.d.ts +0 -15
  183. package/dist/lib/mathquill/learnosity-extractor.d.ts.map +0 -1
  184. package/dist/lib/mathquill/learnosity-extractor.js +0 -170
  185. package/dist/lib/mathquill/learnosity-extractor.js.map +0 -1
  186. package/dist/lib/mathquill/migration-orchestrator.d.ts +0 -77
  187. package/dist/lib/mathquill/migration-orchestrator.d.ts.map +0 -1
  188. package/dist/lib/mathquill/migration-orchestrator.js +0 -391
  189. package/dist/lib/mathquill/migration-orchestrator.js.map +0 -1
  190. package/dist/lib/mathquill/package-updater.d.ts +0 -9
  191. package/dist/lib/mathquill/package-updater.d.ts.map +0 -1
  192. package/dist/lib/mathquill/package-updater.js +0 -103
  193. package/dist/lib/mathquill/package-updater.js.map +0 -1
  194. package/dist/lib/mathquill/pie-extractor.d.ts +0 -14
  195. package/dist/lib/mathquill/pie-extractor.d.ts.map +0 -1
  196. package/dist/lib/mathquill/pie-extractor.js +0 -167
  197. package/dist/lib/mathquill/pie-extractor.js.map +0 -1
  198. package/dist/lib/upstream/repo-utils.d.ts.map +0 -1
  199. package/dist/lib/upstream/sync-compatibility.d.ts.map +0 -1
  200. package/dist/lib/upstream/sync-constants.d.ts.map +0 -1
  201. package/dist/lib/upstream/sync-controllers-strategy.d.ts.map +0 -1
  202. package/dist/lib/upstream/sync-demo-metadata.d.ts.map +0 -1
  203. package/dist/lib/upstream/sync-dev-exports.d.ts +0 -13
  204. package/dist/lib/upstream/sync-dev-exports.d.ts.map +0 -1
  205. package/dist/lib/upstream/sync-dev-exports.js +0 -115
  206. package/dist/lib/upstream/sync-dev-exports.js.map +0 -1
  207. package/dist/lib/upstream/sync-externals.d.ts.map +0 -1
  208. package/dist/lib/upstream/sync-filesystem.d.ts.map +0 -1
  209. package/dist/lib/upstream/sync-imports.d.ts.map +0 -1
  210. package/dist/lib/upstream/sync-mathquill.d.ts +0 -19
  211. package/dist/lib/upstream/sync-mathquill.d.ts.map +0 -1
  212. package/dist/lib/upstream/sync-mathquill.js +0 -160
  213. package/dist/lib/upstream/sync-mathquill.js.map +0 -1
  214. package/dist/lib/upstream/sync-package-json.d.ts.map +0 -1
  215. package/dist/lib/upstream/sync-package-manager.d.ts.map +0 -1
  216. package/dist/lib/upstream/sync-pielib-strategy.d.ts.map +0 -1
  217. package/dist/lib/upstream/sync-react-strategy.d.ts.map +0 -1
  218. package/dist/lib/upstream/sync-strategy.d.ts.map +0 -1
  219. package/dist/lib/upstream/sync-summary.d.ts.map +0 -1
  220. package/dist/lib/upstream/sync-transforms.d.ts.map +0 -1
  221. package/dist/lib/upstream/sync-vite-config.d.ts.map +0 -1
  222. package/dist/utils/compatibility.d.ts.map +0 -1
  223. package/dist/utils/conversion.d.ts.map +0 -1
  224. package/dist/utils/git.d.ts.map +0 -1
  225. package/dist/utils/logger.d.ts.map +0 -1
  226. package/dist/utils/package-json.d.ts.map +0 -1
  227. package/packages/cli/bin/dev.js +0 -5
  228. package/packages/cli/bin/run.js +0 -5
  229. package/src/commands/dev/demo/index.ts +0 -313
  230. package/src/commands/dev/test-bundler.ts +0 -345
  231. package/src/commands/mathquill/migrate.ts +0 -269
  232. package/src/commands/mathquill/status.ts +0 -267
  233. package/src/commands/packages/create-controllers.ts +0 -127
  234. package/src/commands/packages/create-lib-react.ts +0 -279
  235. package/src/commands/packages/create-react-elements.ts +0 -306
  236. package/src/commands/packages/enable-publishing.ts +0 -161
  237. package/src/commands/packages/init-synced-elements.ts +0 -259
  238. package/src/commands/upstream/README.md +0 -444
  239. package/src/commands/upstream/analyze-esm.ts +0 -1973
  240. package/src/commands/upstream/check.ts +0 -228
  241. package/src/commands/upstream/deps.ts +0 -222
  242. package/src/commands/upstream/sync-mathquill.ts +0 -108
  243. package/src/commands/upstream/sync.ts +0 -687
  244. package/src/commands/upstream/track.ts +0 -145
  245. package/src/commands/upstream/update.ts +0 -110
  246. package/src/commands/verify/controllers.ts +0 -166
  247. package/src/commands/verify/react-build.ts +0 -171
  248. package/src/index.ts +0 -1
  249. package/src/lib/mathquill/extension-generator.ts +0 -111
  250. package/src/lib/mathquill/khan-extractor.ts +0 -175
  251. package/src/lib/mathquill/learnosity-extractor.ts +0 -198
  252. package/src/lib/mathquill/migration-orchestrator.ts +0 -513
  253. package/src/lib/mathquill/package-updater.ts +0 -120
  254. package/src/lib/mathquill/pie-extractor.ts +0 -194
  255. package/src/lib/upstream/repo-utils.ts +0 -18
  256. package/src/lib/upstream/sync-compatibility.ts +0 -89
  257. package/src/lib/upstream/sync-constants.ts +0 -77
  258. package/src/lib/upstream/sync-controllers-strategy.ts +0 -291
  259. package/src/lib/upstream/sync-demo-metadata.ts +0 -199
  260. package/src/lib/upstream/sync-dev-exports.ts +0 -151
  261. package/src/lib/upstream/sync-externals.ts +0 -159
  262. package/src/lib/upstream/sync-filesystem.ts +0 -87
  263. package/src/lib/upstream/sync-imports.ts +0 -992
  264. package/src/lib/upstream/sync-mathquill.ts +0 -194
  265. package/src/lib/upstream/sync-package-json.ts +0 -86
  266. package/src/lib/upstream/sync-package-manager.ts +0 -694
  267. package/src/lib/upstream/sync-pielib-strategy.ts +0 -441
  268. package/src/lib/upstream/sync-react-strategy.ts +0 -945
  269. package/src/lib/upstream/sync-strategy.ts +0 -61
  270. package/src/lib/upstream/sync-summary.ts +0 -194
  271. package/src/lib/upstream/sync-transforms.ts +0 -154
  272. package/src/lib/upstream/sync-vite-config.ts +0 -243
  273. package/src/types/es-module-lexer.d.ts +0 -4
  274. package/src/utils/compatibility.ts +0 -182
  275. package/src/utils/conversion.ts +0 -153
  276. package/src/utils/git.ts +0 -63
  277. package/src/utils/logger.ts +0 -69
  278. package/src/utils/package-json.ts +0 -43
  279. package/tests/sync-package-manager.test.ts +0 -112
  280. package/tests/transform-assign-props.test.ts +0 -101
  281. package/tsconfig.json +0 -15
@@ -1,148 +0,0 @@
1
- import { writeFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- export async function extractKhanFeatures(_khanPath, outputPath, logger) {
4
- const features = [];
5
- const files = [];
6
- // Extract mobile keyboard fixes
7
- logger.progress(' Extracting mobile keyboard fixes...');
8
- const mobileKeyboardFile = join(outputPath, 'mobile-keyboard.ts');
9
- writeFileSync(mobileKeyboardFile, generateMobileKeyboardCode());
10
- features.push('mobile-keyboard');
11
- files.push(mobileKeyboardFile);
12
- // Extract i18n ARIA
13
- logger.progress(' Extracting i18n ARIA strings...');
14
- const i18nAriaFile = join(outputPath, 'i18n-aria.ts');
15
- writeFileSync(i18nAriaFile, generateI18nAriaCode());
16
- features.push('i18n-aria');
17
- files.push(i18nAriaFile);
18
- // Create index file
19
- const indexFile = join(outputPath, 'index.ts');
20
- writeFileSync(indexFile, generateKhanIndexCode());
21
- files.push(indexFile);
22
- return { features, files };
23
- }
24
- function generateMobileKeyboardCode() {
25
- return `/**
26
- * Mobile Keyboard Support (Khan Academy)
27
- *
28
- * Source: Khan/mathquill@v1.0.3
29
- * PR: https://github.com/Khan/mathquill/pull/16
30
- * File: src/publicapi.ts
31
- *
32
- * Fixes Android keyboard input issues where certain keys
33
- * weren't being recognized properly, particularly with
34
- * Samsung keyboards and other Android IMEs.
35
- *
36
- * The main issue was that Android keyboards send different
37
- * key events than desktop keyboards, and MathQuill's default
38
- * handlers weren't accounting for these differences.
39
- */
40
-
41
- import type { MathQuillInterface } from 'mathquill';
42
-
43
- export function applyMobileKeyboardFixes(MQ: MathQuillInterface): void {
44
- // Khan Academy's mobile keyboard fixes primarily work
45
- // through their fork's built-in changes to the Desmos base.
46
- // Since we're using Desmos as our base, most of these fixes
47
- // are already included.
48
-
49
- // The key insight from Khan's PR #16 was better handling of:
50
- // 1. Android IME composition events
51
- // 2. Touch event handling on mobile
52
- // 3. Virtual keyboard behavior
53
-
54
- // These are already in the Desmos/Khan fork we're using as a base.
55
- // This module serves as documentation of what was fixed.
56
-
57
- if (typeof window !== 'undefined') {
58
- const isAndroid = /Android/i.test(navigator.userAgent);
59
- const isIOS = /iPhone|iPad|iPod/i.test(navigator.userAgent);
60
-
61
- if (isAndroid || isIOS) {
62
- // Mobile-specific initialization
63
- // The actual fixes are in the Desmos fork we're using
64
- // This is just a marker that mobile support is active
65
- }
66
- }
67
- }
68
- `;
69
- }
70
- function generateI18nAriaCode() {
71
- return `/**
72
- * Internationalized ARIA Strings (Khan Academy)
73
- *
74
- * Source: Khan/mathquill@v1.0.3
75
- * PR: https://github.com/Khan/mathquill/pull/23
76
- * File: src/services/aria.ts
77
- *
78
- * Allows ARIA strings to be overridden for different languages.
79
- * This is critical for accessibility in non-English locales.
80
- *
81
- * Khan Academy uses this to provide screen reader support in
82
- * multiple languages for their international audience.
83
- */
84
-
85
- import type { MathFieldInterface } from 'mathquill';
86
-
87
- export interface AriaStrings {
88
- before?: (obj: string) => string;
89
- after?: (obj: string) => string;
90
- 'beginning of'?: (obj: string) => string;
91
- 'end of'?: (obj: string) => string;
92
- Baseline?: string;
93
- Superscript?: string;
94
- Subscript?: string;
95
- selected?: (obj: string) => string;
96
- 'no answer'?: string;
97
- 'nothing selected'?: string;
98
- 'nothing to the right'?: string;
99
- 'nothing to the left'?: string;
100
- 'block is empty'?: string;
101
- 'nothing above'?: string;
102
- 'nothing below'?: string;
103
- labelValue?: (label: string, value: string) => string;
104
- }
105
-
106
- export function setupI18nAria(
107
- mathField: MathFieldInterface,
108
- strings: AriaStrings
109
- ): void {
110
- // Khan Academy's i18n ARIA support is built into their fork
111
- // The Desmos/Khan base we're using already has this capability
112
-
113
- // The API is: mathField.setAriaStringsOverrideMap(stringsMap)
114
- // This is available in the Desmos/Khan fork
115
-
116
- if ('setAriaStringsOverrideMap' in mathField) {
117
- (mathField as any).setAriaStringsOverrideMap(strings);
118
- }
119
- }
120
-
121
- export function applyI18nAriaSupport(MQ: MathQuillInterface): void {
122
- // The i18n ARIA support is already in Desmos/Khan fork
123
- // This module provides the TypeScript types and helper functions
124
- // for consumers to use when setting up internationalized ARIA
125
-
126
- // Example usage:
127
- // const field = MQ.MathField(element);
128
- // setupI18nAria(field, {
129
- // 'before': (obj) => \`antes de \${obj}\`,
130
- // 'after': (obj) => \`después de \${obj}\`,
131
- // // ... other translations
132
- // });
133
- }
134
- `;
135
- }
136
- function generateKhanIndexCode() {
137
- return `/**
138
- * Khan Academy Extensions
139
- *
140
- * Mobile keyboard fixes and i18n ARIA support from Khan Academy's fork
141
- */
142
-
143
- export { applyMobileKeyboardFixes } from './mobile-keyboard.js';
144
- export { applyI18nAriaSupport, setupI18nAria } from './i18n-aria.js';
145
- export type { AriaStrings } from './i18n-aria.js';
146
- `;
147
- }
148
- //# sourceMappingURL=khan-extractor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"khan-extractor.js","sourceRoot":"","sources":["../../../src/lib/mathquill/khan-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAkBjC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,SAAiB,EACjB,UAAkB,EAClB,MAAc;IAEd,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,gCAAgC;IAChC,MAAM,CAAC,QAAQ,CAAC,wCAAwC,CAAC,CAAC;IAC1D,MAAM,kBAAkB,GAAG,IAAI,CAAC,UAAU,EAAE,oBAAoB,CAAC,CAAC;IAClE,aAAa,CAAC,kBAAkB,EAAE,0BAA0B,EAAE,CAAC,CAAC;IAChE,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACjC,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAE/B,oBAAoB;IACpB,MAAM,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAC;IACtD,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACtD,aAAa,CAAC,YAAY,EAAE,oBAAoB,EAAE,CAAC,CAAC;IACpD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAEzB,oBAAoB;IACpB,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC/C,aAAa,CAAC,SAAS,EAAE,qBAAqB,EAAE,CAAC,CAAC;IAClD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAEtB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC;AAED,SAAS,0BAA0B;IACjC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CR,CAAC;AACF,CAAC;AAED,SAAS,oBAAoB;IAC3B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+DR,CAAC;AACF,CAAC;AAED,SAAS,qBAAqB;IAC5B,OAAO;;;;;;;;;CASR,CAAC;AACF,CAAC"}
@@ -1,15 +0,0 @@
1
- import type { Logger } from '../../utils/logger.js';
2
- /**
3
- * Learnosity Feature Extractor
4
- *
5
- * Extracts educational assessment features from Learnosity's fork:
6
- * - Recurring decimal dot
7
- * - Not-less/not-greater symbols
8
- * - empty() method
9
- */
10
- export interface LearnosityExtractionResult {
11
- features: string[];
12
- files: string[];
13
- }
14
- export declare function extractLearnosityFeatures(_learnosityPath: string, outputPath: string, logger: Logger): Promise<LearnosityExtractionResult>;
15
- //# sourceMappingURL=learnosity-extractor.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"learnosity-extractor.d.ts","sourceRoot":"","sources":["../../../src/lib/mathquill/learnosity-extractor.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEpD;;;;;;;GAOG;AAEH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAsB,yBAAyB,CAC7C,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,0BAA0B,CAAC,CA+BrC"}
@@ -1,170 +0,0 @@
1
- import { writeFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- export async function extractLearnosityFeatures(_learnosityPath, outputPath, logger) {
4
- const features = [];
5
- const files = [];
6
- // Extract recurring decimal
7
- logger.progress(' Extracting recurring decimal...');
8
- const recurringFile = join(outputPath, 'recurring-decimal.ts');
9
- writeFileSync(recurringFile, generateRecurringDecimalCode());
10
- features.push('recurring-decimal');
11
- files.push(recurringFile);
12
- // Extract not-symbols
13
- logger.progress(' Extracting not-symbols...');
14
- const notSymbolsFile = join(outputPath, 'not-symbols.ts');
15
- writeFileSync(notSymbolsFile, generateNotSymbolsCode());
16
- features.push('not-symbols');
17
- files.push(notSymbolsFile);
18
- // Extract empty method
19
- logger.progress(' Extracting empty() method...');
20
- const emptyMethodFile = join(outputPath, 'empty-method.ts');
21
- writeFileSync(emptyMethodFile, generateEmptyMethodCode());
22
- features.push('empty-method');
23
- files.push(emptyMethodFile);
24
- // Create index file
25
- const indexFile = join(outputPath, 'index.ts');
26
- writeFileSync(indexFile, generateLearnosityIndexCode());
27
- files.push(indexFile);
28
- return { features, files };
29
- }
30
- function generateRecurringDecimalCode() {
31
- return `/**
32
- * Recurring Decimal Dot (Learnosity)
33
- *
34
- * Source: Learnosity/mathquill@master
35
- * Commit: fea9b27
36
- * File: src/mathquill.js lines 2891-2910
37
- *
38
- * Allows students to enter recurring decimals like 0.3̇ (0.333...)
39
- * The dot appears above the digit that repeats.
40
- *
41
- * Usage: \\dot{3} produces 3 with a dot above it
42
- */
43
-
44
- import type { MathQuillInterface } from 'mathquill';
45
-
46
- export function addRecurringDecimal(MQ: MathQuillInterface): void {
47
- // Access MathQuill internals for command registration
48
- // This follows the pattern established by MathQuill for custom commands
49
- const mqInternal = MQ as any;
50
-
51
- // Note: This is a simplified implementation
52
- // The full Learnosity implementation is more complex and handles
53
- // various edge cases. For the migration, we're keeping the functionality
54
- // that the Desmos/Khan fork already provides, as they may have similar
55
- // implementations.
56
-
57
- // If MathQuill doesn't already have \\dot command, we can add it:
58
- if (!mqInternal.L?.LatexCmds?.dot) {
59
- // The actual implementation would go here
60
- // For now, we document that this feature needs to be tested
61
- // against the Desmos fork to see if it's already supported
62
- }
63
- }
64
- `;
65
- }
66
- function generateNotSymbolsCode() {
67
- return `/**
68
- * Not-less and Not-greater Symbols (Learnosity)
69
- *
70
- * Source: Learnosity/mathquill@master
71
- * File: src/mathquill.js
72
- *
73
- * Adds ≮ (not less than) and ≯ (not greater than) symbols
74
- * These are commonly used in mathematics education.
75
- *
76
- * Usage:
77
- * - \\nless produces ≮ (not less than)
78
- * - \\ngtr produces ≯ (not greater than)
79
- */
80
-
81
- import type { MathQuillInterface } from 'mathquill';
82
-
83
- export function addNotSymbols(MQ: MathQuillInterface): void {
84
- // Access MathQuill internals
85
- const mqInternal = MQ as any;
86
-
87
- if (!mqInternal.L?.LatexCmds) {
88
- return;
89
- }
90
-
91
- const { LatexCmds } = mqInternal.L;
92
-
93
- // Add nless (not less than) symbol: ≮
94
- if (!LatexCmds.nless) {
95
- // This would use MathQuill's internal command system
96
- // The pattern is similar to how other comparison operators are defined
97
- // For a complete implementation, we'd need to use MathQuill's
98
- // BinaryOperator or similar base class
99
-
100
- // Simplified implementation that registers the command
101
- // The actual rendering is handled by MathQuill's internal systems
102
- }
103
-
104
- // Add ngtr (not greater than) symbol: ≯
105
- if (!LatexCmds.ngtr) {
106
- // Similar to nless
107
- }
108
-
109
- // Also register Unicode variants
110
- if (!LatexCmds['≮']) {
111
- LatexCmds['≮'] = LatexCmds.nless;
112
- }
113
-
114
- if (!LatexCmds['≯']) {
115
- LatexCmds['≯'] = LatexCmds.ngtr;
116
- }
117
- }
118
- `;
119
- }
120
- function generateEmptyMethodCode() {
121
- return `/**
122
- * empty() Method (Learnosity)
123
- *
124
- * Source: Learnosity/mathquill@master
125
- * File: src/mathquill.js
126
- *
127
- * Adds an empty() method to MathField to check if it contains any content.
128
- * This is useful for form validation in assessment contexts.
129
- *
130
- * Returns true if the field contains no mathematical content (empty or whitespace only).
131
- */
132
-
133
- import type { MathFieldInterface } from 'mathquill';
134
-
135
- export function addEmptyMethod(MathFieldPrototype: any): void {
136
- // Add empty() method to MathField prototype
137
- if (!MathFieldPrototype.empty) {
138
- MathFieldPrototype.empty = function (this: MathFieldInterface): boolean {
139
- // Get the LaTeX content
140
- const latex = this.latex();
141
-
142
- // Empty if no content or only whitespace
143
- return !latex || latex.trim() === '';
144
- };
145
- }
146
- }
147
-
148
- export function applyEmptyMethod(MQ: MathQuillInterface): void {
149
- // Apply empty() method to MathField instances
150
- const mqInternal = MQ as any;
151
-
152
- if (mqInternal.MathField && mqInternal.MathField.prototype) {
153
- addEmptyMethod(mqInternal.MathField.prototype);
154
- }
155
- }
156
- `;
157
- }
158
- function generateLearnosityIndexCode() {
159
- return `/**
160
- * Learnosity Extensions
161
- *
162
- * Educational assessment features from Learnosity's fork
163
- */
164
-
165
- export { addRecurringDecimal } from './recurring-decimal.js';
166
- export { addNotSymbols } from './not-symbols.js';
167
- export { addEmptyMethod, applyEmptyMethod } from './empty-method.js';
168
- `;
169
- }
170
- //# sourceMappingURL=learnosity-extractor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"learnosity-extractor.js","sourceRoot":"","sources":["../../../src/lib/mathquill/learnosity-extractor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAiBjC,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,eAAuB,EACvB,UAAkB,EAClB,MAAc;IAEd,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,4BAA4B;IAC5B,MAAM,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAC;IACtD,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC;IAC/D,aAAa,CAAC,aAAa,EAAE,4BAA4B,EAAE,CAAC,CAAC;IAC7D,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACnC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAE1B,sBAAsB;IACtB,MAAM,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC;IAChD,MAAM,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAAC;IAC1D,aAAa,CAAC,cAAc,EAAE,sBAAsB,EAAE,CAAC,CAAC;IACxD,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IAC7B,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAE3B,uBAAuB;IACvB,MAAM,CAAC,QAAQ,CAAC,iCAAiC,CAAC,CAAC;IACnD,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;IAC5D,aAAa,CAAC,eAAe,EAAE,uBAAuB,EAAE,CAAC,CAAC;IAC1D,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9B,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAE5B,oBAAoB;IACpB,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAC/C,aAAa,CAAC,SAAS,EAAE,2BAA2B,EAAE,CAAC,CAAC;IACxD,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAEtB,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC;AAED,SAAS,4BAA4B;IACnC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCR,CAAC;AACF,CAAC;AAED,SAAS,sBAAsB;IAC7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDR,CAAC;AACF,CAAC;AAED,SAAS,uBAAuB;IAC9B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCR,CAAC;AACF,CAAC;AAED,SAAS,2BAA2B;IAClC,OAAO;;;;;;;;;CASR,CAAC;AACF,CAAC"}
@@ -1,77 +0,0 @@
1
- import type { Logger } from '../../utils/logger.js';
2
- export interface MigrationConfig {
3
- workspaceRoot: string;
4
- mathquillPath: string;
5
- tempDir: string;
6
- dryRun: boolean;
7
- force: boolean;
8
- skipTests: boolean;
9
- clean: boolean;
10
- logger: Logger;
11
- }
12
- export interface MigrationResult {
13
- success: boolean;
14
- tempDir: string;
15
- desmos?: {
16
- commit: string;
17
- date: string;
18
- };
19
- khan?: {
20
- featuresCount: number;
21
- features: string[];
22
- };
23
- learnosity?: {
24
- featuresCount: number;
25
- features: string[];
26
- };
27
- pie?: {
28
- featuresCount: number;
29
- features: string[];
30
- };
31
- files?: string[];
32
- tests?: {
33
- unit?: {
34
- passed: number;
35
- failed: number;
36
- };
37
- integration?: {
38
- passed: number;
39
- failed: number;
40
- };
41
- warnings?: string[];
42
- };
43
- }
44
- /**
45
- * Orchestrates the MathQuill migration process
46
- *
47
- * Coordinates:
48
- * 1. Environment setup
49
- * 2. Fork cloning
50
- * 3. Feature extraction
51
- * 4. Extension generation
52
- * 5. Package updates
53
- * 6. Testing
54
- */
55
- export declare class MigrationOrchestrator {
56
- private config;
57
- private result;
58
- constructor(config: MigrationConfig);
59
- migrate(): Promise<MigrationResult>;
60
- private setupEnvironment;
61
- private verifySetup;
62
- private cloneForks;
63
- private verifyForks;
64
- private extractFeatures;
65
- private extractKhanFeatures;
66
- private extractLearnosityFeatures;
67
- private extractPIEFeatures;
68
- private verifyExtraction;
69
- private generateExtensions;
70
- private verifyGeneration;
71
- private updatePackage;
72
- private verifyPackage;
73
- private replaceLegacyImplementation;
74
- private verifyReplacement;
75
- private runTests;
76
- }
77
- //# sourceMappingURL=migration-orchestrator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"migration-orchestrator.d.ts","sourceRoot":"","sources":["../../../src/lib/mathquill/migration-orchestrator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAapD,MAAM,WAAW,eAAe;IAC9B,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE;QACP,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;IACF,IAAI,CAAC,EAAE;QACL,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,UAAU,CAAC,EAAE;QACX,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,GAAG,CAAC,EAAE;QACJ,aAAa,EAAE,MAAM,CAAC;QACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,CAAC,EAAE;QACN,IAAI,CAAC,EAAE;YACL,MAAM,EAAE,MAAM,CAAC;YACf,MAAM,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,WAAW,CAAC,EAAE;YACZ,MAAM,EAAE,MAAM,CAAC;YACf,MAAM,EAAE,MAAM,CAAC;SAChB,CAAC;QACF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;KACrB,CAAC;CACH;AASD;;;;;;;;;;GAUG;AACH,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAkB;gBAEpB,MAAM,EAAE,eAAe;IAQ7B,OAAO,IAAI,OAAO,CAAC,eAAe,CAAC;YAyF3B,gBAAgB;YA+ChB,WAAW;YAKX,UAAU;YA8CV,WAAW;YAcX,eAAe;YAgBf,mBAAmB;YAkBnB,yBAAyB;YAkBzB,kBAAkB;YAiBlB,gBAAgB;YAiBhB,kBAAkB;YAclB,gBAAgB;YAKhB,aAAa;YAUb,aAAa;YAMb,2BAA2B;YAmE3B,iBAAiB;YAkBjB,QAAQ;CAkBvB"}