@aperturesyndicate/synx-format 3.6.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.
@@ -0,0 +1,153 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>SYNX Browser Demo v3.4.0</title>
7
+ <style>
8
+ body {
9
+ font-family: 'Segoe UI', Tahoma, sans-serif;
10
+ max-width: 900px;
11
+ margin: 40px auto;
12
+ padding: 0 20px;
13
+ background: #1e1e1e;
14
+ color: #d4d4d4;
15
+ }
16
+ h1 { color: #4ec9b0; }
17
+ h2 { color: #569cd6; margin-top: 30px; }
18
+ textarea {
19
+ width: 100%;
20
+ height: 200px;
21
+ background: #252526;
22
+ color: #d4d4d4;
23
+ border: 1px solid #3c3c3c;
24
+ padding: 12px;
25
+ font-family: 'Consolas', 'Courier New', monospace;
26
+ font-size: 14px;
27
+ border-radius: 4px;
28
+ }
29
+ button {
30
+ background: #0e639c;
31
+ color: white;
32
+ border: none;
33
+ padding: 10px 24px;
34
+ font-size: 14px;
35
+ cursor: pointer;
36
+ border-radius: 4px;
37
+ margin-top: 10px;
38
+ }
39
+ button:hover { background: #1177bb; }
40
+ pre {
41
+ background: #252526;
42
+ border: 1px solid #3c3c3c;
43
+ padding: 12px;
44
+ border-radius: 4px;
45
+ overflow-x: auto;
46
+ }
47
+ .success { color: #4ec9b0; }
48
+ .error { color: #f48771; }
49
+ code {
50
+ background: #333;
51
+ padding: 2px 6px;
52
+ border-radius: 3px;
53
+ color: #ce9178;
54
+ }
55
+ </style>
56
+ </head>
57
+ <body>
58
+ <h1>šŸš€ SYNX v3.4.0 — Browser Demo</h1>
59
+ <p>Pure JavaScript SYNX parser running in your browser. <strong>No dependencies, no build tools.</strong></p>
60
+
61
+ <h2>Example 1: Basic Parsing</h2>
62
+ <textarea id="input1">!active
63
+
64
+ name Alice
65
+ age 30
66
+ city San Francisco</textarea>
67
+ <button onclick="parse('input1', 'output1')">Parse ā–¶</button>
68
+ <pre id="output1" class="success">Click "Parse" to see result</pre>
69
+
70
+ <h2>Example 2: Markers — <code>:calc</code>, <code>:random</code>, <code>:default</code></h2>
71
+ <textarea id="input2">!active
72
+
73
+ price 100
74
+ tax:calc price * 0.2
75
+ total:calc price + tax
76
+ color:random red green blue
77
+ fallback:default Unknown value</textarea>
78
+ <button onclick="parse('input2', 'output2')">Parse ā–¶</button>
79
+ <pre id="output2" class="success">Click "Parse" to see result</pre>
80
+
81
+ <h2>Example 3: NEW in v3.4.0 — <code>:spam</code> Rate Limiting</h2>
82
+ <textarea id="input3">!active
83
+
84
+ secret_token abc123xyz
85
+ api_key:spam:2:5 secret_token
86
+ # api_key can access secret_token max 2 times per 5 seconds</textarea>
87
+ <button onclick="parseSpamDemo()">Parse & Test Rate Limit ā–¶</button>
88
+ <pre id="output3" class="success">Click "Parse" to test :spam behavior</pre>
89
+
90
+ <h2>Example 4: Nested Objects & Lists</h2>
91
+ <textarea id="input4">!active
92
+
93
+ database
94
+ host localhost
95
+ port 5432
96
+
97
+ users
98
+ - name Alice
99
+ role admin
100
+ - name Bob
101
+ role user</textarea>
102
+ <button onclick="parse('input4', 'output4')">Parse ā–¶</button>
103
+ <pre id="output4" class="success">Click "Parse" to see result</pre>
104
+
105
+ <script src="./synx.browser.js"></script>
106
+ <script>
107
+ function parse(inputId, outputId) {
108
+ const input = document.getElementById(inputId).value;
109
+ const output = document.getElementById(outputId);
110
+
111
+ try {
112
+ const result = Synx.parse(input);
113
+ output.textContent = JSON.stringify(result, null, 2);
114
+ output.className = 'success';
115
+ } catch (err) {
116
+ output.textContent = `āŒ Error: ${err.message}`;
117
+ output.className = 'error';
118
+ }
119
+ }
120
+
121
+ function parseSpamDemo() {
122
+ const input = document.getElementById('input3').value;
123
+ const output = document.getElementById('output3');
124
+
125
+ try {
126
+ // First call — should succeed
127
+ const result1 = Synx.parse(input);
128
+ let msg = 'āœ… Call 1: ' + JSON.stringify(result1, null, 2);
129
+
130
+ // Second call — should succeed
131
+ const result2 = Synx.parse(input);
132
+ msg += '\n\nāœ… Call 2: ' + JSON.stringify(result2, null, 2);
133
+
134
+ // Third call — should fail with SPAM_ERR
135
+ const result3 = Synx.parse(input);
136
+ msg += '\n\nāŒ Call 3 (should be blocked): ' + JSON.stringify(result3, null, 2);
137
+
138
+ output.textContent = msg;
139
+ output.className = result3.api_key && result3.api_key.includes('SPAM_ERR') ? 'success' : 'error';
140
+ } catch (err) {
141
+ output.textContent = `āŒ Error: ${err.message}`;
142
+ output.className = 'error';
143
+ }
144
+ }
145
+ </script>
146
+
147
+ <hr style="margin: 40px 0; border: 0; border-top: 1px solid #3c3c3c;">
148
+ <p style="text-align: center; color: #858585;">
149
+ <strong>SYNX v3.4.0</strong> — The Active Data Format<br>
150
+ Made by <a href="#" style="color: #4ec9b0;">APERTURESyndicate</a>
151
+ </p>
152
+ </body>
153
+ </html>
@@ -0,0 +1,9 @@
1
+ /**
2
+ * SYNX Engine — @aperturesyndicate/synx
3
+ *
4
+ * Resolves active markers (:random, :calc, :env, :alias, :secret, etc.)
5
+ * in a parsed SYNX object tree. Only runs in !active mode.
6
+ */
7
+ import type { SynxObject, SynxOptions } from './types';
8
+ export declare function resolve(obj: SynxObject, options?: SynxOptions, root?: SynxObject, includesMap?: Map<string, SynxObject>, _resolveDepth?: number, _currentPath?: string): SynxObject;
9
+ //# sourceMappingURL=engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAA0B,WAAW,EAAe,MAAM,SAAS,CAAC;AAgF5F,wBAAgB,OAAO,CACrB,GAAG,EAAE,UAAU,EACf,OAAO,GAAE,WAAgB,EACzB,IAAI,CAAC,EAAE,UAAU,EACjB,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,EACrC,aAAa,SAAI,EACjB,YAAY,SAAK,GAChB,UAAU,CAoeZ"}