@almadar/std 1.0.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 (78) hide show
  1. package/LICENSE +72 -0
  2. package/dist/behaviors/action-affinity.d.ts +88 -0
  3. package/dist/behaviors/action-affinity.js +290 -0
  4. package/dist/behaviors/action-affinity.js.map +1 -0
  5. package/dist/behaviors/async.d.ts +20 -0
  6. package/dist/behaviors/async.js +542 -0
  7. package/dist/behaviors/async.js.map +1 -0
  8. package/dist/behaviors/data-management.d.ts +40 -0
  9. package/dist/behaviors/data-management.js +495 -0
  10. package/dist/behaviors/data-management.js.map +1 -0
  11. package/dist/behaviors/feedback.d.ts +18 -0
  12. package/dist/behaviors/feedback.js +307 -0
  13. package/dist/behaviors/feedback.js.map +1 -0
  14. package/dist/behaviors/game-core.d.ts +40 -0
  15. package/dist/behaviors/game-core.js +443 -0
  16. package/dist/behaviors/game-core.js.map +1 -0
  17. package/dist/behaviors/game-entity.d.ts +39 -0
  18. package/dist/behaviors/game-entity.js +643 -0
  19. package/dist/behaviors/game-entity.js.map +1 -0
  20. package/dist/behaviors/game-ui.d.ts +29 -0
  21. package/dist/behaviors/game-ui.js +493 -0
  22. package/dist/behaviors/game-ui.js.map +1 -0
  23. package/dist/behaviors/index.d.ts +11 -0
  24. package/dist/behaviors/index.js +4539 -0
  25. package/dist/behaviors/index.js.map +1 -0
  26. package/dist/behaviors/registry.d.ts +103 -0
  27. package/dist/behaviors/registry.js +4166 -0
  28. package/dist/behaviors/registry.js.map +1 -0
  29. package/dist/behaviors/types.d.ts +179 -0
  30. package/dist/behaviors/types.js +111 -0
  31. package/dist/behaviors/types.js.map +1 -0
  32. package/dist/behaviors/ui-interaction.d.ts +36 -0
  33. package/dist/behaviors/ui-interaction.js +1104 -0
  34. package/dist/behaviors/ui-interaction.js.map +1 -0
  35. package/dist/index.d.ts +195 -0
  36. package/dist/index.js +8209 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/modules/array.d.ts +28 -0
  39. package/dist/modules/array.js +556 -0
  40. package/dist/modules/array.js.map +1 -0
  41. package/dist/modules/async.d.ts +22 -0
  42. package/dist/modules/async.js +112 -0
  43. package/dist/modules/async.js.map +1 -0
  44. package/dist/modules/format.d.ts +21 -0
  45. package/dist/modules/format.js +129 -0
  46. package/dist/modules/format.js.map +1 -0
  47. package/dist/modules/index.d.ts +12 -0
  48. package/dist/modules/index.js +3131 -0
  49. package/dist/modules/index.js.map +1 -0
  50. package/dist/modules/math.d.ts +22 -0
  51. package/dist/modules/math.js +215 -0
  52. package/dist/modules/math.js.map +1 -0
  53. package/dist/modules/nn.d.ts +23 -0
  54. package/dist/modules/nn.js +189 -0
  55. package/dist/modules/nn.js.map +1 -0
  56. package/dist/modules/object.d.ts +22 -0
  57. package/dist/modules/object.js +257 -0
  58. package/dist/modules/object.js.map +1 -0
  59. package/dist/modules/str.d.ts +21 -0
  60. package/dist/modules/str.js +344 -0
  61. package/dist/modules/str.js.map +1 -0
  62. package/dist/modules/tensor.d.ts +23 -0
  63. package/dist/modules/tensor.js +427 -0
  64. package/dist/modules/tensor.js.map +1 -0
  65. package/dist/modules/time.d.ts +24 -0
  66. package/dist/modules/time.js +323 -0
  67. package/dist/modules/time.js.map +1 -0
  68. package/dist/modules/train.d.ts +23 -0
  69. package/dist/modules/train.js +308 -0
  70. package/dist/modules/train.js.map +1 -0
  71. package/dist/modules/validate.d.ts +23 -0
  72. package/dist/modules/validate.js +301 -0
  73. package/dist/modules/validate.js.map +1 -0
  74. package/dist/registry.d.ts +140 -0
  75. package/dist/registry.js +3240 -0
  76. package/dist/registry.js.map +1 -0
  77. package/dist/types-I95R8_FN.d.ts +91 -0
  78. package/package.json +59 -0
