@lostgradient/cinder 0.17.0 → 0.19.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 (68) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/components.json +3 -2
  3. package/dist/cli/index.js +2 -2
  4. package/dist/cli/types.d.ts +1 -0
  5. package/dist/components/approval-card/index.js +105 -37
  6. package/dist/components/code-block/index.js +103 -36
  7. package/dist/components/combobox/combobox.schema.js +14 -1
  8. package/dist/components/combobox/combobox.svelte.d.ts +12 -12
  9. package/dist/components/combobox/combobox.types.d.ts +11 -5
  10. package/dist/components/combobox/index.js +94 -16
  11. package/dist/components/event-stream-viewer/index.js +3 -2
  12. package/dist/components/invocation-rule-builder/index.js +3602 -380
  13. package/dist/components/invocation-rule-builder/invocation-rule-builder.css +14 -0
  14. package/dist/components/json-editor/index.js +86 -18
  15. package/dist/components/json-editor/json-editor-enhancement.d.ts +7 -0
  16. package/dist/components/json-editor/json-editor-enhancement.js +201 -0
  17. package/dist/components/json-editor/json-editor.css +68 -0
  18. package/dist/components/json-editor/json-editor.schema.js +5 -1
  19. package/dist/components/json-editor/json-editor.types.d.ts +2 -0
  20. package/dist/components/run-step-timeline/index.js +3 -2
  21. package/dist/components/status-dot/index.js +3 -2
  22. package/dist/highlighters/shiki/default.d.ts +5 -0
  23. package/dist/highlighters/shiki/default.js +278 -0
  24. package/dist/highlighters/shiki/index.d.ts +9 -2
  25. package/dist/highlighters/shiki/index.js +72 -35
  26. package/dist/index.js +608 -356
  27. package/dist/server/components/approval-card/index.js +2 -2
  28. package/dist/server/components/combobox/index.js +5 -3
  29. package/dist/server/components/event-stream-viewer/index.js +2 -2
  30. package/dist/server/components/invocation-rule-builder/index.js +15 -2
  31. package/dist/server/components/json-editor/index.js +1 -1
  32. package/dist/server/components/json-editor/json-editor-enhancement.js +150 -0
  33. package/dist/server/components/run-step-timeline/index.js +2 -2
  34. package/dist/server/components/status-dot/index.js +2 -2
  35. package/dist/server/highlighters/shiki/default.js +39 -0
  36. package/dist/server/highlighters/shiki/index.js +7 -131
  37. package/dist/server/index.js +10 -9
  38. package/dist/server/{index.server-npxtkwjp.js → index.server-0gg1njz4.js} +3 -2
  39. package/dist/server/{index.server-j87v28yy.js → index.server-0hjcds3y.js} +35 -18
  40. package/dist/server/{index.server-9vqfmhez.js → index.server-20km2ga0.js} +1 -1
  41. package/dist/server/{index.server-qxneqxf8.js → index.server-62593nnh.js} +1 -1
  42. package/dist/server/{index.server-m8ya4p7w.js → index.server-8grn4zd3.js} +74 -14
  43. package/dist/server/index.server-c9gtmre4.js +178 -0
  44. package/dist/server/{index.server-tez36va4.js → index.server-kvn6cj65.js} +1 -1
  45. package/dist/server/{index.server-93vt8ktj.js → index.server-v73af5rk.js} +18 -2
  46. package/dist/server/{index.server-qke3ekjt.js → index.server-ww54rv4y.js} +1 -1
  47. package/dist/server/index.server-x4a15jpm.js +9 -0
  48. package/dist/utilities/json-highlight.d.ts +2 -0
  49. package/package.json +19 -1
  50. package/src/components/code-block/code-block-default-highlighter.ts +2 -2
  51. package/src/components/combobox/combobox.schema.json +13 -0
  52. package/src/components/combobox/combobox.schema.ts +13 -0
  53. package/src/components/combobox/combobox.svelte +100 -14
  54. package/src/components/combobox/combobox.types.ts +11 -5
  55. package/src/components/invocation-rule-builder/invocation-rule-builder.css +14 -0
  56. package/src/components/invocation-rule-builder/invocation-rule-builder.examples.json +1 -1
  57. package/src/components/invocation-rule-builder/invocation-rule-builder.svelte +30 -16
  58. package/src/components/json-editor/json-editor-enhancement.ts +48 -0
  59. package/src/components/json-editor/json-editor.css +68 -0
  60. package/src/components/json-editor/json-editor.examples.json +2 -2
  61. package/src/components/json-editor/json-editor.schema.json +4 -0
  62. package/src/components/json-editor/json-editor.schema.ts +5 -0
  63. package/src/components/json-editor/json-editor.svelte +80 -20
  64. package/src/components/json-editor/json-editor.types.ts +2 -0
  65. package/src/components/status-dot/status-dot.svelte +6 -1
  66. package/src/highlighters/shiki/default.ts +46 -0
  67. package/src/highlighters/shiki/index.ts +101 -32
  68. package/src/utilities/json-highlight.ts +5 -0
