@pie-players/pie-calculator 0.3.61 → 0.3.63
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/dist/index.js
CHANGED
package/package.json
CHANGED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG","sourcesContent":["/**\n * @pie-players/pie-calculator\n *\n * Calculator provider interfaces and types for PIE Assessment Toolkit.\n * No UI dependencies - pure TypeScript interfaces.\n */\n\nexport type {\n\tCalculationHistoryEntry,\n\tCalculator,\n\tCalculatorProvider,\n\tCalculatorProviderCapabilities,\n\tCalculatorProviderConfig,\n\tCalculatorState,\n\tCalculatorType,\n\tDesmosCalculatorConfig,\n} from \"./provider-interface.js\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"provider-interface.js","sourceRoot":"","sources":["../src/provider-interface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG","sourcesContent":["/**\n * Calculator Provider Interfaces\n *\n * Defines the contract for calculator providers.\n * Providers are stateless factories that create configured calculator implementations.\n *\n * Part of PIE Calculator - No UI dependencies.\n */\n\n/**\n * Calculator types\n */\nexport type CalculatorType = \"basic\" | \"scientific\" | \"graphing\";\n\n/**\n * Desmos-specific calculator configuration options\n * Based on production implementation patterns and Desmos API documentation\n */\nexport interface DesmosCalculatorConfig {\n\t// API Configuration\n\t// SECURITY WARNING: Never expose API keys in client-side code in production!\n\t// For development: Use apiKey directly\n\t// For production: Use proxyEndpoint to handle API key server-side\n\tapiKey?: string; // Desmos API key (DEVELOPMENT ONLY - obtain from https://www.desmos.com/api)\n\tproxyEndpoint?: string; // Server endpoint that handles Desmos API authentication (PRODUCTION RECOMMENDED)\n\n\t// Common options for all calculator types\n\tborder?: boolean; // Show border around calculator (default: false)\n\tdegreeMode?: boolean | \"degree\" | \"radian\"; // Angle mode: true = degrees, false = radians\n\tdecimalToFraction?: boolean; // Enable decimal to fraction conversion\n\tlinks?: boolean; // Enable links to external Desmos resources\n\n\t// Graphing Calculator specific options\n\tsettingsMenu?: boolean; // Show settings menu\n\texpressions?: boolean; // Enable expression list/editor\n\tzoomButtons?: boolean; // Show zoom buttons\n\texpressionsTopbar?: boolean; // Show expressions topbar\n\tnotes?: boolean; // Enable notes\n\tfolders?: boolean; // Enable folders for organizing expressions\n\timages?: boolean; // Enable image uploads\n\tqwertyKeyboard?: boolean; // Use QWERTY keyboard layout\n\trestrictedFunctions?: boolean; // Restrict certain functions (test mode)\n\tplotSingleVariableImplicitEquations?: boolean; // Enable plotting implicit equations\n\tdistributions?: boolean; // Enable statistical distributions\n\tplotImplicits?: boolean; // Enable implicit equation plotting\n\tplotInequalities?: boolean; // Enable inequality plotting\n\tgeometryComputationFunctions?: boolean; // Enable geometry computation functions\n\tsliders?: boolean; // Enable sliders for parameters\n\ttables?: boolean; // Enable data tables feature\n\texpressionsCollapsed?: boolean; // Start with expressions collapsed\n\tadministerSecretFolders?: boolean; // Enable secret folders\n\tlockViewport?: boolean; // Lock viewport (disable panning/zooming)\n\n\t// Scientific Calculator specific options\n\tfunctionDefinition?: boolean; // Enable function definition\n\tbrailleExpressionDownload?: boolean; // Enable braille expression download\n\n\t// Basic (Four-Function) Calculator specific options\n\tkeypad?: boolean; // Show on-screen keypad\n\tgraphpaper?: boolean; // Show graph paper background\n\tadditionalFunctions?: string[]; // Additional functions (e.g., ['sqrt', 'percent'])\n}\n\n/**\n * Calculator provider configuration\n */\nexport interface CalculatorProviderConfig {\n\tsettings?: Record<string, any>;\n\trestrictedMode?: boolean; // Quick toggle for restricted/test mode (affects multiple options)\n\tlocale?: string;\n\ttheme?: \"light\" | \"dark\" | \"auto\";\n\t// Desmos-specific configuration\n\tdesmos?: DesmosCalculatorConfig;\n}\n\n/**\n * Calculator provider capabilities\n */\nexport interface CalculatorProviderCapabilities {\n\tsupportsHistory: boolean;\n\tsupportsGraphing: boolean;\n\tsupportsExpressions: boolean;\n\tcanExport: boolean;\n\tmaxPrecision?: number;\n\tinputMethods: (\"keyboard\" | \"mouse\" | \"touch\")[];\n}\n\n/**\n * Calculation history entry\n */\nexport interface CalculationHistoryEntry {\n\texpression: string;\n\tresult: string;\n\ttimestamp: number;\n}\n\n/**\n * Calculator state for persistence\n */\nexport interface CalculatorState {\n\ttype: CalculatorType;\n\tprovider: string;\n\tvalue: string;\n\thistory?: CalculationHistoryEntry[];\n\tproviderState?: any;\n}\n\n/**\n * Calculator Provider interface\n *\n * Providers are stateless factories that create calculator implementations.\n * They describe capabilities and create configured instances.\n */\nexport interface CalculatorProvider {\n\t/**\n\t * Unique identifier for this provider\n\t */\n\treadonly providerId: string;\n\n\t/**\n\t * Human-readable provider name\n\t */\n\treadonly providerName: string;\n\n\t/**\n\t * Supported calculator types\n\t */\n\treadonly supportedTypes: CalculatorType[];\n\n\t/**\n\t * Provider version\n\t */\n\treadonly version: string;\n\n\t/**\n\t * Initialize the provider (load libraries, etc.)\n\t */\n\tinitialize(): Promise<void>;\n\n\t/**\n\t * Create a calculator instance\n\t */\n\tcreateCalculator(\n\t\ttype: CalculatorType,\n\t\tcontainer: HTMLElement,\n\t\tconfig?: CalculatorProviderConfig,\n\t): Promise<Calculator>;\n\n\t/**\n\t * Check if a calculator type is supported\n\t */\n\tsupportsType(type: CalculatorType): boolean;\n\n\t/**\n\t * Clean up provider resources\n\t */\n\tdestroy(): void;\n\n\t/**\n\t * Get provider capabilities\n\t */\n\tgetCapabilities(): CalculatorProviderCapabilities;\n}\n\n/**\n * Calculator instance interface (provider-agnostic)\n *\n * The actual calculator implementation that handles calculations.\n * Created by CalculatorProvider.createCalculator()\n */\nexport interface Calculator {\n\t/**\n\t * The provider that created this calculator\n\t */\n\treadonly provider: CalculatorProvider;\n\n\t/**\n\t * The calculator type\n\t */\n\treadonly type: CalculatorType;\n\n\t/**\n\t * Get current value/result\n\t */\n\tgetValue(): string;\n\n\t/**\n\t * Set value\n\t */\n\tsetValue(value: string): void;\n\n\t/**\n\t * Clear calculator\n\t */\n\tclear(): void;\n\n\t/**\n\t * Get calculation history (if supported)\n\t */\n\tgetHistory?(): CalculationHistoryEntry[];\n\n\t/**\n\t * Clear calculation history (if supported)\n\t */\n\tclearHistory?(): void;\n\n\t/**\n\t * Evaluate an expression (if supported)\n\t */\n\tevaluate?(expression: string): Promise<string>;\n\n\t/**\n\t * Resize calculator (when container size changes)\n\t */\n\tresize?(): void;\n\n\t/**\n\t * Move keyboard focus to the primary input/expression field.\n\t *\n\t * Optional: providers that cannot focus an input meaningfully (e.g. a\n\t * keypad-only UI without a text field) should omit or no-op. Called by\n\t * host components (like the shelled calculator tool) after mount so\n\t * keyboard users can begin typing immediately.\n\t */\n\tfocus?(): void;\n\n\t/**\n\t * Export calculator state for persistence\n\t */\n\texportState(): CalculatorState;\n\n\t/**\n\t * Import calculator state from persistence\n\t */\n\timportState(state: CalculatorState): void;\n\n\t/**\n\t * Destroy calculator and clean up resources\n\t */\n\tdestroy(): void;\n}\n"]}
|