@ngrok/mantle 0.82.1 → 0.83.1
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/accordion.d.ts +7 -7
- package/dist/agent.json +3 -1
- package/dist/{alert-BWwNPOMI.d.ts → alert-B1HXfkYn.d.ts} +9 -7
- package/dist/{alert-vwFd7qdp.js → alert-BuG2qS5l.js} +1 -1
- package/dist/alert-center.d.ts +3 -3
- package/dist/alert-center.js +1 -1
- package/dist/alert-dialog.d.ts +18 -18
- package/dist/alert.d.ts +1 -1
- package/dist/alert.js +1 -1
- package/dist/anchor.d.ts +2 -2
- package/dist/app-layout.js +1 -1
- package/dist/area-chart.d.ts +67 -19
- package/dist/area-chart.js +1 -1
- package/dist/avatar.d.ts +319 -0
- package/dist/avatar.js +1 -0
- package/dist/bar-chart.d.ts +73 -20
- package/dist/bar-chart.js +1 -1
- package/dist/breadcrumb.d.ts +50 -17
- package/dist/breadcrumb.js +1 -1
- package/dist/browser-only.d.ts +3 -3
- package/dist/{button-C-gMbPso.d.ts → button-BIf69CSV.d.ts} +2 -2
- package/dist/button-BLDjW1u9.js +1 -0
- package/dist/{button-IlxHhjPK.js → button-CCkGqE1t.js} +1 -1
- package/dist/{button-C7vAl6lS.d.ts → button-DJ7AAgII.d.ts} +4 -6
- package/dist/{button-DARFK2KJ.d.ts → button-PoIujPMX.d.ts} +2 -2
- package/dist/button.d.ts +3 -3
- package/dist/button.js +1 -1
- package/dist/calendar.d.ts +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +15 -15
- package/dist/{chart-1cVjAcj8.d.ts → chart-0zcFJh4n.d.ts} +75 -22
- package/dist/chart-DBxT9BNl.js +2 -0
- package/dist/{choice-BNRQXszu.d.ts → choice-CVdQrs-m.d.ts} +118 -6
- package/dist/choice.d.ts +1 -1
- package/dist/{code-block-C9uaM9-V.js → code-block-CIE0F2fu.js} +1 -1
- package/dist/{code-block-B6OlZrSI.d.ts → code-block-CZWPrV4k.d.ts} +3 -3
- package/dist/code-block.d.ts +10 -7
- package/dist/code-block.js +2 -2
- package/dist/code-block_highlight-utils.d.ts +1 -1
- package/dist/code-block_highlight-utils.js +1 -1
- package/dist/combobox.d.ts +8 -9
- package/dist/command.d.ts +668 -106
- package/dist/command.js +1 -1
- package/dist/data-table.d.ts +6 -6
- package/dist/data-table.js +1 -1
- package/dist/dialog-32Hq6w6P.js +1 -0
- package/dist/dialog-B6h1BCDL.d.ts +895 -0
- package/dist/dialog.d.ts +2 -805
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu-BcALUQMp.d.ts +1 -0
- package/dist/{dropdown-menu-D6pMAY7I.d.ts → dropdown-menu-DZOfj6HB.d.ts} +1 -1
- package/dist/dropdown-menu.d.ts +2 -2
- package/dist/field.d.ts +5 -5
- package/dist/field.js +1 -1
- package/dist/flag.js +1 -1
- package/dist/hooks.d.ts +16 -17
- package/dist/hooks.js +1 -1
- package/dist/icons-DEVx1oP9.js +1 -0
- package/dist/icons.d.ts +7 -6
- package/dist/icons.js +1 -1
- package/dist/{in-view-DDEGUKDR.d.ts → in-view-gxyc9Q1_.d.ts} +1 -1
- package/dist/{input-BuYDU6CF.d.ts → input-DpnC3Xgj.d.ts} +2 -2
- package/dist/input.d.ts +1 -1
- package/dist/kbd.d.ts +1 -1
- package/dist/line-chart.d.ts +60 -13
- package/dist/line-chart.js +1 -1
- package/dist/list-CwL23L_B.js +1 -0
- package/dist/list.d.ts +2 -2
- package/dist/list.js +1 -1
- package/dist/llms.txt +3 -1
- package/dist/mantle-dark-high-contrast.css +30 -17
- package/dist/mantle-dark.css +48 -13
- package/dist/mantle-light-high-contrast.css +33 -15
- package/dist/mantle.css +436 -26
- package/dist/media-object.d.ts +5 -1
- package/dist/multi-select.d.ts +7 -7
- package/dist/multi-select.js +1 -1
- package/dist/otp-input.d.ts +4 -4
- package/dist/otp-input.js +1 -1
- package/dist/pagination.d.ts +2 -2
- package/dist/pagination.js +1 -1
- package/dist/progress.d.ts +4 -4
- package/dist/qr-code.d.ts +2 -2
- package/dist/sandbar.d.ts +471 -0
- package/dist/sandbar.js +1 -0
- package/dist/sandboxed-on-click.d.ts +4 -6
- package/dist/scatter-plot.d.ts +69 -24
- package/dist/scatter-plot.js +1 -1
- package/dist/{select-0z7HVS6r.d.ts → select-DVHmgih8.d.ts} +13 -7
- package/dist/select-LK9NX-vV.js +1 -0
- package/dist/select.d.ts +1 -1
- package/dist/select.js +1 -1
- package/dist/selectable-list.d.ts +4 -4
- package/dist/selectable-list.js +1 -1
- package/dist/{separator-B5UmkVRL.d.ts → separator-CNDs98Dv.d.ts} +2 -2
- package/dist/separator.d.ts +1 -1
- package/dist/{sheet-BxvTfPLM.js → sheet-BOSknSN9.js} +1 -1
- package/dist/sheet.d.ts +1 -1
- package/dist/sheet.js +1 -1
- package/dist/sidebar.d.ts +347 -366
- package/dist/sidebar.js +1 -1
- package/dist/slider.d.ts +1 -1
- package/dist/split-button.d.ts +12 -12
- package/dist/split-button.js +1 -1
- package/dist/switch.d.ts +2 -1
- package/dist/{table-CGxJwtbL.js → table-C_Nm_RSV.js} +1 -1
- package/dist/{table-CZBYEmyK.d.ts → table-D51ZtV4U.d.ts} +18 -8
- package/dist/table.d.ts +1 -1
- package/dist/table.js +1 -1
- package/dist/tabs.d.ts +8 -13
- package/dist/tabs.js +1 -1
- package/dist/{theme-FbfjYiD3.d.ts → theme-6OxNhf6l.d.ts} +6 -6
- package/dist/theme-CVfq037P.js +1 -0
- package/dist/theme-switcher.d.ts +3 -3
- package/dist/theme-switcher.js +1 -1
- package/dist/theme.d.ts +86 -23
- package/dist/theme.js +1 -1
- package/dist/toast.d.ts +9 -9
- package/dist/toast.js +1 -1
- package/dist/{tooltip-mrpLz4DZ.d.ts → tooltip-DuXGxIse.d.ts} +6 -4
- package/dist/tooltip.d.ts +1 -1
- package/dist/use-breakpoint-Dqu12Szq.js +1 -0
- package/dist/use-callback-ref-IYti9y7x.js +1 -0
- package/dist/use-is-apple-platform-Cxwrb86L.js +1 -0
- package/dist/use-matches-media-query-Bd_GhhVd.js +1 -0
- package/dist/utils.d.ts +1 -1
- package/package.json +5 -3
- package/dist/button-DvHMWAPl.js +0 -1
- package/dist/chart-B3pAvmkk.js +0 -2
- package/dist/dialog-DozL6n-F.js +0 -1
- package/dist/dropdown-menu-BbbQuae2.d.ts +0 -1
- package/dist/icons-Bb_zF2OV.js +0 -1
- package/dist/list-CJABVHwi.js +0 -1
- package/dist/platform-BVD3gpKD.js +0 -1
- package/dist/select-BReznXaw.js +0 -1
- package/dist/theme-BorfgnNh.js +0 -1
- package/dist/use-breakpoint-Wd7_5-Mu.js +0 -1
- package/dist/use-matches-media-query-CMSxHR9n.js +0 -1
|
@@ -243,12 +243,124 @@ declare const Description: ({ asChild, className, ref, ...props }: ComponentProp
|
|
|
243
243
|
* ```
|
|
244
244
|
*/
|
|
245
245
|
declare const Choice: {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
246
|
+
/**
|
|
247
|
+
* Root: the layout + id/association owner. Reads `FieldControlContext` when
|
|
248
|
+
* present so a `Field`'s id/name/aria flow onto the control.
|
|
249
|
+
*
|
|
250
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```tsx
|
|
254
|
+
* <Choice.Root name="notify">
|
|
255
|
+
* <Choice.Indicator>
|
|
256
|
+
* <Checkbox />
|
|
257
|
+
* </Choice.Indicator>
|
|
258
|
+
* <Choice.Content>
|
|
259
|
+
* <Choice.Label>Email</Choice.Label>
|
|
260
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
261
|
+
* </Choice.Content>
|
|
262
|
+
* </Choice.Root>
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
readonly Root: typeof Root;
|
|
266
|
+
/**
|
|
267
|
+
* Indicator: the left control slot. Clones its element child with the shared
|
|
268
|
+
* id/aria/name so the control is wired without threading ids.
|
|
269
|
+
*
|
|
270
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```tsx
|
|
274
|
+
* <Choice.Root name="notify">
|
|
275
|
+
* <Choice.Indicator>
|
|
276
|
+
* <Checkbox />
|
|
277
|
+
* </Choice.Indicator>
|
|
278
|
+
* <Choice.Content>
|
|
279
|
+
* <Choice.Label>Email</Choice.Label>
|
|
280
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
281
|
+
* </Choice.Content>
|
|
282
|
+
* </Choice.Root>
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
readonly Indicator: typeof Indicator;
|
|
286
|
+
/**
|
|
287
|
+
* Content: the right column that stacks the title over the description.
|
|
288
|
+
*
|
|
289
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```tsx
|
|
293
|
+
* <Choice.Root name="notify">
|
|
294
|
+
* <Choice.Indicator>
|
|
295
|
+
* <Checkbox />
|
|
296
|
+
* </Choice.Indicator>
|
|
297
|
+
* <Choice.Content>
|
|
298
|
+
* <Choice.Label>Email</Choice.Label>
|
|
299
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
300
|
+
* </Choice.Content>
|
|
301
|
+
* </Choice.Root>
|
|
302
|
+
* ```
|
|
303
|
+
*/
|
|
304
|
+
readonly Content: typeof Content;
|
|
305
|
+
/**
|
|
306
|
+
* Label: the title as a real `<label htmlFor>`. Use when the `Choice` owns
|
|
307
|
+
* labeling (standalone control); otherwise use `Choice.Title`.
|
|
308
|
+
*
|
|
309
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```tsx
|
|
313
|
+
* <Choice.Root name="notify">
|
|
314
|
+
* <Choice.Indicator>
|
|
315
|
+
* <Checkbox />
|
|
316
|
+
* </Choice.Indicator>
|
|
317
|
+
* <Choice.Content>
|
|
318
|
+
* <Choice.Label>Email</Choice.Label>
|
|
319
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
320
|
+
* </Choice.Content>
|
|
321
|
+
* </Choice.Root>
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
readonly Label: typeof ChoiceLabel;
|
|
325
|
+
/**
|
|
326
|
+
* Title: the title as label-less text (`<p>`). Use when an ancestor (a
|
|
327
|
+
* clickable row or a Headless radio item) owns labeling.
|
|
328
|
+
*
|
|
329
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```tsx
|
|
333
|
+
* <Choice.Root id="onboarding-key">
|
|
334
|
+
* <Choice.Indicator>
|
|
335
|
+
* <Checkbox />
|
|
336
|
+
* </Choice.Indicator>
|
|
337
|
+
* <Choice.Content>
|
|
338
|
+
* <Choice.Title>Onboarding Key</Choice.Title>
|
|
339
|
+
* <Choice.Description>ng-3FaThZL***8xiA</Choice.Description>
|
|
340
|
+
* </Choice.Content>
|
|
341
|
+
* </Choice.Root>
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
readonly Title: typeof Title;
|
|
345
|
+
/**
|
|
346
|
+
* Description: the supplementary line, wired via `aria-describedby`.
|
|
347
|
+
*
|
|
348
|
+
* @see https://mantle.ngrok.com/components/forms/choice
|
|
349
|
+
*
|
|
350
|
+
* @example
|
|
351
|
+
* ```tsx
|
|
352
|
+
* <Choice.Root name="notify">
|
|
353
|
+
* <Choice.Indicator>
|
|
354
|
+
* <Checkbox />
|
|
355
|
+
* </Choice.Indicator>
|
|
356
|
+
* <Choice.Content>
|
|
357
|
+
* <Choice.Label>Email</Choice.Label>
|
|
358
|
+
* <Choice.Description>Get notified by email.</Choice.Description>
|
|
359
|
+
* </Choice.Content>
|
|
360
|
+
* </Choice.Root>
|
|
361
|
+
* ```
|
|
362
|
+
*/
|
|
363
|
+
readonly Description: typeof Description;
|
|
252
364
|
};
|
|
253
365
|
//#endregion
|
|
254
366
|
export { ChoiceRootProps as n, Choice as t };
|
package/dist/choice.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as ChoiceRootProps, t as Choice } from "./choice-
|
|
1
|
+
import { n as ChoiceRootProps, t as Choice } from "./choice-CVdQrs-m.js";
|
|
2
2
|
export { Choice, type ChoiceRootProps };
|
|
@@ -5,7 +5,7 @@ import{t as e}from"./cx-IiQEAKf5.js";import{t}from"./booleanish-BfvnW6vy.js";con
|
|
|
5
5
|
`).split(`
|
|
6
6
|
`);for(let e=0;e<t.length;e++){let n=t[e]??``;n.startsWith(`<span class="line">`)&&n.endsWith(`</span>`)&&(t[e]=n.slice(19,n.length-7))}return t}function m(e){return encodeURIComponent(e)}function h({foldableRanges:t,highlightLines:n,html:r,lineNumberStart:i=1,showLineNumbers:a=!1}){let o=u(...n??[]),s=p(r),c=new Map,l=new Map,d=t!=null&&t.length>0;if(d&&t!=null)for(let e of t){let t=m(e.id);c.set(e.startLine,t);for(let n=e.startLine+1;n<e.endLine;n+=1){let e=l.get(n);e??(e=[],l.set(n,e)),e.push(t)}}let f=``;for(let t=0;t<s.length;t++){let n=s[t]??``,r=t+1,u=i+t,p=d?c.get(r):void 0,m=e(`mantle-code-line`,o.has(u)&&`mantle-code-line-highlighted`,p!=null&&`mantle-code-line-opener`),h=a?`<span class="mantle-code-line-number" data-slot="line-number">${u}</span>`:``,g=``,_=``,v=``;if(d){p!=null&&(g=`<button type="button" class="mantle-code-fold-toggle" data-slot="fold-toggle" data-fold-line="${p}" aria-expanded="true" aria-label="Toggle code folding"><svg class="mantle-code-fold-caret" viewBox="0 0 16 16" aria-hidden="true" focusable="false"><path fill="currentColor" fill-rule="evenodd" d="M3.22 5.97a.75.75 0 0 1 1.06 0L8 9.69l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L3.22 7.03a.75.75 0 0 1 0-1.06Z"/></svg></button>`,v=`<span class="mantle-code-fold-ellipsis" data-slot="fold-ellipsis" aria-hidden="true">⋯</span>`);let e=l.get(r);e!=null&&e.length>0&&(_=` data-fold-regions="${e.join(` `)}"`)}let y=`<span class="mantle-code-line-content" data-slot="line-content">${n===``?` `:n}${v}</span>`;f+=`<span class="${m}" data-line-number="${u}"${_}>${h}${g}${y}</span>`}return f}function g(e){switch(e){case`python`:case`py`:case`yaml`:case`yml`:return`indentation`;case`html`:case`xml`:return`tag`;case`bash`:case`sh`:case`shell`:case`plain`:case`plaintext`:case`text`:case`txt`:return`none`;default:return`bracket`}}function _({language:e,tokens:t}){switch(g(e)){case`bracket`:return S(t);case`indentation`:return w(t);case`tag`:return ee(t);case`none`:return[]}}function v(e){if(e.length===0)return!1;let t=e[e.length-1]?.scopeName??``;return t===`string`||t===`comment`||t.startsWith(`string.`)||t.startsWith(`comment.`)||t.startsWith(`constant.character.escape`)}function y(e){return e.explanation!=null&&e.explanation.length>0?e.explanation:[{content:e.content,scopes:[]}]}function b(e){let t=``;for(let n of e){let e=y(n),r=!1;for(let t of e)if(v(t.scopes)){r=!0;break}if(!r){t+=n.content;continue}for(let n of e)v(n.scopes)||(t+=n.content)}return t}function x(e){if(e==null||e.length===0)return-1;let t=0;for(let n of e){let e=n.content;for(let n=0;n<e.length;n+=1){let r=e.charCodeAt(n);if(r===32||r===9){t+=1;continue}return t}}return-1}function S(e){let t=[],n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=r+1;for(let e of i)if(C(e.content))for(let r of y(e)){if(v(r.scopes))continue;let e=r.content;for(let r=0;r<e.length;r+=1){let i=e.charCodeAt(r);if(i===123||i===91)t.push(a);else if(i===125||i===93){let e=t.pop();e!=null&&e!==a&&n.push({id:String(e),startLine:e,endLine:a})}}}}return c(n)}function C(e){for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n===123||n===125||n===91||n===93)return!0}return!1}function w(e){let t=Array.from({length:e.length});for(let n=0;n<e.length;n+=1)t[n]=x(e[n]);let n=[];for(let e=0;e<t.length;e+=1){let r=t[e]??-1;if(r<0)continue;let i=-1,a=e+1;for(;a<t.length;){let e=t[a]??-1;if(e<0){a+=1;continue}if(e>r){i=a,a+=1;continue}break}i>e&&n.push({id:String(e+1),startLine:e+1,endLine:i+2})}return c(n)}function ee(e){let t=[],n=[];for(let r=0;r<e.length;r+=1){let i=e[r];if(i==null)continue;let a=r+1,o=E(b(i));for(let e of o)if(e.kind===`open`)t.push({name:e.name,line:a});else{let r=t.length>0?t[t.length-1]:void 0;r!=null&&r.name.toLowerCase()===e.name.toLowerCase()&&(t.pop(),r.line!==a&&n.push({id:String(r.line),startLine:r.line,endLine:a}))}}return c(n)}const T=new Set([`area`,`base`,`br`,`col`,`embed`,`hr`,`img`,`input`,`link`,`meta`,`param`,`source`,`track`,`wbr`]);function E(e){let t=[],n=0;for(;n<e.length;){let r=e.indexOf(`<`,n);if(r===-1)break;let i=O(e,r+1),a=e.charCodeAt(i)===47;if(a&&(i=O(e,i+1)),!k(e.charCodeAt(i))){n=r+1;continue}let o=i;for(i+=1;i<e.length&&A(e.charCodeAt(i));)i+=1;let s=e.slice(o,i),c=j(e,i);if(c===-1){n=r+1;continue}if(a){t.push({name:s,kind:`close`}),n=c+1;continue}if(te(e,c)||T.has(s.toLowerCase())){n=c+1;continue}t.push({name:s,kind:`open`}),n=c+1}return t}function D(e){return e===9||e===10||e===11||e===12||e===13||e===32}function O(e,t){let n=t;for(;n<e.length&&D(e.charCodeAt(n));)n+=1;return n}function k(e){return e>=65&&e<=90||e>=97&&e<=122}function A(e){return k(e)||e>=48&&e<=57||e===45||e===58||e===95}function j(e,t){let n;for(let r=t;r<e.length;r+=1){let t=e.charCodeAt(r);if(n!=null){t===n&&(n=void 0);continue}if(t===34||t===39){n=t;continue}if(t===62)return r}return-1}function te(e,t){let n=t-1;for(;n>=0&&D(e.charCodeAt(n));)--n;return n>=0&&e.charCodeAt(n)===47}const ne=[`tabs`,`spaces`];function M(e){return ne.includes(e)}function re(e,t){return t||(F(e)?`tabs`:(I(e),`spaces`))}const N=new Set([`csharp`,`css`,`go`,`html`,`java`,`javascript`,`js`,`jsx`,`ts`,`tsx`,`typescript`,`xml`]),P=new Set([`python`,`py`,`yaml`,`yml`,`ruby`,`rb`]);function F(e){return N.has(e)}function I(e){return P.has(e)}function L(e,t){let n=t?.indentation??`spaces`,r=e.replace(/\r\n?/g,`
|
|
7
7
|
`),i=r.trim();if(i===``)return``;let a=B(r),o=i.split(`
|
|
8
|
-
`),s=Array.from({length:o.length});for(let e=0;e<o.length;e++){let t=o[e];t
|
|
8
|
+
`),s=Array.from({length:o.length});for(let e=0;e<o.length;e++){let t=o[e];if(t==null)continue;let r=z(t)?t:t.slice(a);s[e]=R(r,n)}return s.join(`
|
|
9
9
|
`)}function R(e,t){let n=0;for(;n<e.length;){let t=e[n];if(t!==` `&&t!==` `)break;n+=1}if(n===0||n===e.length)return e;let r=e.slice(0,n);return(t===`spaces`?r.replace(/\t/g,` `):r.replace(/ {2}/g,` `))+e.slice(n)}function z(e){let t=e[0];return t!=null&&t!==` `&&t!==` `}function B(e){let t=1/0,n=0,r=!0;for(let i=0;i<e.length;i++){let a=e[i];if(r){if(a===` `||a===` `){n+=1;continue}if(a===`
|
|
10
10
|
`||a===`\r`){n=0;continue}if(n<t&&(t=n,t===0))return 0;r=!1;continue}(a===`
|
|
11
11
|
`||a===`\r`)&&(r=!0,n=0)}return t===1/0?0:t}const V=`bash.cs.csharp.css.go.html.java.javascript.js.json.jsx.plain.plaintext.py.python.rb.ruby.rust.sh.shell.text.ts.tsx.txt.typescript.xml.yaml.yml`.split(`.`),H=new Set(V),U=`text`;function W(e){let t=e?.trim()??``;if(!t)return U;let n=t.indexOf(`-`),r=n===-1?t:t.slice(n+1);return G(r)?r:U}const G=e=>typeof e==`string`&&H.has(e);function K(e){if(typeof e==`boolean`)return e;if(typeof e==`string`){if(e===`true`)return!0;if(e===`false`)return!1}}function q(e){if(typeof e==`number`&&Number.isFinite(e)&&e>0)return Math.floor(e);if(typeof e==`string`&&/^\d+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:void 0}}function J(e){if(typeof e==`number`)return Number.isFinite(e)&&e>0?Math.floor(e):void 0;if(typeof e==`string`){let t=e.trim();if(/^\d+$/.test(t)){let e=Number.parseInt(t,10);return e>0?e:void 0}if(/^\d+-\d+$/.test(t)){let[e,n]=t.split(`-`);return Number.parseInt(e??``,10)>0&&Number.parseInt(n??``,10)>0?t:void 0}}}function Y(e){if(typeof e==`string`){let t=[],n=e.split(`,`);for(let e of n){let n=J(e);n!=null&&t.push(n)}return t.length>0?t:void 0}if(!Array.isArray(e))return;let t=[];for(let n of e){let e=J(n);e!=null&&t.push(e)}return t.length>0?t:void 0}const X={collapsible:!1,disableCopy:!1,indentation:void 0,mode:void 0,title:void 0};function ie(e){let t=e?.trim()??``;if(!t)return X;let n={},r=Q(t);for(let e of r){let t=e.indexOf(`=`),r=t===-1?e:e.slice(0,t),i=t===-1?void 0:e.slice(t+1);r&&(n[r]=Z(i)??!0)}return oe(n)}function Z(e){if(e==null)return;let t=e.trim(),n=t.length-1;return n>=1&&t.charCodeAt(0)===34&&t.charCodeAt(n)===34?t.slice(1,n):t}function Q(e){let t=e?.trim()??``,n=[],r=``,i=!1;for(let e=0;e<t.length;e++){let a=t[e]??``;!i&&ae(a)?r&&=(n.push(r),``):(a===`"`&&(i=!i),r+=a)}return r&&n.push(r),n}function ae(e){return e===` `||e===` `||e===`
|
|
@@ -22,7 +22,7 @@ type FoldableRange = {
|
|
|
22
22
|
* stringified `startLine` (unique by construction after dedup), encoded
|
|
23
23
|
* into `data-fold-line` on the toggle button and `data-fold-regions` on
|
|
24
24
|
* each descendant line so the runtime delegated handler can resolve
|
|
25
|
-
* toggles by attribute lookup. Custom strategies should
|
|
25
|
+
* toggles by attribute lookup. Custom strategies should set non-empty
|
|
26
26
|
* IDs that are unique within the code block; the decorator URI-encodes
|
|
27
27
|
* them before rendering so spaces and quotes remain safe.
|
|
28
28
|
*/
|
|
@@ -162,7 +162,7 @@ type ComputeFoldRangesInput = {
|
|
|
162
162
|
/** Resolved supported language; controls which strategy runs. */
|
|
163
163
|
language: SupportedLanguage;
|
|
164
164
|
/**
|
|
165
|
-
* Tokens
|
|
165
|
+
* Tokens from Shiki for the same code the block renders.
|
|
166
166
|
* Must include scope explanations (i.e. tokenized with
|
|
167
167
|
* `includeExplanation: 'scopeName'` or `true`) so string and comment
|
|
168
168
|
* regions can be ignored.
|
|
@@ -223,7 +223,7 @@ declare const mantleCodeBlockValueBrand: unique symbol;
|
|
|
223
223
|
* by the Vite plugin at build time) and the original code string for the copy button.
|
|
224
224
|
*
|
|
225
225
|
* `~preHtml` is required at render time. Runtime syntax highlighting is intentionally
|
|
226
|
-
* unsupported; only
|
|
226
|
+
* unsupported; `CodeBlock.Code` only substitutes placeholders for interpolated values.
|
|
227
227
|
*/
|
|
228
228
|
type MantleCodeBlockValue = {
|
|
229
229
|
/**
|
package/dist/code-block.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as WithAsChild, t as SelfClosingWithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
2
|
import { t as SvgAttributes } from "./icon-D1RY5Tcj.js";
|
|
3
|
-
import { A as FoldStrategy, B as computeJsonFoldRanges, C as Indentation, D as FoldExplanation, E as ComputeFoldRangesInput, F as isSupportedLanguage, H as finalizeFoldRanges, I as parseLanguage, L as supportedLanguages, M as computeFoldRanges, N as foldStrategyFor, O as FoldLine, P as SupportedLanguage, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, _ as MantleCodeBlockValue, a as Mode, c as ResolvedPreRenderedCodeBlockProps, d as parseMetastring, f as resolvePreRenderedCodeBlockProps, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, i as MetaInput, j as FoldToken, k as FoldScope, l as defaultMeta, m as parseCodeBlockHighlightLines, n as DefaultMeta, o as ResolvePreRenderedCodeBlockPropsInput, p as tokenizeMetastring, r as Meta, s as ResolvePreRenderedCodeBlockPropsResult, t as CodeBlockPreElementInput, u as normalizeValue, v as MantleCodeOptions, w as inferIndentation, x as mantleCode, y as createMantleCodeBlockValue, z as decorateHighlightedHtml } from "./code-block-
|
|
3
|
+
import { A as FoldStrategy, B as computeJsonFoldRanges, C as Indentation, D as FoldExplanation, E as ComputeFoldRangesInput, F as isSupportedLanguage, H as finalizeFoldRanges, I as parseLanguage, L as supportedLanguages, M as computeFoldRanges, N as foldStrategyFor, O as FoldLine, P as SupportedLanguage, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, _ as MantleCodeBlockValue, a as Mode, c as ResolvedPreRenderedCodeBlockProps, d as parseMetastring, f as resolvePreRenderedCodeBlockProps, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, i as MetaInput, j as FoldToken, k as FoldScope, l as defaultMeta, m as parseCodeBlockHighlightLines, n as DefaultMeta, o as ResolvePreRenderedCodeBlockPropsInput, p as tokenizeMetastring, r as Meta, s as ResolvePreRenderedCodeBlockPropsResult, t as CodeBlockPreElementInput, u as normalizeValue, v as MantleCodeOptions, w as inferIndentation, x as mantleCode, y as createMantleCodeBlockValue, z as decorateHighlightedHtml } from "./code-block-CZWPrV4k.js";
|
|
4
4
|
import { ComponentProps, ReactNode } from "react";
|
|
5
5
|
import { Content, List, Trigger } from "@radix-ui/react-tabs";
|
|
6
6
|
//#region src/components/code-block/code-block.d.ts
|
|
@@ -79,7 +79,7 @@ type CodeBlockCodeProps = Omit<ComponentProps<"pre">, "children"> & {
|
|
|
79
79
|
/**
|
|
80
80
|
* The `CodeBlock` content. Renders pre-highlighted code from `mantleCode()`.
|
|
81
81
|
*
|
|
82
|
-
*
|
|
82
|
+
* Mantle's Vite plugin or server highlighter must set `value["~preHtml"]`.
|
|
83
83
|
* Runtime highlighting and runtime line decoration are intentionally unsupported.
|
|
84
84
|
*
|
|
85
85
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblockcode
|
|
@@ -148,7 +148,7 @@ declare const Title: ({ asChild, className, ref, ...props }: ComponentProps<"h3"
|
|
|
148
148
|
}) => import("react").JSX.Element;
|
|
149
149
|
type CodeBlockCopyButtonProps = Omit<ComponentProps<"button">, "children" | "type"> & SelfClosingWithAsChild & {
|
|
150
150
|
/**
|
|
151
|
-
* The accessible label for the copy button.
|
|
151
|
+
* The accessible label for the copy button. Mantle hides this label visually and announces it to screen readers, like the `alt` text on an `img` tag.
|
|
152
152
|
*
|
|
153
153
|
* @default "Copy code"
|
|
154
154
|
*/
|
|
@@ -163,8 +163,9 @@ type CodeBlockCopyButtonProps = Omit<ComponentProps<"button">, "children" | "typ
|
|
|
163
163
|
onCopyError?: (error: unknown) => void;
|
|
164
164
|
};
|
|
165
165
|
/**
|
|
166
|
-
* The
|
|
167
|
-
* to the clipboard
|
|
166
|
+
* The optional copy button. Copies the raw source of the mounted
|
|
167
|
+
* `CodeBlock.Code` to the clipboard — in a tabbed block, the active tab's code.
|
|
168
|
+
* Omit it to render the code block without a copy control.
|
|
168
169
|
*
|
|
169
170
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblockcopybutton
|
|
170
171
|
*
|
|
@@ -259,7 +260,7 @@ type CodeBlockTabListProps = Omit<ComponentProps<typeof List>, "asChild" | "loop
|
|
|
259
260
|
*
|
|
260
261
|
* Place this inside `CodeBlock.Header` and pair with `CodeBlock.TabContent`
|
|
261
262
|
* in `CodeBlock.Body` to conditionally render code based on the active tab.
|
|
262
|
-
*
|
|
263
|
+
* `CodeBlock.Root` owns the tab state via `defaultTab` / `activeTab` / `onActiveTabChange`.
|
|
263
264
|
*
|
|
264
265
|
* When the tabs exceed the available width they scroll horizontally with an edge
|
|
265
266
|
* fade (`scroll-fade-x`) instead of wrapping to a second row.
|
|
@@ -456,7 +457,9 @@ declare const CodeBlock: {
|
|
|
456
457
|
*/
|
|
457
458
|
readonly Code: typeof Code;
|
|
458
459
|
/**
|
|
459
|
-
* The optional copy button.
|
|
460
|
+
* The optional copy button. Copies the raw source of the mounted
|
|
461
|
+
* `CodeBlock.Code` to the clipboard — in a tabbed block, the active tab's
|
|
462
|
+
* code. Omit it to render the code block without a copy control.
|
|
460
463
|
*
|
|
461
464
|
* @see https://mantle.ngrok.com/components/data-display/code-block#codeblockcopybutton
|
|
462
465
|
*
|
package/dist/code-block.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./icon-lZ48P8Nn.js";import{t as r}from"./slot-DpNWVci8.js";import{t as i}from"./button-
|
|
1
|
+
import{t as e}from"./compose-refs-BdBMM9ga.js";import{t}from"./cx-IiQEAKf5.js";import{t as n}from"./icon-lZ48P8Nn.js";import{t as r}from"./slot-DpNWVci8.js";import{t as i}from"./button-CCkGqE1t.js";import{t as a}from"./use-copy-to-clipboard-CSyp4Zk0.js";import{t as o}from"./icons-CF1lbWtp.js";import{S as s,_ as c,a as l,b as u,c as d,d as f,f as p,g as m,h,i as g,l as _,m as v,n as y,o as b,p as x,r as S,s as C,t as w,u as T,v as E,y as D}from"./code-block-CIE0F2fu.js";import{CaretDownIcon as O}from"@phosphor-icons/react/CaretDown";import{createContext as k,useCallback as A,useContext as j,useEffect as M,useId as N,useLayoutEffect as P,useMemo as F,useRef as I,useState as L}from"react";import R from"tiny-invariant";import{jsx as z,jsxs as ee}from"react/jsx-runtime";import{CheckIcon as te}from"@phosphor-icons/react/Check";import{CopyIcon as ne}from"@phosphor-icons/react/Copy";import{FileTextIcon as re}from"@phosphor-icons/react/FileText";import{TerminalIcon as ie}from"@phosphor-icons/react/Terminal";import{Content as ae,List as oe,Root as se,Trigger as B}from"@radix-ui/react-tabs";function V(e){let t=-1;for(let n=0;n<e.length;n++){let r=e[n];if(r===`&`||r===`<`||r===`>`||r===`"`||r===`'`){t=n;break}}if(t===-1)return e;let n=e.slice(0,t);for(let r=t;r<e.length;r++){let t=e[r];switch(t){case`&`:n+=`&`;break;case`<`:n+=`<`;break;case`>`:n+=`>`;break;case`"`:n+=`"`;break;case`'`:n+=`'`;break;default:n+=t}}return n}const H=new WeakMap;function U(e){let t=new Set;if(e==null||e===``)return t;for(let n of e.split(` `))n!==``&&t.add(n);return t}function W(e){let t=H.get(e);if(t!=null&&ce(t))return t;let n=new Map,r=new WeakMap,i=e.querySelectorAll(`[data-fold-regions]`);for(let e=0;e<i.length;e+=1){let t=i[e];if(!(t instanceof HTMLElement))continue;let a=U(t.dataset.foldRegions);if(a.size!==0){r.set(t,a);for(let e of a){let r=n.get(e);r??(r=[],n.set(e,r)),r.push(t)}}}let a={regionToLines:n,lineToRegions:r};return H.set(e,a),a}function G(e){H.delete(e)}function K(e){G(e),e.removeAttribute(`data-folded-regions`)}function ce(e){for(let t of e.regionToLines.values()){if(t.length===0)continue;let e=t[0];if(e!=null)return e.isConnected}return!0}function le(e,t,n){let r=!1;for(let e of n)if(t.has(e)){r=!0;break}r?e.dataset.foldHidden=`true`:delete e.dataset.foldHidden}function ue(e){let t=e.dataset.foldLine;if(t==null||t===``)return!1;let n=e.closest(`[data-slot='code-block-code']`)?.querySelector(`code`);if(n==null)return!1;let r=U(n.getAttribute(`data-folded-regions`)),i=!r.has(t);i?r.add(t):r.delete(t),r.size===0?n.removeAttribute(`data-folded-regions`):n.setAttribute(`data-folded-regions`,[...r].join(` `)),e.setAttribute(`aria-expanded`,i?`false`:`true`);let{regionToLines:a,lineToRegions:o}=W(n),s=a.get(t);if(s!=null)for(let e of s){let t=o.get(e);t!=null&&le(e,r,t)}return!0}function de(e){let t=e=>{let t=e.target;if(!(t instanceof Element))return;let n=t.closest(`.mantle-code-fold-toggle`);n instanceof HTMLButtonElement&&ue(n)};return e.addEventListener(`click`,t),()=>{e.removeEventListener(`click`,t)}}const q=k(null);function J(){let e=j(q);return R(e!=null,`CodeBlock subcomponents must be rendered within a <CodeBlock.Root>.`),e}const fe=({asChild:e=!1,className:n,defaultTab:i,activeTab:a,onActiveTabChange:o,ref:s,...c})=>{let l=I(``),[u,d]=L(!1),[f,p]=L(!1),[m,h]=L(void 0),g=A(e=>{h(t=>(R(t==null,`You can only render a single CodeBlock.Code within a CodeBlock.`),e))},[]),_=A(e=>{h(t=>{R(t===e,`You can only render a single CodeBlock.Code within a CodeBlock.`)})},[]),v=F(()=>({codeId:m,copyTextRef:l,hasCodeExpander:u,isCodeExpanded:f,registerCodeId:g,setHasCodeExpander:d,setIsCodeExpanded:p,unregisterCodeId:_}),[m,u,f,g,_]),y=i!=null||a!=null,b=z(e?r:`div`,{"data-slot":`code-block`,className:t(`text-mono w-full overflow-hidden rounded-md border border-gray-300 bg-base font-mono`,`[&_svg]:shrink-0`,n),ref:s,...c});return z(q.Provider,{value:v,children:y?z(se,{asChild:!0,defaultValue:i,value:a,onValueChange:o,children:b}):b})},pe=({asChild:e=!1,className:n,ref:i,...a})=>z(e?r:`div`,{"data-slot":`code-block-body`,className:t(`relative`,n),ref:i,...a}),me=/SHIKI_VAL_(\d+)/g;function he(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}const Y=new Map;function ge(e){if(e==null||e.length===0)return me;let t=Y.get(e);return t??(Y.size>=500&&Y.clear(),t=RegExp(`${he(e)}(\\d+)__`,`g`),Y.set(e,t)),t}function X(e,t,n,r){if(n==null){if(!e.includes(`SHIKI_VAL_`))return e}else if(!e.includes(n))return e;return e.replaceAll(ge(n),(e,n)=>{let i=Number.parseInt(n,10);return Number.isNaN(i)||i<0||i>=t.length?e:r(t[i])})}function _e(e,t,n){return X(e,t,n,e=>V(String(e)))}function ve(e,t,n){return X(e,t,n,e=>String(e))}const ye=({className:n,style:r,value:i,ref:a,...o})=>{let s=N(),c=I(null),{copyTextRef:l,hasCodeExpander:u,isCodeExpanded:d,registerCodeId:f,unregisterCodeId:p}=J(),{language:m,code:h,"~preValToken":g,"~preVals":_,"~highlightLines":v,"~lineNumberStart":y,"~preHtml":b,"~showLineNumbers":x}=i,S=v,C=y??1,w=x??!1,T=F(()=>_!=null&&_.length>0?ve(h,_,g):h,[g,_,h]);P(()=>{l.current=T},[l,T]),M(()=>(f(s),()=>{p(s)}),[s,f,p]);let E=F(()=>{if(b!=null)return _!=null&&_.length>0?_e(b,_,g):b},[b,g,_]);M(()=>{let e=c.current;if(e==null)return;let t=e.querySelector(`code`);return t!=null&&K(t),de(e)},[E]);let D=E!=null,O=E??V(T),k=F(()=>({__html:O}),[O]);return z(`pre`,{"data-slot":`code-block-code`,"aria-expanded":u?d:void 0,className:t(`scrollbar overflow-x-auto overflow-y-hidden py-4`,!D&&`pr-14`,`data-[mantle-line-numbers~='false']:pl-4`,`text-mono m-0 font-mono outline-hidden`,`aria-collapsed:max-h-[13.6rem]`,n),"data-highlighted":D?`true`:`false`,"data-lang":m,"data-mantle-highlight-lines":D&&S!=null&&S.length>0?S.join(`,`):void 0,"data-mantle-line-number-start":D&&w?String(C):`1`,"data-mantle-line-numbers":D&&w?`true`:`false`,id:s,ref:e(c,a),style:{...r,"--mantle-line-number-start":String(C),tabSize:2,MozTabSize:2},...o,children:z(`code`,{className:`text-size-inherit block min-w-full w-max`,dangerouslySetInnerHTML:k})})},be=({asChild:e=!1,className:n,ref:i,...a})=>z(e?r:`div`,{"data-slot":`code-block-header`,className:t(`flex items-center gap-1 border-b border-gray-300 bg-base px-4 py-2 text-gray-700`,n),ref:i,...a}),xe=({asChild:e=!1,className:n,ref:i,...a})=>z(e?r:`h3`,{"data-slot":`code-block-title`,ref:i,className:t(`m-0 font-sans text-xs font-medium`,n),...a}),Se=({className:e,label:n=`Copy code`,onCopy:r,onCopyError:o,onClick:s,ref:c,...l})=>{let{copyTextRef:u}=J(),d=a(),[f,p]=L(!1),m=I(void 0);return M(()=>()=>{m.current!=null&&clearTimeout(m.current)},[]),z(`span`,{"data-slot":`code-block-copy-button`,className:`absolute right-3 top-3 z-10 inline-flex size-7 items-center justify-center rounded-[var(--icon-button-border-radius,0.375rem)] bg-base`,children:z(i,{type:`button`,appearance:`ghost`,intent:`neutral`,size:`sm`,label:n,icon:z(f?te:ne,{}),className:t(`bg-base not-disabled:hover:bg-neutral-500/15`,e),ref:c,onClick:async e=>{try{if(s?.(e),e.defaultPrevented){m.current!=null&&clearTimeout(m.current);return}let t=u.current;await d(t),r?.(t),p(!0),m.current!=null&&clearTimeout(m.current),m.current=setTimeout(()=>{p(!1)},2e3)}catch(e){o?.(e)}},...l})})},Z=({asChild:e=!1,className:i,onClick:a,ref:o,...s})=>{let{codeId:c,isCodeExpanded:l,setIsCodeExpanded:u,setHasCodeExpander:d}=J();return M(()=>(d(!0),()=>{d(!1)}),[d]),ee(e?r:`button`,{...s,"data-slot":`code-block-expander-button`,"aria-controls":c,"aria-expanded":l,className:t(`flex w-full items-center justify-center gap-0.5 border-t border-gray-300 bg-base px-4 py-2 font-sans text-gray-700 hover:bg-base-hover`,i),ref:o,type:`button`,onClick:e=>{u(e=>!e),a?.(e)},children:[l?`Show less`:`Show more`,` `,z(n,{svg:z(O,{weight:`bold`}),className:t(`size-4`,l&&`rotate-180`,`transition-all duration-150`)})]})};function Ce({className:e,preset:r,svg:i,...a}){let s=i;if(r!=null)switch(r){case`file`:s=z(re,{weight:`fill`});break;case`cli`:s=z(ie,{weight:`fill`});break;case`traffic-policy`:s=z(o,{})}return z(n,{"data-slot":`code-block-icon`,className:t(`size-5`,e),svg:s,...a})}const we={Root:fe,Body:pe,Code:ye,CopyButton:Se,ExpanderButton:Z,Header:be,Icon:Ce,TabContent:e=>z(ae,{"data-slot":`code-block-tab-content`,...e}),TabList:({className:e,ref:n,...r})=>z(oe,{"data-slot":`code-block-tab-list`,className:t(`scroll-fade-x flex min-w-0 items-center gap-1 overflow-x-auto overscroll-x-none`,`-m-1 p-1`,e),ref:n,...r}),TabTrigger:({className:e,ref:n,...r})=>z(B,{"data-slot":`code-block-tab-trigger`,className:t(`shrink-0 cursor-pointer rounded px-1.5 py-0.5 font-sans text-xs font-medium whitespace-nowrap`,`text-gray-600 outline-hidden`,`hover:text-gray-900`,`data-[state=active]:bg-neutral-500/15 data-[state=active]:text-strong`,`focus-visible:ring-focus-accent focus-visible:ring-4`,e),ref:n,...r}),Title:xe},Q=`var(--shiki-foreground)`;function Te(e){return e.replace(/[&<]/g,e=>e===`&`?`&`:`<`)}function Ee(e){return e===` `||e===` `||e===`
|
|
2
2
|
`||e===`\r`||e===`{`||e===`}`||e===`[`||e===`]`||e===`:`||e===`,`||e===`"`}function De(e,t,n){let r=e.length,i=[],a=`"`,o=t+1;for(;o<r;){let t=e[o];if(t===`\\`){let t=e[o+1]===`u`&&/^[0-9a-fA-F]{4}$/.test(e.slice(o+2,o+6))?6:2;a!==``&&(i.push({text:a,isEscape:!1}),a=``),i.push({text:e.slice(o,o+t),isEscape:!0}),o+=t;continue}if(t===`"`){a+=`"`,o+=1;break}a+=t,o+=1}a!==``&&i.push({text:a,isEscape:!1});let s=o;for(;s<r;){let t=e[s];if(t===` `||t===` `||t===`
|
|
3
3
|
`||t===`\r`){s+=1;continue}break}let c=e[s]===`:`?`var(--shiki-token-keyword)`:`var(--shiki-token-string-expression)`;for(let e of i)n(e.text,e.isEscape?`var(--shiki-token-escape, var(--shiki-token-constant))`:c);return o}function Oe(e){for(let t=0;t<e.length;t+=1){let n=e[t];if(n!=null&&n.color==null){let r=Q;for(let n=t+1;n<e.length;n+=1){let t=e[n];if(t!=null&&t.color!=null){r=t.color;break}}n.color=r}}let t=``,n=``,r=null,i=()=>{r!=null&&(t+=`<span style="color:${r}">${Te(n)}</span>`),n=``,r=null};for(let t of e)t!=null&&(t.color===r?n+=t.text:(i(),n=t.text,r=t.color));return i(),`<span class="line">${t}</span>`}function $(e){let t=[[]],n=t[0]??[],r=e.length,i=0,a=(e,t)=>{n.push({text:e,color:t})};for(;i<r;){let o=e[i];if(o===`
|
|
4
4
|
`||o===`\r`){o===`\r`&&e[i+1]===`
|
|
5
5
|
`&&(i+=1);let r=[];t.push(r),n=r,i+=1;continue}if(o===` `||o===` `){let t=i+1;for(;t<r;){let n=e[t];if(n!==` `&&n!==` `)break;t+=1}a(e.slice(i,t),null),i=t;continue}if(o===`{`||o===`}`||o===`[`||o===`]`){a(o,Q),i+=1;continue}if(o===`:`||o===`,`){a(o,`var(--shiki-token-punctuation)`),i+=1;continue}if(o===`"`){i=De(e,i,a);continue}let s=i+1;for(;s<r&&!Ee(e[s]??``);)s+=1;a(e.slice(i,s),`var(--shiki-token-constant)`),i=s}return t.map(Oe).join(`
|
|
6
|
-
`)}function ke(e){let t=new WeakSet;try{return JSON.stringify(e,(e,n)=>{if(typeof n==`bigint`)return n.toString();if(typeof n==`object`&&n){if(t.has(n))return`[Circular]`;t.add(n)}return n},2)??``}catch{try{return String(e)}catch{return``}}}function Ae(e,{showLineNumbers:t=!1,foldable:n=!0}={}){let r=ke(e)
|
|
6
|
+
`)}function ke(e){let t=new WeakSet;try{return JSON.stringify(e,(e,n)=>{if(typeof n==`bigint`)return n.toString();if(typeof n==`object`&&n){if(t.has(n))return`[Circular]`;t.add(n)}return n},2)??``}catch{try{return String(e)}catch{return``}}}function Ae(e,{showLineNumbers:t=!1,foldable:n=!0}={}){let r=ke(e),i=c({html:$(r),foldableRanges:n?E(r):void 0,showLineNumbers:t});return u({language:`json`,code:r,preHtml:i,showLineNumbers:t})}function je(e,t){let n=1;if(n>t)return!0;for(let r=0;r<e.length;r++)if(e[r]===`
|
|
7
7
|
`&&(n+=1,n>t))return!0;return!1}export{we as CodeBlock,h as computeFoldRanges,E as computeJsonFoldRanges,u as createMantleCodeBlockValue,c as decorateHighlightedHtml,w as defaultMeta,V as escapeHtml,D as finalizeFoldRanges,m as foldStrategyFor,je as hasMoreThanNLines,x as inferIndentation,v as isIndentation,_ as isSupportedLanguage,Ae as jsonCodeBlockValue,$ as jsonToShikiHtml,s as mantleCode,p as normalizeIndentation,y as normalizeValue,b as parseCodeBlockHighlightLines,C as parseCodeBlockLineNumberStart,d as parseCodeBlockShowLineNumbers,T as parseLanguage,S as parseMetastring,g as resolvePreRenderedCodeBlockProps,f as supportedLanguages,l as tokenizeMetastring};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as FoldStrategy, B as computeJsonFoldRanges, C as Indentation, D as FoldExplanation, E as ComputeFoldRangesInput, F as isSupportedLanguage, H as finalizeFoldRanges, I as parseLanguage, L as supportedLanguages, M as computeFoldRanges, N as foldStrategyFor, O as FoldLine, P as SupportedLanguage, R as DecorateHighlightedHtmlInput, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, b as defaultShowLineNumbers, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, j as FoldToken, k as FoldScope, m as parseCodeBlockHighlightLines, p as tokenizeMetastring, u as normalizeValue, w as inferIndentation, z as decorateHighlightedHtml } from "./code-block-
|
|
1
|
+
import { A as FoldStrategy, B as computeJsonFoldRanges, C as Indentation, D as FoldExplanation, E as ComputeFoldRangesInput, F as isSupportedLanguage, H as finalizeFoldRanges, I as parseLanguage, L as supportedLanguages, M as computeFoldRanges, N as foldStrategyFor, O as FoldLine, P as SupportedLanguage, R as DecorateHighlightedHtmlInput, S as normalizeIndentation, T as isIndentation, U as LineRange, V as FoldableRange, b as defaultShowLineNumbers, g as parseCodeBlockShowLineNumbers, h as parseCodeBlockLineNumberStart, j as FoldToken, k as FoldScope, m as parseCodeBlockHighlightLines, p as tokenizeMetastring, u as normalizeValue, w as inferIndentation, z as decorateHighlightedHtml } from "./code-block-CZWPrV4k.js";
|
|
2
2
|
export { type ComputeFoldRangesInput, type DecorateHighlightedHtmlInput, type FoldExplanation, type FoldLine, type FoldScope, type FoldStrategy, type FoldToken, type FoldableRange, type Indentation, type LineRange, type SupportedLanguage, computeFoldRanges, computeJsonFoldRanges, decorateHighlightedHtml, defaultShowLineNumbers, finalizeFoldRanges, foldStrategyFor, inferIndentation, isIndentation, isSupportedLanguage, normalizeIndentation, normalizeValue, parseCodeBlockHighlightLines, parseCodeBlockLineNumberStart, parseCodeBlockShowLineNumbers, parseLanguage, supportedLanguages, tokenizeMetastring };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,n as l,o as u,p as d,s as f,u as p,v as m,x as h,y as g}from"./code-block-
|
|
1
|
+
import{_ as e,a as t,c as n,d as r,f as i,g as a,h as o,l as s,m as c,n as l,o as u,p as d,s as f,u as p,v as m,x as h,y as g}from"./code-block-CIE0F2fu.js";export{o as computeFoldRanges,m as computeJsonFoldRanges,e as decorateHighlightedHtml,h as defaultShowLineNumbers,g as finalizeFoldRanges,a as foldStrategyFor,d as inferIndentation,c as isIndentation,s as isSupportedLanguage,i as normalizeIndentation,l as normalizeValue,u as parseCodeBlockHighlightLines,f as parseCodeBlockLineNumberStart,n as parseCodeBlockShowLineNumbers,p as parseLanguage,r as supportedLanguages,t as tokenizeMetastring};
|
package/dist/combobox.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as WithAsChild } from "./as-child-D23mGo4f.js";
|
|
2
2
|
import { o as WithValidation } from "./field-7QeiTFwl.js";
|
|
3
|
-
import { n as Separator } from "./separator-
|
|
3
|
+
import { n as Separator } from "./separator-CNDs98Dv.js";
|
|
4
4
|
import { ComponentProps } from "react";
|
|
5
5
|
import * as Primitive from "@ariakit/react";
|
|
6
6
|
//#region src/components/combobox/combobox.d.ts
|
|
7
7
|
type ComboboxProps = Primitive.ComboboxProviderProps;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* The outermost part of a combobox. It owns the ariakit store that holds the query text, the open state, and the selection.
|
|
10
10
|
*
|
|
11
11
|
* Use Combobox for a list of options where the user types to filter — large static lists,
|
|
12
12
|
* async/server-side data, or any single-select where search is helpful. For very small
|
|
@@ -32,7 +32,7 @@ type ComboboxProps = Primitive.ComboboxProviderProps;
|
|
|
32
32
|
declare const Root: ({ children, ...props }: ComboboxProps) => import("react").JSX.Element;
|
|
33
33
|
type ComboboxInputProps = Omit<Primitive.ComboboxProps, "render"> & WithValidation;
|
|
34
34
|
/**
|
|
35
|
-
* Renders a combobox input element
|
|
35
|
+
* Renders a combobox input element for filtering a list of items.
|
|
36
36
|
*
|
|
37
37
|
* @see https://mantle.ngrok.com/components/forms/combobox#comboboxinput
|
|
38
38
|
*
|
|
@@ -93,7 +93,7 @@ type ComboboxGroupProps = Omit<Primitive.ComboboxGroupProps, "render"> & WithAsC
|
|
|
93
93
|
/**
|
|
94
94
|
* Renders a group for Combobox.Item elements.
|
|
95
95
|
*
|
|
96
|
-
* Optionally, a Combobox.GroupLabel
|
|
96
|
+
* Optionally, render a Combobox.GroupLabel as a child to label the group.
|
|
97
97
|
*
|
|
98
98
|
* You should only reach for this component when it semantically makes sense to group items together, such as when a label is needed.
|
|
99
99
|
*
|
|
@@ -150,7 +150,7 @@ type ComboboxItemValueProps = Omit<Primitive.ComboboxItemValueProps<"span">, "re
|
|
|
150
150
|
* Should only be used as a child of Combobox.Item.
|
|
151
151
|
* The item value is automatically set to the value of the closest Combobox.Item component's value prop.
|
|
152
152
|
* The user input value is automatically set to the combobox store's value state.
|
|
153
|
-
*
|
|
153
|
+
* Passing `value` or `userValue` overrides them, respectively.
|
|
154
154
|
*
|
|
155
155
|
* @see https://mantle.ngrok.com/components/forms/combobox#comboboxitemvalue
|
|
156
156
|
*
|
|
@@ -198,8 +198,7 @@ declare const ComboboxSeparatorComponent: ({ className, ref, ...props }: Compone
|
|
|
198
198
|
/**
|
|
199
199
|
* Fill in a React input field with autocomplete & autosuggest functionalities.
|
|
200
200
|
* Choose from a list of suggested values with full keyboard support.
|
|
201
|
-
*
|
|
202
|
-
* ariakit Combobox.
|
|
201
|
+
* It follows the WAI-ARIA Combobox Pattern and builds on the ariakit Combobox.
|
|
203
202
|
*
|
|
204
203
|
* Use Combobox for a list of options where the user types to filter — large static lists,
|
|
205
204
|
* async/server-side data, or any single-select where search is helpful. For very small
|
|
@@ -240,7 +239,7 @@ declare const ComboboxSeparatorComponent: ({ className, ref, ...props }: Compone
|
|
|
240
239
|
*/
|
|
241
240
|
declare const Combobox: {
|
|
242
241
|
/**
|
|
243
|
-
*
|
|
242
|
+
* The outermost part of a combobox. It owns the ariakit store that holds the query text, the open state, and the selection.
|
|
244
243
|
*
|
|
245
244
|
* Use Combobox for a list of options where the user types to filter — large static lists,
|
|
246
245
|
* async/server-side data, or any single-select where search is helpful. For very small
|
|
@@ -326,7 +325,7 @@ declare const Combobox: {
|
|
|
326
325
|
*/
|
|
327
326
|
readonly GroupLabel: typeof GroupLabel;
|
|
328
327
|
/**
|
|
329
|
-
* Renders a combobox input element
|
|
328
|
+
* Renders a combobox input element for filtering a list of items.
|
|
330
329
|
*
|
|
331
330
|
* @see https://mantle.ngrok.com/components/forms/combobox#comboboxinput
|
|
332
331
|
*
|