@altopelago/sansa 0.9.0 → 0.10.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,354 @@
1
+ :root {
2
+ color-scheme: light;
3
+ --bg: #f3f0e8;
4
+ --panel: #fffdf8;
5
+ --ink: #20231d;
6
+ --muted: #666a5f;
7
+ --line: #d7d3c9;
8
+ --accent: #245b4f;
9
+ --accent-dark: #183e36;
10
+ --code: #161a18;
11
+ }
12
+
13
+ * {
14
+ box-sizing: border-box;
15
+ }
16
+
17
+ html,
18
+ body {
19
+ height: 100%;
20
+ }
21
+
22
+ body {
23
+ margin: 0;
24
+ min-width: 320px;
25
+ overflow: hidden;
26
+ background: var(--bg);
27
+ color: var(--ink);
28
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
29
+ }
30
+
31
+ button,
32
+ select,
33
+ textarea,
34
+ input {
35
+ font: inherit;
36
+ }
37
+
38
+ .app-shell {
39
+ height: 100vh;
40
+ min-height: 0;
41
+ display: grid;
42
+ grid-template-rows: auto minmax(0, 1fr);
43
+ }
44
+
45
+ .topbar {
46
+ display: flex;
47
+ align-items: end;
48
+ justify-content: space-between;
49
+ gap: 24px;
50
+ padding: 20px 24px;
51
+ border-bottom: 1px solid var(--line);
52
+ background: #fbfaf5;
53
+ }
54
+
55
+ h1 {
56
+ margin: 0;
57
+ font-family: ui-serif, Georgia, "Times New Roman", serif;
58
+ font-size: 32px;
59
+ line-height: 1.1;
60
+ letter-spacing: 0;
61
+ }
62
+
63
+ .topbar-actions {
64
+ display: flex;
65
+ flex-wrap: wrap;
66
+ justify-content: flex-end;
67
+ gap: 8px;
68
+ }
69
+
70
+ button,
71
+ select {
72
+ min-height: 40px;
73
+ border: 1px solid var(--line);
74
+ border-radius: 6px;
75
+ background: var(--panel);
76
+ color: var(--ink);
77
+ padding: 0 12px;
78
+ }
79
+
80
+ button {
81
+ cursor: pointer;
82
+ font-weight: 700;
83
+ }
84
+
85
+ #applyButton {
86
+ border-color: var(--accent);
87
+ background: var(--accent);
88
+ color: white;
89
+ }
90
+
91
+ #applyButton:hover {
92
+ background: var(--accent-dark);
93
+ }
94
+
95
+ .workspace {
96
+ min-height: 0;
97
+ display: grid;
98
+ grid-template-columns: minmax(360px, 1fr) minmax(460px, 1fr);
99
+ gap: 14px;
100
+ padding: 14px;
101
+ overflow: hidden;
102
+ }
103
+
104
+ .panel {
105
+ min-height: 0;
106
+ display: grid;
107
+ border: 1px solid var(--line);
108
+ border-radius: 8px;
109
+ background: var(--panel);
110
+ overflow: hidden;
111
+ }
112
+
113
+ .source-panel {
114
+ grid-template-rows: auto auto minmax(0, 1fr);
115
+ }
116
+
117
+ .request-panel {
118
+ grid-template-rows: auto minmax(150px, 0.46fr) auto auto auto auto auto minmax(180px, 0.54fr);
119
+ }
120
+
121
+ .panel-head {
122
+ display: flex;
123
+ align-items: center;
124
+ justify-content: space-between;
125
+ gap: 16px;
126
+ min-height: 42px;
127
+ padding: 10px 14px;
128
+ border-bottom: 1px solid var(--line);
129
+ }
130
+
131
+ .results-head {
132
+ border-top: 1px solid var(--line);
133
+ }
134
+
135
+ label,
136
+ .panel-head span {
137
+ font-size: 12px;
138
+ font-weight: 800;
139
+ letter-spacing: 0.08em;
140
+ text-transform: uppercase;
141
+ }
142
+
143
+ .panel-head span {
144
+ color: var(--muted);
145
+ }
146
+
147
+ .source-tabs,
148
+ .detail-tabs {
149
+ display: flex;
150
+ gap: 8px;
151
+ min-height: 46px;
152
+ padding: 7px 10px;
153
+ border-bottom: 1px solid var(--line);
154
+ background: #f8f6ef;
155
+ }
156
+
157
+ .detail-tabs {
158
+ border-top: 1px solid var(--line);
159
+ }
160
+
161
+ .source-tabs button,
162
+ .detail-tabs button {
163
+ min-height: 32px;
164
+ border-radius: 6px;
165
+ }
166
+
167
+ .source-tabs button[aria-selected="true"],
168
+ .detail-tabs button[aria-selected="true"] {
169
+ border-color: var(--accent);
170
+ background: var(--accent);
171
+ color: white;
172
+ }
173
+
174
+ .detail-tabs button {
175
+ display: inline-flex;
176
+ align-items: center;
177
+ gap: 12px;
178
+ }
179
+
180
+ .detail-tabs span {
181
+ color: var(--muted);
182
+ font-size: 11px;
183
+ font-weight: 800;
184
+ letter-spacing: 0.08em;
185
+ text-transform: uppercase;
186
+ }
187
+
188
+ .detail-tabs button[aria-selected="true"] span {
189
+ color: rgba(255, 255, 255, 0.78);
190
+ }
191
+
192
+ .detail-tabs span[data-phase="parse"],
193
+ .detail-tabs span[data-phase="lower"],
194
+ .detail-tabs span[data-phase="plan"],
195
+ .detail-tabs span[data-phase="policy"],
196
+ .detail-tabs span[data-phase="target"],
197
+ .detail-tabs span[data-phase="apply"] {
198
+ padding: 2px 7px;
199
+ border-radius: 999px;
200
+ background: rgba(36, 91, 79, 0.12);
201
+ color: var(--accent);
202
+ }
203
+
204
+ .detail-tabs span[data-phase="parse"],
205
+ .detail-tabs span[data-phase="lower"],
206
+ .detail-tabs span[data-phase="policy"],
207
+ .detail-tabs span[data-phase="target"],
208
+ .detail-tabs span[data-phase="error"] {
209
+ background: rgba(136, 54, 43, 0.12);
210
+ color: #88362b;
211
+ }
212
+
213
+ .detail-tabs button[aria-selected="true"] span[data-phase] {
214
+ background: rgba(255, 255, 255, 0.16);
215
+ color: white;
216
+ }
217
+
218
+ .source-view,
219
+ .detail-view {
220
+ min-height: 0;
221
+ display: grid;
222
+ }
223
+
224
+ textarea,
225
+ pre {
226
+ width: 100%;
227
+ min-width: 0;
228
+ min-height: 0;
229
+ margin: 0;
230
+ border: 0;
231
+ outline: 0;
232
+ resize: none;
233
+ background: var(--code);
234
+ color: #f5f1e8;
235
+ font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
236
+ font-size: 13px;
237
+ line-height: 1.55;
238
+ letter-spacing: 0;
239
+ tab-size: 2;
240
+ }
241
+
242
+ textarea {
243
+ padding: 14px;
244
+ }
245
+
246
+ textarea:focus {
247
+ box-shadow: inset 0 0 0 2px #3478d4;
248
+ }
249
+
250
+ pre {
251
+ overflow: auto;
252
+ padding: 14px;
253
+ white-space: pre-wrap;
254
+ word-break: break-word;
255
+ }
256
+
257
+ .hidden {
258
+ display: none;
259
+ }
260
+
261
+ .mode-row,
262
+ .budget-row {
263
+ display: flex;
264
+ align-items: center;
265
+ gap: 16px;
266
+ min-height: 42px;
267
+ padding: 0 14px;
268
+ border-top: 1px solid var(--line);
269
+ }
270
+
271
+ .mode-row label,
272
+ .budget-row label {
273
+ display: inline-flex;
274
+ align-items: center;
275
+ gap: 6px;
276
+ color: var(--muted);
277
+ letter-spacing: 0;
278
+ text-transform: none;
279
+ }
280
+
281
+ .mode-row input {
282
+ accent-color: var(--accent);
283
+ }
284
+
285
+ .mode-row select {
286
+ min-height: 30px;
287
+ border: 1px solid var(--line);
288
+ border-radius: 6px;
289
+ background: #fffdf8;
290
+ color: var(--ink);
291
+ padding: 0 28px 0 8px;
292
+ font: inherit;
293
+ }
294
+
295
+ #policyInput {
296
+ font-size: 12px;
297
+ line-height: 1.45;
298
+ }
299
+
300
+ .mode-row label.is-disabled {
301
+ opacity: 0.42;
302
+ }
303
+
304
+ .mode-row label.is-disabled,
305
+ .mode-row label.is-disabled input {
306
+ cursor: not-allowed;
307
+ }
308
+
309
+ .budget-row {
310
+ flex-wrap: wrap;
311
+ }
312
+
313
+ .budget-row label {
314
+ gap: 8px;
315
+ }
316
+
317
+ .budget-row input {
318
+ width: 112px;
319
+ min-height: 30px;
320
+ border: 1px solid var(--line);
321
+ border-radius: 6px;
322
+ background: #fffdf8;
323
+ color: var(--ink);
324
+ padding: 0 8px;
325
+ }
326
+
327
+ @media (max-width: 900px) {
328
+ body {
329
+ overflow: auto;
330
+ }
331
+
332
+ .app-shell {
333
+ height: auto;
334
+ min-height: 100vh;
335
+ }
336
+
337
+ .topbar {
338
+ align-items: stretch;
339
+ flex-direction: column;
340
+ }
341
+
342
+ .topbar-actions {
343
+ justify-content: stretch;
344
+ }
345
+
346
+ .topbar-actions > * {
347
+ flex: 1 1 140px;
348
+ }
349
+
350
+ .workspace {
351
+ grid-template-columns: minmax(0, 1fr);
352
+ grid-template-rows: minmax(420px, 46vh) minmax(560px, 1fr);
353
+ }
354
+ }
@@ -14,6 +14,7 @@ const resetButton = document.querySelector('#resetButton');
14
14
  const parseButton = document.querySelector('#parseButton');