@@ -0,0 +1,91 @@
1
+ /**
2
+ * Standard Library Types
3
+ *
4
+ * Common types and interfaces for the Orbital Standard Library.
5
+ * Extends the core operator system with std-prefixed modules.
6
+ *
7
+ * @packageDocumentation
8
+ */
9
+ /**
10
+ * Operator categories for the core expression language.
11
+ */
12
+ declare const OPERATOR_CATEGORIES: readonly ["arithmetic", "comparison", "logic", "control", "effect", "collection", "std-math", "std-str", "std-array", "std-object", "std-validate", "std-time", "std-format", "std-async", "std-nn", "std-tensor", "std-train"];
13
+ type OperatorCategory = (typeof OPERATOR_CATEGORIES)[number];
14
+ /**
15
+ * Base metadata for an operator.
16
+ */
17
+ interface OperatorMeta {
18
+ /** Operator category */
19
+ category: OperatorCategory;
20
+ /** Minimum number of arguments */
21
+ minArity: number;
22
+ /** Maximum number of arguments (null = unlimited) */
23
+ maxArity: number | null;
24
+ /** Human-readable description */
25
+ description: string;
26
+ /** Whether this operator has side effects (only valid in effect context) */
27
+ hasSideEffects: boolean;
28
+ /** Return type hint - basic types for core operators, extended types for std modules */
29
+ returnType: string;
30
+ }
31
+ /**
32
+ * Standard library module names.
33
+ * Each module provides a set of operators prefixed with the module name.
34
+ * E.g., 'math' provides 'math/abs', 'math/clamp', etc.
35
+ */
36
+ declare const STD_MODULES: readonly ["math", "str", "array", "object", "time", "validate", "format", "async", "nn", "tensor", "train"];
37
+ type StdModule = (typeof STD_MODULES)[number];
38
+ /**
39
+ * Standard library operator categories.
40
+ * These extend the core categories for more granular classification.
41
+ */
42
+ declare const STD_OPERATOR_CATEGORIES: readonly ["std-math", "std-str", "std-array", "std-object", "std-time", "std-validate", "std-format", "std-async", "std-nn", "std-tensor", "std-train"];
43
+ type StdOperatorCategory = (typeof STD_OPERATOR_CATEGORIES)[number];
44
+ /**
45
+ * Extended operator metadata for std library operators.
46
+ * Adds parameter descriptions and examples.
47
+ */
48
+ interface StdOperatorMeta extends OperatorMeta {
49
+ /** The std module this operator belongs to */
50
+ module: StdModule;
51
+ /** Parameter names and descriptions */
52
+ params?: {
53
+ name: string;
54
+ type: string;
55
+ description: string;
56
+ optional?: boolean;
57
+ defaultValue?: unknown;
58
+ }[];
59
+ /** Example usage */
60
+ example?: string;
61
+ /** Whether this operator accepts a lambda expression argument */
62
+ acceptsLambda?: boolean;
63
+ /** Position of the lambda argument (0-indexed) */
64
+ lambdaArgPosition?: number;
65
+ }
66
+ /**
67
+ * Type guard to check if an operator category is a std category.
68
+ */
69
+ declare function isStdCategory(category: string): category is StdOperatorCategory;
70
+ /**
71
+ * Get the module name from a std operator name.
72
+ * E.g., 'math/clamp' -> 'math'
73
+ */
74
+ declare function getModuleFromOperator(operator: string): StdModule | null;
75
+ /**
76
+ * Get the function name from a std operator.
77
+ * E.g., 'math/clamp' -> 'clamp'
78
+ */
79
+ declare function getFunctionFromOperator(operator: string): string | null;
80
+ /**
81
+ * Check if an operator name is a std library operator.
82
+ * Std library operators are prefixed with their module name (e.g., 'math/', 'str/').
83
+ */
84
+ declare function isStdOperator(operator: string): boolean;
85
+ /**
86
+ * Create a std operator name from module and function name.
87
+ * E.g., ('math', 'clamp') -> 'math/clamp'
88
+ */
89
+ declare function makeStdOperator(module: StdModule, fn: string): string;
90
+
91
+ export { type StdModule as S, type StdOperatorMeta as a, STD_MODULES as b, STD_OPERATOR_CATEGORIES as c, type StdOperatorCategory as d, getModuleFromOperator as e, isStdOperator as f, getFunctionFromOperator as g, isStdCategory as i, makeStdOperator as m };
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@almadar/std",
3
+ "version": "1.0.0",
4
+ "description": "Standard library operators for Almadar (math, string, array, etc.)",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ },
14
+ "./modules/*": {
15
+ "import": "./dist/modules/*.js",
16
+ "types": "./dist/modules/*.d.ts"
17
+ },
18
+ "./behaviors/*": {
19
+ "import": "./dist/behaviors/*.js",
20
+ "types": "./dist/behaviors/*.d.ts"
21
+ },
22
+ "./registry": {
23
+ "import": "./dist/registry.js",
24
+ "types": "./dist/registry.d.ts"
25
+ }
26
+ },
27
+ "files": [
28
+ "dist"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "dependencies": {
34
+ "@almadar/core": "1.0.0"
35
+ },
36
+ "devDependencies": {
37
+ "tsup": "^8.0.0",
38
+ "typescript": "^5.4.0",
39
+ "vitest": "^1.4.0"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "https://github.com/almadar-io/almadar.git",
44
+ "directory": "packages/almadar-std"
45
+ },
46
+ "license": "MIT",
47
+ "keywords": [
48
+ "almadar",
49
+ "std",
50
+ "standard-library",
51
+ "operators"
52
+ ],
53
+ "scripts": {
54
+ "build": "tsup",
55
+ "build:watch": "tsup --watch",
56
+ "test": "vitest",
57
+ "typecheck": "tsc --noEmit"
58
+ }
59
+ }