@@ -1,4 +1,5 @@
1
1
  @layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
2
+ @import '../combobox/combobox.css';
2
3
 
3
4
  @layer cinder.components {
4
5
  .cinder-invocation-rule-builder {
@@ -133,6 +134,19 @@
133
134
  background-repeat: no-repeat;
134
135
  }
135
136
 
137
+ .cinder-invocation-rule-builder__condition-combobox {
138
+ flex: 1 1 8rem;
139
+ min-inline-size: 6rem;
140
+ }
141
+
142
+ .cinder-invocation-rule-builder__condition-combobox .cinder-combobox__control {
143
+ min-block-size: var(--cinder-control-height-sm, 2rem);
144
+ }
145
+
146
+ .cinder-invocation-rule-builder__condition-combobox .cinder-combobox__input {
147
+ min-block-size: var(--cinder-control-height-sm, 2rem);
148
+ }
149
+
136
150
  .cinder-invocation-rule-builder__condition-select:focus-visible {
137
151
  outline: var(--cinder-ring-width) solid transparent;
138
152
  box-shadow: var(--_cinder-focus-ring-shadow);
@@ -57,6 +57,7 @@ import"@lostgradient/cinder/json-editor/styles";
57
57
  // src/components/json-editor/json-editor.svelte
58
58
  import"svelte/internal/disclose-version";
59
59
  import * as $ from "svelte/internal/client";
60
+ import { tick } from "svelte";
60
61
 
61
62
  // src/_internal/field-control.ts
62
63
  function describeId(fieldId, hasDescription) {
@@ -113,28 +114,65 @@ var rest_excludes = new Set([
113
114
  "error",
114
115
  "rows",
115
116
  "showValidFeedback",
117
+ "highlight",
116
118
  "onValueChange",
117
119
  "class",
118
120
  "autofocus",
121
+ "wrap",
122
+ "onscroll",
119
123
  "aria-describedby",
120
124
  "aria-invalid"
121
125
  ]);
122
126
  var root = $.from_html(`<p class="cinder-json-editor__description"> </p>`);
123
- var root_1 = $.from_html(`<p> </p>`);
124
- var root_2 = $.from_html(`<div><label class="cinder-json-editor__label"> </label> <!> <textarea></textarea> <!></div>`);
127
+ var root_1 = $.from_html(`<pre class="cinder-json-editor__highlight" aria-hidden="true"></pre>`);
128
+ var root_2 = $.from_html(`<p> </p>`);
129
+ var root_3 = $.from_html(`<div><label class="cinder-json-editor__label"> </label> <!> <div><!> <textarea></textarea></div> <!></div>`);
125
130
  function Json_editor($$anchor, $$props) {
126
131
  $.push($$props, true);
127
- let rows = $.prop($$props, "rows", 3, 8), showValidFeedback = $.prop($$props, "showValidFeedback", 3, true), autofocus = $.prop($$props, "autofocus", 3, false), rest = $.rest_props($$props, rest_excludes);
132
+ let rows = $.prop($$props, "rows", 3, 8), showValidFeedback = $.prop($$props, "showValidFeedback", 3, true), highlight = $.prop($$props, "highlight", 3, false), autofocus = $.prop($$props, "autofocus", 3, false), rest = $.rest_props($$props, rest_excludes);
128
133
  let draftValue = $.state($.proxy($$props.value));
129
134
  let previousValue = $$props.value;
130
135
  let textareaNode = $.state(undefined);
131
136
  let resetSyncTimeout;
137
+ let highlightedHtml = $.state(null);
138
+ let lintPosition = $.state(null);
139
+ let highlightNode = $.state(undefined);
132
140
  $.user_effect(() => {
133
141
  if ($$props.value === previousValue)
134
142
  return;
135
143
  previousValue = $$props.value;
136
144
  $.set(draftValue, $$props.value, true);
137
145
  });
146
+ $.user_effect(() => {
147
+ if (!highlight() || $.get(externalError)) {
148
+ $.set(highlightedHtml, null);
149
+ $.set(lintPosition, null);
150
+ return;
151
+ }
152
+ const pendingValue = $.get(draftValue);
153
+ let cancelled = false;
154
+ import("@lostgradient/cinder/json-editor/enhancement").then(({ enhanceJson }) => {
155
+ if (cancelled)
156
+ return;
157
+ const result = enhanceJson(pendingValue, $.get(parseIsValid));
158
+ $.set(highlightedHtml, result.html, true);
159
+ $.set(lintPosition, result.lint?.position ?? null, true);
160
+ tick().then(() => {
161
+ if (!cancelled && $.get(highlightNode) && $.get(textareaNode)) {
162
+ $.get(highlightNode).scrollTop = $.get(textareaNode).scrollTop;
163
+ $.get(highlightNode).scrollLeft = $.get(textareaNode).scrollLeft;
164
+ }
165
+ });
166
+ }).catch(() => {
167
+ if (!cancelled) {
168
+ $.set(highlightedHtml, null);
169
+ $.set(lintPosition, null);
170
+ }
171
+ });
172
+ return () => {
173
+ cancelled = true;
174
+ };
175
+ });
138
176
  function syncDraftAfterFormReset() {
139
177
  if (resetSyncTimeout !== undefined)
140
178
  clearTimeout(resetSyncTimeout);
@@ -174,7 +212,8 @@ function Json_editor($$anchor, $$props) {
174
212
  const feedbackId = $.derived(() => $.get(feedbackText) ? `${$$props.id}-feedback` : undefined);
175
213
  const describedBy = $.derived(() => composeDescribedBy($.get(descriptionId), $.get(feedbackId), $$props["aria-describedby"]));
176
214
  const ariaInvalid2 = $.derived(() => $.get(feedbackIsError) ? "true" : $.get(normalizedConsumerInvalid));
177
- var div = root_2();
215
+ const hasHighlightOverlay = $.derived(() => highlight() && $.get(highlightedHtml) !== null);
216
+ var div = root_3();
178
217
  var label_1 = $.child(div);
179
218
  var text = $.child(label_1, true);
180
219
  $.reset(label_1);
@@ -195,33 +234,59 @@ function Json_editor($$anchor, $$props) {
195
234
  $$render(consequent);
196
235
  });
197
236
  }
198
- var textarea = $.sibling(node, 2);
199
- $.remove_textarea_child(textarea);
237
+ var div_1 = $.sibling(node, 2);
238
+ var node_1 = $.child(div_1);
239
+ {
240
+ var consequent_1 = ($$anchor2) => {
241
+ var pre = root_1();
242
+ $.html(pre, () => $.get(highlightedHtml), true);
243
+ $.reset(pre);
244
+ $.bind_this(pre, ($$value) => $.set(highlightNode, $$value), () => $.get(highlightNode));
245
+ $.append($$anchor2, pre);
246
+ };
247
+ $.if(node_1, ($$render) => {
248
+ if ($.get(hasHighlightOverlay))
249
+ $$render(consequent_1);
250
+ });
251
+ }
252
+ var textarea_1 = $.sibling(node_1, 2);
253
+ $.remove_textarea_child(textarea_1);
200
254
  var event_handler = (event) => {
201
255
  $.set(draftValue, event.currentTarget.value, true);
202
256
  $$props.onValueChange?.($.get(draftValue));
203
257
  };
204
- $.attribute_effect(textarea, () => ({
258
+ var event_handler_1 = (event) => {
259
+ const textarea = event.currentTarget;
260
+ if (!$.get(highlightNode))
261
+ return;
262
+ $.get(highlightNode).scrollTop = textarea.scrollTop;
263
+ $.get(highlightNode).scrollLeft = textarea.scrollLeft;
264
+ $$props.onscroll?.(event);
265
+ };
266
+ $.attribute_effect(textarea_1, () => ({
205
267
  ...rest,
206
268
  id: $$props.id,
207
269
  rows: rows(),
270
+ wrap: $$props.wrap,
208
271
  autofocus: autofocus(),
209
272
  value: $.get(draftValue),
210
273
  spellcheck: "false",
211
274
  class: "cinder-json-editor__textarea",
212
275
  "aria-describedby": $.get(describedBy),
213
276
  "aria-invalid": $.get(ariaInvalid2),
214
- oninput: event_handler
277
+ oninput: event_handler,
278
+ onscroll: event_handler_1
215
279
  }));
216
- $.bind_this(textarea, ($$value) => $.set(textareaNode, $$value), () => $.get(textareaNode));
217
- $.attach(textarea, () => (element) => {
280
+ $.bind_this(textarea_1, ($$value) => $.set(textareaNode, $$value), () => $.get(textareaNode));
281
+ $.attach(textarea_1, () => (element) => {
218
282
  if (autofocus())
219
283
  element.focus();
220
284
  });
221
- var node_1 = $.sibling(textarea, 2);
285
+ $.reset(div_1);
286
+ var node_2 = $.sibling(div_1, 2);
222
287
  {
223
- var consequent_1 = ($$anchor2) => {
224
- var p_1 = root_1();
288
+ var consequent_2 = ($$anchor2) => {
289
+ var p_1 = root_2();
225
290
  var text_2 = $.child(p_1, true);
226
291
  $.reset(p_1);
227
292
  $.template_effect(($0) => {
@@ -234,18 +299,21 @@ function Json_editor($$anchor, $$props) {
234
299
  ]);
235
300
  $.append($$anchor2, p_1);
236
301
  };
237
- $.if(node_1, ($$render) => {
302
+ $.if(node_2, ($$render) => {
238
303
  if ($.get(feedbackText))
239
- $$render(consequent_1);
304
+ $$render(consequent_2);
240
305
  });
241
306
  }
242
307
  $.reset(div);
243
- $.template_effect(($0) => {
308
+ $.template_effect(($0, $1) => {
244
309
  $.set_class(div, 1, $0);
245
310
  $.set_attribute(label_1, "for", $$props.id);
246
311
  $.set_text(text, $$props.label);
312
+ $.set_class(div_1, 1, $1);
313
+ $.set_attribute(div_1, "data-cinder-json-lint-position", $.get(lintPosition) ?? undefined);
247
314
  }, [
248
- () => $.clsx(classNames("cinder-json-editor", $$props.class))
315
+ () => $.clsx(classNames("cinder-json-editor", $$props.class)),
316
+ () => $.clsx(classNames("cinder-json-editor__input", $.get(hasHighlightOverlay) && "cinder-json-editor__input--highlighted", $$props.wrap === "off" && "cinder-json-editor__input--nowrap"))
249
317
  ]);
250
318
  $.append($$anchor, div);
251
319
  $.pop();
@@ -258,4 +326,4 @@ export {
258
326
  Json_editor as JsonEditor
259
327
  };
260
328
 
261
- //# debugId=43A5EA4935ACF81864756E2164756E21
329
+ //# debugId=422AB84E6C2CAC5764756E2164756E21
@@ -0,0 +1,7 @@
1
+ export type JsonLint = {
2
+ position: number;
3
+ };
4
+ export declare function enhanceJson(value: string, validated?: boolean): {
5
+ html: string;
6
+ lint: JsonLint | undefined;
7
+ };
@@ -0,0 +1,201 @@
1
+ var __create = Object.create;
2
+ var __getProtoOf = Object.getPrototypeOf;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ function __accessProp(key) {
7
+ return this[key];
8
+ }
9
+ var __toESMCache_node;
10
+ var __toESMCache_esm;
11
+ var __toESM = (mod, isNodeMode, target) => {
12
+ var canCache = mod != null && typeof mod === "object";
13
+ if (canCache) {
14
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
15
+ var cached = cache.get(mod);
16
+ if (cached)
17
+ return cached;
18
+ }
19
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
20
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
21
+ for (let key of __getOwnPropNames(mod))
22
+ if (!__hasOwnProp.call(to, key))
23
+ __defProp(to, key, {
24
+ get: __accessProp.bind(mod, key),
25
+ enumerable: true
26
+ });
27
+ if (canCache)
28
+ cache.set(mod, to);
29
+ return to;
30
+ };
31
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
32
+ var __returnValue = (v) => v;
33
+ function __exportSetter(name, newValue) {
34
+ this[name] = __returnValue.bind(null, newValue);
35
+ }
36
+ var __export = (target, all) => {
37
+ for (var name in all)
38
+ __defProp(target, name, {
39
+ get: all[name],
40
+ enumerable: true,
41
+ configurable: true,
42
+ set: __exportSetter.bind(all, name)
43
+ });
44
+ };
45
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
46
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
47
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
48
+ }) : x)(function(x) {
49
+ if (typeof require !== "undefined")
50
+ return require.apply(this, arguments);
51
+ throw Error('Dynamic require of "' + x + '" is not supported');
52
+ });
53
+
54
+ // src/utilities/json-highlight.ts
55
+ var KEYWORD_NULL = "null";
56
+ var KEYWORD_TRUE = "true";
57
+ var KEYWORD_FALSE = "false";
58
+ function escapeHtml(text) {
59
+ return text.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
60
+ }
61
+ function span(kind, raw) {
62
+ return `<span class="cinder-json-token cinder-json-token-${kind}">${escapeHtml(raw)}</span>`;
63
+ }
64
+ function readStringLiteral(source, startIndex) {
65
+ const stringPattern = /"(?:\\.|[^"\\])*"/y;
66
+ stringPattern.lastIndex = startIndex;
67
+ const match = stringPattern.exec(source);
68
+ return match?.[0] ?? source[startIndex] ?? "";
69
+ }
70
+ function readNumberLiteral(source, startIndex) {
71
+ const numberPattern = /-?(?:\d+)(?:\.\d+)?(?:[eE][+-]?\d+)?/y;
72
+ numberPattern.lastIndex = startIndex;
73
+ const match = numberPattern.exec(source);
74
+ return match?.[0] ?? source[startIndex] ?? "";
75
+ }
76
+ function tokenize(source) {
77
+ let output = "";
78
+ let index = 0;
79
+ let pendingKey = false;
80
+ const openerStack = [];
81
+ while (index < source.length) {
82
+ const character = source[index];
83
+ if (character === undefined)
84
+ break;
85
+ if (character === " " || character === "\t" || character === `
86
+ ` || character === "\r") {
87
+ output += escapeHtml(character);
88
+ index += 1;
89
+ continue;
90
+ }
91
+ if (character === "{") {
92
+ output += span("punctuation", "{");
93
+ openerStack.push("{");
94
+ pendingKey = true;
95
+ index += 1;
96
+ continue;
97
+ }
98
+ if (character === "[") {
99
+ output += span("punctuation", "[");
100
+ openerStack.push("[");
101
+ pendingKey = false;
102
+ index += 1;
103
+ continue;
104
+ }
105
+ if (character === "}" || character === "]") {
106
+ output += span("punctuation", character);
107
+ openerStack.pop();
108
+ index += 1;
109
+ continue;
110
+ }
111
+ if (character === ",") {
112
+ output += span("punctuation", ",");
113
+ pendingKey = openerStack[openerStack.length - 1] === "{";
114
+ index += 1;
115
+ continue;
116
+ }
117
+ if (character === ":") {
118
+ output += span("punctuation", ":");
119
+ pendingKey = false;
120
+ index += 1;
121
+ continue;
122
+ }
123
+ if (character === '"') {
124
+ const literal = readStringLiteral(source, index);
125
+ output += span(pendingKey ? "key" : "string", literal);
126
+ index += literal.length;
127
+ continue;
128
+ }
129
+ if (character === "-" || character >= "0" && character <= "9") {
130
+ const literal = readNumberLiteral(source, index);
131
+ output += span("number", literal);
132
+ index += literal.length;
133
+ continue;
134
+ }
135
+ if (source.startsWith(KEYWORD_TRUE, index)) {
136
+ output += span("boolean", KEYWORD_TRUE);
137
+ index += KEYWORD_TRUE.length;
138
+ continue;
139
+ }
140
+ if (source.startsWith(KEYWORD_FALSE, index)) {
141
+ output += span("boolean", KEYWORD_FALSE);
142
+ index += KEYWORD_FALSE.length;
143
+ continue;
144
+ }
145
+ if (source.startsWith(KEYWORD_NULL, index)) {
146
+ output += span("null", KEYWORD_NULL);
147
+ index += KEYWORD_NULL.length;
148
+ continue;
149
+ }
150
+ output += escapeHtml(character);
151
+ index += 1;
152
+ }
153
+ return `<code class="cinder-json">${output}</code>`;
154
+ }
155
+ function highlightJsonValidated(value) {
156
+ return tokenize(value);
157
+ }
158
+
159
+ // src/components/json-editor/json-editor-enhancement.ts
160
+ function lintJson(value, validated) {
161
+ if (validated)
162
+ return;
163
+ try {
164
+ JSON.parse(value);
165
+ return;
166
+ } catch (error) {
167
+ const message = error instanceof SyntaxError ? error.message : "";
168
+ const positionMatch = message.match(/position (\d+)/i);
169
+ const lineColumnMatch = message.match(/line\s+(\d+)\s+column\s+(\d+)/i);
170
+ let position = Number(positionMatch?.[1] ?? value.length);
171
+ if (!positionMatch && lineColumnMatch) {
172
+ const line = Number(lineColumnMatch[1]);
173
+ const column = Number(lineColumnMatch[2]);
174
+ const lines = value.split(`
175
+ `);
176
+ position = lines.slice(0, line - 1).reduce((offset, current) => offset + current.length + 1, 0) + Math.max(0, column - 1);
177
+ }
178
+ return { position };
179
+ }
180
+ }
181
+ function escapeHtml2(text) {
182
+ return text.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;");
183
+ }
184
+ function enhanceJson(value, validated = false) {
185
+ const lint = lintJson(value, validated);
186
+ if (!lint)
187
+ return { html: highlightJsonValidated(value), lint };
188
+ const position = Math.min(lint.position, value.length);
189
+ const before = escapeHtml2(value.slice(0, position));
190
+ const character = escapeHtml2(value[position] ?? " ");
191
+ const after = escapeHtml2(value.slice(position + 1));
192
+ return {
193
+ html: `<code class="cinder-json">${before}<span class="cinder-json-lint">${character}</span>${after}</code>`,
194
+ lint
195
+ };
196
+ }
197
+ export {
198
+ enhanceJson
199
+ };
200
+
201
+ //# debugId=4F6B4FB19CE86F8E64756E2164756E21
@@ -20,6 +20,8 @@
20
20
  }
21
21
 
22
22
  .cinder-json-editor__textarea {
23
+ display: block;
24
+ inline-size: 100%;
23
25
  min-block-size: 10rem;
24
26
  resize: vertical;
25
27
  border: 1px solid var(--cinder-border);
@@ -31,6 +33,72 @@
31
33
  font-size: var(--cinder-text-sm);
32
34
  }
33
35
 
36
+ .cinder-json-editor__input {
37
+ position: relative;
38
+ }
39
+
40
+ .cinder-json-editor__highlight {
41
+ position: absolute;
42
+ inset: 0;
43
+ overflow: auto;
44
+ margin: 0;
45
+ border: 1px solid transparent;
46
+ border-radius: var(--cinder-radius-md);
47
+ padding: var(--cinder-space-2);
48
+ background: var(--cinder-surface);
49
+ pointer-events: none;
50
+ white-space: pre-wrap;
51
+ overflow-wrap: anywhere;
52
+ font-family: var(--cinder-font-mono);
53
+ font-size: var(--cinder-text-sm);
54
+ line-height: normal;
55
+ scrollbar-width: none;
56
+ }
57
+
58
+ .cinder-json-editor__input--nowrap .cinder-json-editor__highlight {
59
+ white-space: pre;
60
+ overflow-wrap: normal;
61
+ width: 100%;
62
+ }
63
+
64
+ .cinder-json-editor__highlight::-webkit-scrollbar {
65
+ display: none;
66
+ }
67
+
68
+ .cinder-json-editor__input--highlighted .cinder-json-editor__textarea {
69
+ position: relative;
70
+ background: transparent;
71
+ color: transparent;
72
+ caret-color: var(--cinder-text);
73
+ }
74
+
75
+ .cinder-json-editor .cinder-json-token-key {
76
+ color: var(--cinder-accent-text);
77
+ }
78
+
79
+ .cinder-json-editor .cinder-json-token-string {
80
+ color: var(--cinder-color-success-fg);
81
+ }
82
+
83
+ .cinder-json-editor .cinder-json-token-number {
84
+ color: var(--cinder-color-warning-fg);
85
+ }
86
+
87
+ .cinder-json-editor .cinder-json-token-boolean,
88
+ .cinder-json-editor .cinder-json-token-null {
89
+ color: var(--cinder-color-info-fg);
90
+ }
91
+
92
+ .cinder-json-editor .cinder-json-token-punctuation {
93
+ color: var(--cinder-text-muted);
94
+ }
95
+
96
+ .cinder-json-editor .cinder-json-lint {
97
+ text-decoration: underline wavy var(--cinder-danger);
98
+ text-decoration-thickness: 1px;
99
+ text-underline-offset: 2px;
100
+ }
101
+
34
102
  .cinder-json-editor__textarea:focus-visible {
35
103
  outline: var(--cinder-ring-width) solid transparent;
36
104
  box-shadow: var(--_cinder-focus-ring-shadow);
@@ -92,6 +92,10 @@ var schema = {
92
92
  type: "boolean",
93
93
  description: "Whether valid JSON should render an announced success message. Defaults to true."
94
94
  },
95
+ highlight: {
96
+ type: "boolean",
97
+ description: "Enables a lazy syntax-highlighted view with inline parse-error annotation. Defaults to false."
98
+ },
95
99
  class: {
96
100
  type: "string",
97
101
  description: "Extra class names merged onto the field wrapper."
@@ -114,4 +118,4 @@ export {
114
118
  json_editor_schema_default as default
115
119
  };
116
120
 
117
- //# debugId=40177B02130C3ABB64756E2164756E21
121
+ //# debugId=19CC9200CDC727B564756E2164756E21
@@ -18,6 +18,8 @@ export type JsonEditorProps = Omit<HTMLTextareaAttributes, 'id' | 'value' | 'cla
18
18
  required?: boolean;
19
19
  /** Whether valid JSON should render an announced success message. Defaults to true. */
20
20
  showValidFeedback?: boolean;
21
+ /** Enables a lazy syntax-highlighted view with inline parse-error annotation. Defaults to false. */
22
+ highlight?: boolean;
21
23
  /** Called with the proposed JSON source whenever the user edits the textarea. */
22
24
  onValueChange?: (value: string) => void;
23
25
  /** Extra class names merged onto the field wrapper. */
@@ -621,6 +621,7 @@ function Status_dot($$anchor, $$props) {
621
621
  const resolvedAriaLabel = $7.derived(() => $7.get(normalizedAriaLabel) ?? $7.get(normalizedLabel) ?? $7.get(resolvedStatus));
622
622
  const visibleLabelIsLiveDuplicate = $7.derived(() => $7.get(resolvedLive) && $7.get(normalizedLabel) !== undefined && $7.get(resolvedAriaLabel) !== $7.get(normalizedLabel));
623
623
  const needsHiddenLiveLabel = $7.derived(() => $7.get(resolvedLive) && (!$7.get(hasVisibleLabel) || $7.get(visibleLabelIsLiveDuplicate)));
624
+ const liveAriaLabel = $7.derived(() => !$7.get(hasVisibleLabel) && ($7.get(normalizedLabel) !== undefined || $7.get(normalizedAriaLabel) !== undefined) ? $7.get(resolvedAriaLabel) : undefined);
624
625
  var span = root_24();
625
626
  $7.attribute_effect(span, ($0) => ({
626
627
  ...rest,
@@ -631,7 +632,7 @@ function Status_dot($$anchor, $$props) {
631
632
  role: $7.get(resolvedLive) ? "status" : "img",
632
633
  "aria-live": $7.get(resolvedLive) ? "polite" : undefined,
633
634
  "aria-atomic": $7.get(resolvedLive) ? "true" : undefined,
634
- "aria-label": $7.get(resolvedLive) ? undefined : $7.get(resolvedAriaLabel)
635
+ "aria-label": $7.get(resolvedLive) ? $7.get(liveAriaLabel) : $7.get(resolvedAriaLabel)
635
636
  }), [() => classNames("cinder-status-dot", $$props.class)]);
636
637
  var node = $7.sibling($7.child(span), 2);
637
638
  {
@@ -1718,4 +1719,4 @@ export {
1718
1719
  Run_step_timeline as RunStepTimeline
1719
1720
  };
1720
1721
 
1721
- //# debugId=90C7A137579C058F64756E2164756E21
1722
+ //# debugId=B0C29A50890B24FA64756E2164756E21
@@ -103,6 +103,7 @@ function Status_dot($$anchor, $$props) {
103
103
  const resolvedAriaLabel = $.derived(() => $.get(normalizedAriaLabel) ?? $.get(normalizedLabel) ?? $.get(resolvedStatus));
104
104
  const visibleLabelIsLiveDuplicate = $.derived(() => $.get(resolvedLive) && $.get(normalizedLabel) !== undefined && $.get(resolvedAriaLabel) !== $.get(normalizedLabel));
105
105
  const needsHiddenLiveLabel = $.derived(() => $.get(resolvedLive) && (!$.get(hasVisibleLabel) || $.get(visibleLabelIsLiveDuplicate)));
106
+ const liveAriaLabel = $.derived(() => !$.get(hasVisibleLabel) && ($.get(normalizedLabel) !== undefined || $.get(normalizedAriaLabel) !== undefined) ? $.get(resolvedAriaLabel) : undefined);
106
107
  var span = root_2();
107
108
  $.attribute_effect(span, ($0) => ({
108
109
  ...rest,
@@ -113,7 +114,7 @@ function Status_dot($$anchor, $$props) {
113
114
  role: $.get(resolvedLive) ? "status" : "img",
114
115
  "aria-live": $.get(resolvedLive) ? "polite" : undefined,
115
116
  "aria-atomic": $.get(resolvedLive) ? "true" : undefined,
116
- "aria-label": $.get(resolvedLive) ? undefined : $.get(resolvedAriaLabel)
117
+ "aria-label": $.get(resolvedLive) ? $.get(liveAriaLabel) : $.get(resolvedAriaLabel)
117
118
  }), [() => classNames("cinder-status-dot", $$props.class)]);
118
119
  var node = $.sibling($.child(span), 2);
119
120
  {
@@ -158,4 +159,4 @@ export {
158
159
  Status_dot as StatusDot
159
160
  };
160
161
 
161
- //# debugId=4B8DE203B7276BFD64756E2164756E21
162
+ //# debugId=761AF4BF36F8CDE664756E2164756E21
@@ -0,0 +1,5 @@
1
+ import { createRetryingLoaderCache, shikiHighlighter as createShikiHighlighter, type ShikiHighlighterOptions } from './index.ts';
2
+ export { createRetryingLoaderCache };
3
+ export type { ShikiHighlighterOptions };
4
+ /** The bundled adapter with the complete Shiki language and theme registries. */
5
+ export declare function shikiHighlighter(options?: ShikiHighlighterOptions, moduleLoader?: Parameters<typeof createShikiHighlighter>[1]): ReturnType<typeof createShikiHighlighter>;