15
15
  const runButton = document.querySelector('#runButton');
16
16
  const transformExtensionsInput = document.querySelector('#transformExtensions');
17
+ const valueSemanticsInput = document.querySelector('#valueSemantics');
17
18
  const budgetInputs = Array.from(document.querySelectorAll('.budget-row input'));
18
19
 
19
20
  let defaultFixtureSource = '';
@@ -64,6 +65,9 @@ document.querySelectorAll('input[name="queryPolicy"]').forEach((input) => {
64
65
  transformExtensionsInput.addEventListener('change', () => {
65
66
  if (lastAction !== 'parse') void runQuery();
66
67
  });
68
+ valueSemanticsInput.addEventListener('change', () => {
69
+ if (lastAction !== 'parse') void runQuery();
70
+ });
67
71
  budgetInputs.forEach((input) => {
68
72
  input.addEventListener('input', () => {
69
73
  if (lastAction !== 'parse') void runQuery();
@@ -94,7 +98,9 @@ queryInput.addEventListener('keydown', (event) => {
94
98
  });
95
99
 
96
100
  function setExample(name) {
97
- queryInput.value = queryExamples[name]?.query ?? queryExamples[firstQueryExampleName()]?.query ?? '';
101
+ const example = queryExamples[name] ?? queryExamples[firstQueryExampleName()];
102
+ queryInput.value = example?.query ?? '';
103
+ valueSemanticsInput.value = example?.valueSemantics ?? '';
98
104
  queryStatus.textContent = 'example loaded';
99
105
  }
100
106
 
@@ -168,6 +174,7 @@ async function runQuery() {
168
174
  query: queryInput.value,
169
175
  policy: queryPolicy(),
170
176
  transformExtensions: transformExtensionsInput.checked,
177
+ valueSemantics: valueSemanticsInput.value,
171
178
  budget: queryBudget(),
172
179
  });
173
180
  queryStatus.textContent = payload.ok ? 'run ok' : 'run failed';
@@ -306,7 +306,7 @@ export const queryExampleGroups = [
306
306
  ],
307
307
  },
308
308
  {
309
- label: 'Pipeline',
309
+ label: 'Ordering',
310
310
  examples: [
311
311
  {
312
312
  name: 'inactiveOrder',
@@ -324,20 +324,146 @@ export const queryExampleGroups = [
324
324
  },
325
325
  },
326
326
  {
327
- name: 'unicodeScalarOrder',
328
- label: 'Unicode scalar order',
327
+ name: 'defaultCodepointOrder',
328
+ label: 'Default codepoint order',
329
329
  query: lines(
330
330
  'from $.labels.*',
331
- 'where .value >= "z"',
332
331
  'order by .value asc',
333
332
  'select .value',
334
333
  ),
334
+ expected: {
335
+ ok: true,
336
+ count: 3,
337
+ includes: '$.labels[1].value = "éclair"',
338
+ },
339
+ },
340
+ ],
341
+ },
342
+ {
343
+ label: 'Value Families',
344
+ examples: [
345
+ {
346
+ name: 'hexFamilyFilter',
347
+ label: 'Hex family filter',
348
+ query: lines(
349
+ 'from $.types.*%hex',
350
+ 'select .',
351
+ ),
335
352
  expected: {
336
353
  ok: true,
337
354
  count: 2,
338
- includes: '$.labels[1].value = "ä"',
355
+ includes: '$.types.color = #ff00aa',
356
+ },
357
+ },
358
+ {
359
+ name: 'hexFamilyEquality',
360
+ label: 'Hex family equality',
361
+ query: lines(
362
+ 'from $.types.color',
363
+ 'where . == $.types.colorCopy',
364
+ 'select .',
365
+ ),
366
+ expected: {
367
+ ok: true,
368
+ count: 1,
369
+ includes: '$.types.color = #ff00aa',
339
370
  },
340
371
  },
372
+ {
373
+ name: 'typedScalarRendering',
374
+ label: 'Typed scalar rendering',
375
+ query: lines(
376
+ 'from $.types.*',
377
+ 'select .',
378
+ ),
379
+ expected: {
380
+ ok: true,
381
+ count: 22,
382
+ includes: '$.types.selector = $.inventory.items.*.sku',
383
+ },
384
+ },
385
+ {
386
+ name: 'referenceForm',
387
+ label: 'Reference form',
388
+ query: lines(
389
+ 'from $.targetClone',
390
+ 'where . == $.targetClone',
391
+ 'select .',
392
+ ),
393
+ expected: {
394
+ ok: true,
395
+ count: 1,
396
+ includes: '$.targetClone = ~target',
397
+ },
398
+ },
399
+ {
400
+ name: 'followReference',
401
+ label: 'Follow reference',
402
+ query: lines(
403
+ 'from $.targetClone',
404
+ 'where follow(.) == 7',
405
+ 'select follow(.)',
406
+ ),
407
+ expected: {
408
+ ok: true,
409
+ count: 1,
410
+ includes: '$.target = 7',
411
+ },
412
+ },
413
+ ],
414
+ },
415
+ {
416
+ label: 'Value Semantics',
417
+ examples: [
418
+ {
419
+ name: 'profileStringOrder',
420
+ label: 'French string order',
421
+ valueSemantics: 'aeon.value.string.locale.fr.v1',
422
+ query: lines(
423
+ 'from $.labels.*',
424
+ 'order by .value asc',
425
+ 'select .value',
426
+ ),
427
+ expected: {
428
+ ok: true,
429
+ count: 3,
430
+ includes: '$.labels[1].value = "éclair"',
431
+ },
432
+ },
433
+ {
434
+ name: 'profileCaseMapping',
435
+ label: 'French case mapping',
436
+ valueSemantics: 'aeon.value.string.locale.fr.v1',
437
+ query: lines(
438
+ 'from $.labels.*',
439
+ 'select upper(.value)',
440
+ ),
441
+ expected: {
442
+ ok: true,
443
+ count: 3,
444
+ includes: '$.labels[1] = "ÉCLAIR"',
445
+ },
446
+ },
447
+ {
448
+ name: 'profileNaturalAsciiOrder',
449
+ label: 'Natural ASCII order',
450
+ valueSemantics: 'aeon.value.string.natural.ascii.v1',
451
+ query: lines(
452
+ 'from $.parts.*',
453
+ 'order by .value asc',
454
+ 'select .value',
455
+ ),
456
+ expected: {
457
+ ok: true,
458
+ count: 3,
459
+ includes: '$.parts[1].value = "part-2"',
460
+ },
461
+ },
462
+ ],
463
+ },
464
+ {
465
+ label: 'Pipeline',
466
+ examples: [
341
467
  {
342
468
  name: 'parseProjection',
343
469
  label: 'Projection parse check',
@@ -84,6 +84,16 @@
84
84
  </label>
85
85
  </div>
86
86
 
87
+ <div class="mode-row" role="group" aria-label="Value semantics profile">
88
+ <label for="valueSemantics">Value Semantics</label>
89
+ <select id="valueSemantics">
90
+ <option value="">Default</option>
91
+ <option value="aeon.value.string.codepoint.v1">Codepoint</option>
92
+ <option value="aeon.value.string.natural.ascii.v1">Natural ASCII</option>
93
+ <option value="aeon.value.string.locale.fr.v1">French</option>
94
+ </select>
95
+ </div>
96
+
87
97
  <div class="budget-row" role="group" aria-label="Evaluation budgets">
88
98
  <label>
89
99
  From