@lostgradient/cinder 0.7.0 → 0.9.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.
- package/CHANGELOG.md +23 -0
- package/README.md +7 -2
- package/components.json +59 -15
- package/dist/components/_internal/command-list-context.d.ts +3 -3
- package/dist/components/_internal/create-command-list-state.svelte.d.ts +11 -11
- package/dist/components/access-gate/index.js +201 -126
- package/dist/components/approval-card/approval-card-actions.svelte.d.ts +16 -0
- package/dist/components/approval-card/approval-card-state.d.ts +65 -0
- package/dist/components/approval-card/approval-card.css +269 -92
- package/dist/components/approval-card/approval-card.schema.js +10 -31
- package/dist/components/approval-card/approval-card.svelte.d.ts +3 -3
- package/dist/components/approval-card/approval-card.types.d.ts +14 -28
- package/dist/components/approval-card/index.d.ts +1 -1
- package/dist/components/approval-card/index.js +4268 -2884
- package/dist/components/card/card.css +5 -0
- package/dist/components/card/card.schema.js +2 -2
- package/dist/components/card/card.types.d.ts +2 -2
- package/dist/components/card/index.js +2 -1
- package/dist/components/chat/chat.schema.js +48 -1
- package/dist/components/chat/chat.svelte.d.ts +6 -2
- package/dist/components/chat/chat.types.d.ts +37 -0
- package/dist/components/chat/container/chat.svelte.d.ts +6 -2
- package/dist/components/chat/index.d.ts +3 -3
- package/dist/components/chat/index.js +1099 -4865
- package/dist/components/chat/input/chat-attachment-serialization.d.ts +9 -0
- package/dist/components/chat/input/chat-input.svelte.d.ts +24 -0
- package/dist/components/chat/input/index.d.ts +1 -0
- package/dist/components/chat-composer-popover/chat-composer-popover-filter.d.ts +11 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.css +7 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.css.d.ts +1 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.schema.d.ts +3 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.schema.js +150 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.svelte.d.ts +46 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.types.d.ts +77 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.variables.d.ts +2 -0
- package/dist/components/chat-composer-popover/chat-composer-popover.variables.js +61 -0
- package/dist/components/chat-composer-popover/index.d.ts +6 -0
- package/dist/components/chat-composer-popover/index.js +3285 -0
- package/dist/components/chat-conversation-header/index.js +1627 -5600
- package/dist/components/chat-conversation-list/index.js +15 -3988
- package/dist/components/code-block/code-block.schema.js +5 -1
- package/dist/components/code-block/code-block.types.d.ts +6 -0
- package/dist/components/code-block/index.js +4 -4
- package/dist/components/command-item/index.js +7 -6
- package/dist/components/command-menu/command-menu.schema.js +5 -1
- package/dist/components/command-menu/command-menu.types.d.ts +2 -0
- package/dist/components/command-menu/index.js +48 -19
- package/dist/components/command-palette/index.js +40 -14
- package/dist/components/event-stream-viewer/index.js +44 -44
- package/dist/components/experimental/json-viewer/index.js +44 -44
- package/dist/components/json-schema-editor/index.js +5 -2
- package/dist/components/json-viewer/index.js +44 -44
- package/dist/components/json-viewer/json-viewer.css +10 -6
- package/dist/components/navigation-bar/index.js +44 -6
- package/dist/components/payload-inspector/index.d.ts +1 -1
- package/dist/components/payload-inspector/index.js +306 -1422
- package/dist/components/payload-inspector/payload-inspector.css +15 -75
- package/dist/components/payload-inspector/payload-inspector.schema.js +5 -41
- package/dist/components/payload-inspector/payload-inspector.svelte.d.ts +5 -5
- package/dist/components/payload-inspector/payload-inspector.types.d.ts +10 -56
- package/dist/components/sidebar/index.js +6 -3
- package/dist/components/sidebar/sidebar.css +4 -0
- package/dist/components/tab/index.js +5 -2
- package/dist/components/tab/tab.schema.js +7 -3
- package/dist/components/tab/tab.svelte.d.ts +2 -1
- package/dist/components/tab/tab.types.d.ts +8 -2
- package/dist/components/tabs/index.js +5 -2
- package/dist/components/team-section/index.js +2 -1
- package/dist/components/testimonial-section/index.js +2 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +24169 -27821
- package/dist/server/components/access-gate/index.js +2 -1
- package/dist/server/components/accordion/index.js +2 -2
- package/dist/server/components/alert-dialog/index.js +2 -2
- package/dist/server/components/approval-card/index.js +15 -19
- package/dist/server/components/autocomplete/index.js +7 -7
- package/dist/server/components/avatar-group/index.js +5 -5
- package/dist/server/components/button-group/index.js +3 -5
- package/dist/server/components/card/index.js +2 -2
- package/dist/server/components/chat/index.js +14 -11
- package/dist/server/components/chat-composer-popover/index.js +26 -0
- package/dist/server/components/chat-conversation-header/index.js +9 -10
- package/dist/server/components/chat-conversation-list/index.js +4 -5
- package/dist/server/components/checkbox/index.js +3 -3
- package/dist/server/components/choice-grid/index.js +2 -2
- package/dist/server/components/code-block/index.js +2 -2
- package/dist/server/components/color-field/index.js +3 -3
- package/dist/server/components/combobox/index.js +6 -6
- package/dist/server/components/command-item/index.js +5 -3
- package/dist/server/components/command-menu/index.js +6 -4
- package/dist/server/components/command-palette/index.js +2 -2
- package/dist/server/components/confirm-dialog/index.js +2 -2
- package/dist/server/components/context-menu/index.js +5 -5
- package/dist/server/components/data-table/index.js +5 -5
- package/dist/server/components/date-picker/index.js +6 -6
- package/dist/server/components/date-range-field/index.js +7 -7
- package/dist/server/components/description-list/index.js +3 -5
- package/dist/server/components/diff-viewer/index.js +7 -7
- package/dist/server/components/drawer/index.js +3 -3
- package/dist/server/components/dropdown/index.js +4 -4
- package/dist/server/components/event-stream-viewer/index.js +2 -2
- package/dist/server/components/experimental/json-viewer/index.js +2 -2
- package/dist/server/components/faceted-filter-bar/index.js +1 -1
- package/dist/server/components/hover-card/index.js +1 -1
- package/dist/server/components/input/index.js +3 -3
- package/dist/server/components/json-schema-editor/index.js +22 -22
- package/dist/server/components/json-viewer/index.js +2 -2
- package/dist/server/components/markdown-editor/index.js +13 -13
- package/dist/server/components/modal/index.js +1 -1
- package/dist/server/components/multi-select/index.js +1 -1
- package/dist/server/components/navigation-bar/index.js +1 -1
- package/dist/server/components/newsletter-section/index.js +3 -3
- package/dist/server/components/payload-inspector/index.js +4 -16
- package/dist/server/components/popover/index.js +5 -5
- package/dist/server/components/review-editor/index.js +25 -25
- package/dist/server/components/run-step-timeline/index.js +2 -2
- package/dist/server/components/schema-form/index.js +4 -4
- package/dist/server/components/secret-value-field/index.js +3 -5
- package/dist/server/components/segment/index.js +3 -3
- package/dist/server/components/segmented-control/index.js +4 -4
- package/dist/server/components/selection-popover/index.js +4 -4
- package/dist/server/components/sheet/index.js +2 -2
- package/dist/server/components/sidebar/index.js +3 -3
- package/dist/server/components/tab/index.js +2 -2
- package/dist/server/components/table/index.js +3 -3
- package/dist/server/components/tabs/index.js +4 -4
- package/dist/server/components/tag-input/index.js +3 -3
- package/dist/server/components/team-section/index.js +8 -8
- package/dist/server/components/testimonial-section/index.js +2 -2
- package/dist/server/components/toggle/index.js +2 -2
- package/dist/server/components/tooltip/index.js +1 -1
- package/dist/server/index.js +160 -149
- package/dist/server/{index.server-cbtg8rq5.js → index.server-0atyznp7.js} +5 -5
- package/dist/server/{index.server-20y4mdhm.js → index.server-0chhpkg7.js} +40 -14
- package/dist/server/{index.server-ecm1vs3g.js → index.server-1nq7z1qw.js} +1 -1
- package/dist/server/{index.server-jync915v.js → index.server-2dga5yzr.js} +25 -25
- package/dist/server/index.server-2hqrv7ca.js +9 -0
- package/dist/server/{index.server-qwknp759.js → index.server-2qj6s2mh.js} +7 -4
- package/dist/server/{index.server-pt8b65mt.js → index.server-38aywdk1.js} +1 -1
- package/dist/server/{index.server-rermas0k.js → index.server-47v2fhp4.js} +4 -4
- package/dist/server/{index.server-9j5sym59.js → index.server-4x91gzy1.js} +2 -2
- package/dist/server/{index.server-q48q15g7.js → index.server-4y2jtvv1.js} +4 -2
- package/dist/server/{index.server-zeqv7nrz.js → index.server-5tf22d6e.js} +43 -6
- package/dist/server/index.server-67qgdypc.js +9 -0
- package/dist/server/{index.server-9jete4xx.js → index.server-6sh11ap6.js} +4 -4
- package/dist/server/{index.server-4ztq565m.js → index.server-85p4ydph.js} +1 -1
- package/dist/server/{index.server-4nk7gy0q.js → index.server-894t97kv.js} +1 -1
- package/dist/server/{index.server-1vscnped.js → index.server-8dt36sdm.js} +2 -1
- package/dist/server/{index.server-bfsbp9dz.js → index.server-8xvc73zh.js} +4 -4
- package/dist/server/{index.server-cvnw3hw9.js → index.server-9kz37z89.js} +1 -1
- package/dist/server/{index.server-kc1k02tk.js → index.server-9ykk1kbg.js} +1 -1
- package/dist/server/{index.server-g789yep6.js → index.server-aqethy0w.js} +2 -2
- package/dist/server/{index.server-wc9aggfz.js → index.server-bmxbsk4y.js} +7 -7
- package/dist/server/{index.server-j3ddzcaa.js → index.server-c6pe4kaf.js} +6 -6
- package/dist/server/{index.server-q89dz8h1.js → index.server-d3pqthtp.js} +4 -3
- package/dist/server/{index.server-qfa2rxzx.js → index.server-dg83ke3k.js} +3 -5
- package/dist/server/{index.server-jk4rx4aa.js → index.server-dmmvwy6p.js} +1 -1
- package/dist/server/{index.server-hcfnae5y.js → index.server-dwwqssey.js} +4 -4
- package/dist/server/{index.server-e8x1hgw6.js → index.server-dz1r9xw5.js} +4 -4
- package/dist/server/{index.server-wm7mk5kw.js → index.server-ez5hp0ya.js} +1 -1
- package/dist/server/{index.server-ejyf7e48.js → index.server-fy068yne.js} +1 -1
- package/dist/server/{index.server-wc8dbm5e.js → index.server-g95bk8rc.js} +4 -2
- package/dist/server/index.server-gkazv439.js +576 -0
- package/dist/server/{index.server-dp9j2kkr.js → index.server-h0cvwvhy.js} +1 -1
- package/dist/server/{index.server-pacrqvyz.js → index.server-h90pjrez.js} +1 -1
- package/dist/server/{index.server-p8d04em5.js → index.server-hcsd5gdb.js} +6 -2
- package/dist/server/{index.server-n39drzes.js → index.server-hpeavvnq.js} +1 -1
- package/dist/server/{index.server-1p3patnj.js → index.server-hx91ng7z.js} +1 -1
- package/dist/server/{index.server-jtj3r53y.js → index.server-jgb8yh5k.js} +1 -1
- package/dist/server/{index.server-w1g5q9j9.js → index.server-jtgw9d23.js} +4 -2
- package/dist/server/{index.server-mehav5vs.js → index.server-jxg42jpz.js} +4 -4
- package/dist/server/{index.server-hd8gpehd.js → index.server-jxseyx33.js} +1 -1
- package/dist/server/{index.server-kg2sepsr.js → index.server-krqvnt6p.js} +14 -15
- package/dist/server/{index.server-0e1m3agz.js → index.server-ks49bprh.js} +1 -1
- package/dist/server/{index.server-f0hma3jp.js → index.server-kt0ncrqs.js} +1 -1
- package/dist/server/index.server-m0ezemav.js +170 -0
- package/dist/server/index.server-m191rm44.js +79 -0
- package/dist/server/{index.server-f23vtaw4.js → index.server-marjz8ps.js} +6 -6
- package/dist/server/index.server-mqt1ngqw.js +250 -0
- package/dist/server/{index.server-s9khh4ry.js → index.server-mzzb7dnm.js} +3 -5
- package/dist/server/{index.server-z721a5gp.js → index.server-n82rcv0m.js} +4 -4
- package/dist/server/{index.server-rhhmdxtz.js → index.server-np3c7kx0.js} +4 -4
- package/dist/server/{index.server-hpcs7tmh.js → index.server-p56xxef1.js} +1 -1
- package/dist/server/{index.server-w83kmcrx.js → index.server-pag862vz.js} +10 -10
- package/dist/server/{index.server-gxf0d1p5.js → index.server-q7w4jw89.js} +2 -2
- package/dist/server/{index.server-bvmwnjx6.js → index.server-qh9qzd5t.js} +186 -23
- package/dist/server/{index.server-pxg74pyp.js → index.server-qk1h0n02.js} +4 -4
- package/dist/server/{index.server-sh2rxejg.js → index.server-qke3ekjt.js} +1 -1
- package/dist/server/{index.server-73x2d3j3.js → index.server-rbpvcrr3.js} +1 -1
- package/dist/server/{index.server-8cxs4kya.js → index.server-rga8sc7j.js} +41 -44
- package/dist/server/{index.server-e3fnv1g6.js → index.server-sedjxt36.js} +5 -5
- package/dist/server/{index.server-pen9pxt6.js → index.server-sf3nk3j2.js} +2 -2
- package/dist/server/{index.server-7fp0epev.js → index.server-veastatv.js} +4 -4
- package/dist/server/{index.server-jeqg2d22.js → index.server-xeqtpv61.js} +1 -1
- package/dist/server/{index.server-9s4na701.js → index.server-xjnge1yw.js} +4 -4
- package/dist/server/index.server-xtjjmsyq.js +315 -0
- package/dist/server/{index.server-hhxjaeen.js → index.server-xz99aed4.js} +4 -4
- package/dist/server/{index.server-vne4rzfa.js → index.server-y4n8vc08.js} +1 -1
- package/dist/server/{index.server-5d01cn4f.js → index.server-y83kqayt.js} +4 -4
- package/dist/server/{index.server-1nh09ck7.js → index.server-yhzydqxe.js} +5 -5
- package/dist/server/{index.server-atjc1qcq.js → index.server-yz4k36cw.js} +1 -1
- package/dist/server/{index.server-w6k62afr.js → index.server-ze1ymmbw.js} +2 -2
- package/dist/server/{index.server-914v805w.js → index.server-zgd1g8mk.js} +1 -1
- package/dist/server/{index.server-aeexcxdp.js → index.server-zh3r8vfd.js} +1 -1
- package/dist/server/{index.server-10jb2jzm.js → index.server-zsjf8enc.js} +4 -4
- package/package.json +42 -6
- package/src/components/_internal/command-list-context.ts +3 -3
- package/src/components/_internal/create-command-list-state.svelte.ts +39 -13
- package/src/components/approval-card/approval-card-actions.svelte +168 -0
- package/src/components/approval-card/approval-card-state.ts +152 -1
- package/src/components/approval-card/approval-card.css +269 -92
- package/src/components/approval-card/approval-card.examples.json +3 -3
- package/src/components/approval-card/approval-card.schema.json +9 -30
- package/src/components/approval-card/approval-card.schema.ts +13 -31
- package/src/components/approval-card/approval-card.svelte +176 -470
- package/src/components/approval-card/approval-card.types.ts +15 -28
- package/src/components/approval-card/index.ts +1 -0
- package/src/components/card/card.css +5 -0
- package/src/components/card/card.schema.json +1 -1
- package/src/components/card/card.schema.ts +1 -1
- package/src/components/card/card.svelte +1 -0
- package/src/components/card/card.types.ts +2 -2
- package/src/components/chat/chat.schema.json +40 -0
- package/src/components/chat/chat.schema.ts +49 -0
- package/src/components/chat/chat.svelte +20 -0
- package/src/components/chat/chat.types.ts +38 -0
- package/src/components/chat/container/chat.svelte +82 -3
- package/src/components/chat/index.ts +15 -3
- package/src/components/chat/input/chat-attachment-serialization.ts +63 -0
- package/src/components/chat/input/chat-input.svelte +30 -3
- package/src/components/chat/input/index.ts +5 -0
- package/src/components/chat-composer-popover/chat-composer-popover-filter.ts +68 -0
- package/src/components/chat-composer-popover/chat-composer-popover.css +7 -0
- package/src/components/chat-composer-popover/chat-composer-popover.examples.json +13 -0
- package/src/components/chat-composer-popover/chat-composer-popover.schema.json +90 -0
- package/src/components/chat-composer-popover/chat-composer-popover.schema.ts +95 -0
- package/src/components/chat-composer-popover/chat-composer-popover.svelte +234 -0
- package/src/components/chat-composer-popover/chat-composer-popover.types.ts +88 -0
- package/src/components/chat-composer-popover/chat-composer-popover.variables.json +1 -0
- package/src/components/chat-composer-popover/chat-composer-popover.variables.ts +3 -0
- package/src/components/chat-composer-popover/index.ts +19 -0
- package/src/components/code-block/code-block.schema.json +4 -0
- package/src/components/code-block/code-block.schema.ts +5 -0
- package/src/components/code-block/code-block.svelte +3 -3
- package/src/components/code-block/code-block.types.ts +6 -0
- package/src/components/command-item/command-item.svelte +7 -6
- package/src/components/command-menu/command-menu.schema.json +4 -0
- package/src/components/command-menu/command-menu.schema.ts +4 -0
- package/src/components/command-menu/command-menu.svelte +16 -5
- package/src/components/command-menu/command-menu.types.ts +2 -0
- package/src/components/json-viewer/_json-viewer-node.svelte +15 -1
- package/src/components/json-viewer/json-viewer.css +10 -6
- package/src/components/navigation-bar/navigation-bar.svelte +49 -7
- package/src/components/payload-inspector/index.ts +0 -2
- package/src/components/payload-inspector/payload-inspector.css +15 -75
- package/src/components/payload-inspector/payload-inspector.examples.json +5 -5
- package/src/components/payload-inspector/payload-inspector.schema.json +3 -31
- package/src/components/payload-inspector/payload-inspector.schema.ts +3 -36
- package/src/components/payload-inspector/payload-inspector.svelte +46 -239
- package/src/components/payload-inspector/payload-inspector.types.ts +10 -58
- package/src/components/sidebar/sidebar.css +4 -0
- package/src/components/sidebar/sidebar.svelte +6 -3
- package/src/components/tab/tab.schema.json +6 -2
- package/src/components/tab/tab.schema.ts +8 -2
- package/src/components/tab/tab.svelte +9 -5
- package/src/components/tab/tab.types.ts +8 -2
- package/src/index.ts +18 -5
- package/src/styles/components.css +1 -0
- package/dist/server/index-49we2xfs.js +0 -344
- package/dist/server/index-8fhvxk30.js +0 -265
- package/dist/server/index-x2ysg8ds.js +0 -388
- package/dist/server/index.server-20j0jh30.js +0 -9
- package/dist/server/index.server-dc35kh7d.js +0 -1835
- package/dist/server/index.server-kd4b0342.js +0 -607
- package/dist/server/index.server-n5cdmsz4.js +0 -30
- package/dist/server/index.server-rjap4k7y.js +0 -1389
- package/dist/server/index.server-vt6sn9y4.js +0 -447
- package/dist/server/index.server-w63n618v.js +0 -9
- package/dist/server/index.server-y2pa1k46.js +0 -9
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
|
|
3
|
+
import type { PopoverPlacement } from '../popover/popover.types.ts';
|
|
4
|
+
|
|
5
|
+
export type ChatComposerPopoverItem = {
|
|
6
|
+
/** Stable submitted value surfaced through onselect. */
|
|
7
|
+
value: string;
|
|
8
|
+
/** Default visible and accessible label for the command row. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** Optional secondary text for the command row. */
|
|
11
|
+
description?: string | undefined;
|
|
12
|
+
/** Optional fuzzy-search aliases. */
|
|
13
|
+
keywords?: readonly string[] | undefined;
|
|
14
|
+
/** Whether this row is skipped by keyboard navigation and activation. */
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type ChatComposerPopoverTriggerMatch = {
|
|
19
|
+
active: true;
|
|
20
|
+
trigger: string;
|
|
21
|
+
query: string;
|
|
22
|
+
start: number;
|
|
23
|
+
end: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type ChatComposerPopoverSelection<TItem extends ChatComposerPopoverItem> = {
|
|
27
|
+
item: TItem;
|
|
28
|
+
value: string;
|
|
29
|
+
query: string;
|
|
30
|
+
trigger: string;
|
|
31
|
+
range: {
|
|
32
|
+
start: number;
|
|
33
|
+
end: number;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type ChatComposerPopoverComposerProps = {
|
|
38
|
+
composerRole: 'combobox';
|
|
39
|
+
composerAriaExpanded: boolean;
|
|
40
|
+
composerAriaControls: string | undefined;
|
|
41
|
+
composerAriaActiveDescendant: string | undefined;
|
|
42
|
+
composerAriaAutocomplete: 'list';
|
|
43
|
+
oncomposerinput: (value: string, event?: Event) => void;
|
|
44
|
+
oncomposerkeydown: (event: KeyboardEvent) => void;
|
|
45
|
+
oncomposerselectionchange: (event: Event) => void;
|
|
46
|
+
oncomposerblur: (event: FocusEvent) => void;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export type ChatComposerPopoverItemSnippetContext<TItem extends ChatComposerPopoverItem> = {
|
|
50
|
+
item: TItem;
|
|
51
|
+
query: string;
|
|
52
|
+
trigger: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export type ChatComposerPopoverProps<TItem extends ChatComposerPopoverItem> = {
|
|
56
|
+
/** Unique identifier used for the listbox and item ids. */
|
|
57
|
+
id: string;
|
|
58
|
+
/** Current composer value. Bind this to the same value as ChatInput. */
|
|
59
|
+
value?: string;
|
|
60
|
+
/** Consumer-owned command or mention definitions. */
|
|
61
|
+
items: readonly TItem[];
|
|
62
|
+
/** Trigger characters that open the popover. Default `['/', '@']`. */
|
|
63
|
+
triggers?: readonly string[];
|
|
64
|
+
/** Accessible listbox label. Default `'Composer suggestions'`. */
|
|
65
|
+
label?: string;
|
|
66
|
+
/** Caret-relative placement. Default `'bottom-start'`. */
|
|
67
|
+
placement?: PopoverPlacement;
|
|
68
|
+
/** Distance in px between the caret and popover. Default `6`. */
|
|
69
|
+
offset?: number;
|
|
70
|
+
/** Render the ChatInput or compatible composer with the provided overlay props. */
|
|
71
|
+
composer: Snippet<[ChatComposerPopoverComposerProps]>;
|
|
72
|
+
/** Optional custom row contents. Defaults to the item label and description. */
|
|
73
|
+
item?: Snippet<[ChatComposerPopoverItemSnippetContext<TItem>]>;
|
|
74
|
+
/** Optional empty state rendered when filtering produces no matching rows. */
|
|
75
|
+
empty?: Snippet;
|
|
76
|
+
/** Override trigger detection. */
|
|
77
|
+
detectTrigger?: (
|
|
78
|
+
value: string,
|
|
79
|
+
selectionStart: number,
|
|
80
|
+
selectionEnd: number,
|
|
81
|
+
) => ChatComposerPopoverTriggerMatch | null;
|
|
82
|
+
/** Override filtering. */
|
|
83
|
+
filter?: (items: readonly TItem[], query: string, trigger: string) => readonly TItem[];
|
|
84
|
+
/** Invoked when an enabled item is selected by keyboard or pointer. */
|
|
85
|
+
onselect?: (selection: ChatComposerPopoverSelection<TItem>) => void;
|
|
86
|
+
/** Invoked when Escape, trigger loss, or outside pointerdown dismisses the popover. */
|
|
87
|
+
ondismiss?: () => void;
|
|
88
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './chat-composer-popover.css';
|
|
2
|
+
import ChatComposerPopover from './chat-composer-popover.svelte';
|
|
3
|
+
|
|
4
|
+
export default ChatComposerPopover;
|
|
5
|
+
export {
|
|
6
|
+
filterFuzzySubsequence,
|
|
7
|
+
fuzzySubsequenceScore,
|
|
8
|
+
type FuzzyFilterItem,
|
|
9
|
+
type FuzzyFilterResult,
|
|
10
|
+
} from './chat-composer-popover-filter.ts';
|
|
11
|
+
export type {
|
|
12
|
+
ChatComposerPopoverComposerProps,
|
|
13
|
+
ChatComposerPopoverItem,
|
|
14
|
+
ChatComposerPopoverItemSnippetContext,
|
|
15
|
+
ChatComposerPopoverProps,
|
|
16
|
+
ChatComposerPopoverSelection,
|
|
17
|
+
ChatComposerPopoverTriggerMatch,
|
|
18
|
+
} from './chat-composer-popover.types.ts';
|
|
19
|
+
export { ChatComposerPopover };
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"type": "boolean",
|
|
19
19
|
"description": "When true, render a copy button in the header."
|
|
20
20
|
},
|
|
21
|
+
"showLanguageLabel": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Whether to render the language label in the header. Default `true`.\nPass `false` to keep `language`-driven highlighting without the visible\nheader chip; with `copyable` also unset, no header renders at all."
|
|
24
|
+
},
|
|
21
25
|
"class": {
|
|
22
26
|
"type": "string",
|
|
23
27
|
"description": "Additional class names merged with `.cinder-code-block`."
|
|
@@ -22,6 +22,11 @@ const schema = {
|
|
|
22
22
|
type: 'boolean',
|
|
23
23
|
description: 'When true, render a copy button in the header.',
|
|
24
24
|
},
|
|
25
|
+
showLanguageLabel: {
|
|
26
|
+
type: 'boolean',
|
|
27
|
+
description:
|
|
28
|
+
'Whether to render the language label in the header. Default `true`.\nPass `false` to keep `language`-driven highlighting without the visible\nheader chip; with `copyable` also unset, no header renders at all.',
|
|
29
|
+
},
|
|
25
30
|
class: {
|
|
26
31
|
type: 'string',
|
|
27
32
|
description: 'Additional class names merged with `.cinder-code-block`.',
|
|
@@ -7,7 +7,7 @@ import { loadDefaultHighlighter } from './code-block-default-highlighter.ts';
|
|
|
7
7
|
import { classNames } from '../../utilities/class-names.ts';
|
|
8
8
|
import { devWarn } from '../../utilities/dev-warn.ts';
|
|
9
9
|
import CopyButton from '../copy-button/copy-button.svelte';
|
|
10
|
-
let { code, language, highlight, highlighter, copyable = false, class: className, } = $props();
|
|
10
|
+
let { code, language, highlight, highlighter, copyable = false, showLanguageLabel = true, class: className, } = $props();
|
|
11
11
|
let highlighted = $state(null);
|
|
12
12
|
// Two-phase render contract: the server (and the first client paint) emits
|
|
13
13
|
// the plain `<pre><code>` fallback because `$effect` never runs during SSR.
|
|
@@ -70,9 +70,9 @@ $effect(() => {
|
|
|
70
70
|
</script>
|
|
71
71
|
|
|
72
72
|
<div class={classNames('cinder-code-block', className)}>
|
|
73
|
-
{#if language || copyable}
|
|
73
|
+
{#if (language && showLanguageLabel) || copyable}
|
|
74
74
|
<header class="cinder-code-block__header">
|
|
75
|
-
{#if language}
|
|
75
|
+
{#if language && showLanguageLabel}
|
|
76
76
|
<span class="cinder-code-block__language">{language}</span>
|
|
77
77
|
{/if}
|
|
78
78
|
{#if copyable}
|
|
@@ -49,6 +49,12 @@ export type CodeBlockProps = {
|
|
|
49
49
|
highlighter?: Highlighter;
|
|
50
50
|
/** When true, render a copy button in the header. */
|
|
51
51
|
copyable?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Whether to render the language label in the header. Default `true`.
|
|
54
|
+
* Pass `false` to keep `language`-driven highlighting without the visible
|
|
55
|
+
* header chip; with `copyable` also unset, no header renders at all.
|
|
56
|
+
*/
|
|
57
|
+
showLanguageLabel?: boolean;
|
|
52
58
|
/** Additional class names merged with `.cinder-code-block`. */
|
|
53
59
|
class?: string;
|
|
54
60
|
};
|
|
@@ -15,8 +15,9 @@ const commandList = getCommandListContext();
|
|
|
15
15
|
// CommandMenu items can opt into parent-owned activation. Read untracked
|
|
16
16
|
// because this is a one-time discard, not a reactive dependency.
|
|
17
17
|
void untrack(() => selectionMode);
|
|
18
|
-
//
|
|
19
|
-
let
|
|
18
|
+
// Live id assigned by the parent command list on registration.
|
|
19
|
+
let registrationHandle = $state(null);
|
|
20
|
+
const itemId = $derived(registrationHandle?.id ?? null);
|
|
20
21
|
// Register with the palette at attach time, unregister on detach. Using an
|
|
21
22
|
// attachment (rather than onMount) means the DOM node is available at
|
|
22
23
|
// registration, so the palette can sort items by document order for
|
|
@@ -26,15 +27,15 @@ const registerWithPalette = (node) => {
|
|
|
26
27
|
// call mutates the palette's $state registrations list, which feeds derived
|
|
27
28
|
// values the attachment indirectly depends on — producing an update cycle.
|
|
28
29
|
return untrack(() => {
|
|
29
|
-
const
|
|
30
|
+
const registeredItem = commandList.register({
|
|
30
31
|
getValue: () => value,
|
|
31
32
|
getOnselect: () => onselect,
|
|
32
33
|
getDisabled: () => disabled,
|
|
33
34
|
}, node);
|
|
34
|
-
|
|
35
|
+
registrationHandle = registeredItem;
|
|
35
36
|
return () => {
|
|
36
|
-
unregister();
|
|
37
|
-
|
|
37
|
+
registeredItem.unregister();
|
|
38
|
+
registrationHandle = null;
|
|
38
39
|
};
|
|
39
40
|
});
|
|
40
41
|
};
|
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
3
|
"type": "object",
|
|
4
4
|
"properties": {
|
|
5
|
+
"listboxId": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"description": "Stable listbox id. Defaults to a generated component id."
|
|
8
|
+
},
|
|
5
9
|
"open": {
|
|
6
10
|
"type": "boolean",
|
|
7
11
|
"description": "Open state. Bindable. Default `false`."
|
|
@@ -4,6 +4,10 @@ const schema = {
|
|
|
4
4
|
$schema: 'https://json-schema.org/draft/2020-12/schema',
|
|
5
5
|
type: 'object',
|
|
6
6
|
properties: {
|
|
7
|
+
listboxId: {
|
|
8
|
+
type: 'string',
|
|
9
|
+
description: 'Stable listbox id. Defaults to a generated component id.',
|
|
10
|
+
},
|
|
7
11
|
open: {
|
|
8
12
|
type: 'boolean',
|
|
9
13
|
description: 'Open state. Bindable. Default `false`.',
|
|
@@ -10,8 +10,8 @@ import { classNames } from '../../utilities/class-names.ts';
|
|
|
10
10
|
import { setCommandListContext } from '../_internal/command-list-context.ts';
|
|
11
11
|
import { createCommandListState } from '../_internal/create-command-list-state.svelte.ts';
|
|
12
12
|
import { createPortalAttachment } from '../portal/index.ts';
|
|
13
|
-
const
|
|
14
|
-
let { open = $bindable(false), anchor, caretIndex, query = $bindable(''), items, empty, placement = 'bottom-start', offset = 6, label = 'Commands', onselect, ondismiss, onstatechange, class: className, } = $props();
|
|
13
|
+
const fallbackListboxId = $props.id();
|
|
14
|
+
let { listboxId = fallbackListboxId, open = $bindable(false), anchor, caretIndex, query = $bindable(''), items, empty, placement = 'bottom-start', offset = 6, label = 'Commands', onselect, ondismiss, onstatechange, class: className, } = $props();
|
|
15
15
|
const portalAttachment = createPortalAttachment({
|
|
16
16
|
target: () => document.body,
|
|
17
17
|
inheritAttributes: true,
|
|
@@ -19,7 +19,7 @@ const portalAttachment = createPortalAttachment({
|
|
|
19
19
|
});
|
|
20
20
|
let mounted = $state(false);
|
|
21
21
|
let listElement = $state();
|
|
22
|
-
const commandList = createCommandListState(listboxId);
|
|
22
|
+
const commandList = createCommandListState(() => listboxId);
|
|
23
23
|
const showEmpty = $derived(mounted && open && commandList.registrationsReady && commandList.registrations.length === 0);
|
|
24
24
|
const caretAnchor = $derived.by(() => {
|
|
25
25
|
const anchorElement = anchor;
|
|
@@ -43,6 +43,9 @@ const anchoredOverlay = createAnchoredOverlay({
|
|
|
43
43
|
$effect(() => {
|
|
44
44
|
mounted = true;
|
|
45
45
|
});
|
|
46
|
+
$effect(() => {
|
|
47
|
+
commandList.syncListboxId(listboxId);
|
|
48
|
+
});
|
|
46
49
|
$effect(() => {
|
|
47
50
|
if (!open) {
|
|
48
51
|
commandList.resetActiveItem();
|
|
@@ -54,7 +57,10 @@ $effect(() => {
|
|
|
54
57
|
commandList.refreshRegistrationsReady();
|
|
55
58
|
});
|
|
56
59
|
$effect(() => {
|
|
57
|
-
onstatechange?.({
|
|
60
|
+
onstatechange?.({
|
|
61
|
+
listboxId: commandList.listboxId,
|
|
62
|
+
activeItemId: open ? commandList.activeItemId : null,
|
|
63
|
+
});
|
|
58
64
|
});
|
|
59
65
|
$effect(() => {
|
|
60
66
|
commandList.scrollActiveItemIntoView();
|
|
@@ -117,7 +123,12 @@ $effect(() => {
|
|
|
117
123
|
data-cinder-position-ready={anchoredOverlay.positionReady}
|
|
118
124
|
style={anchoredOverlay.positionStyle}
|
|
119
125
|
>
|
|
120
|
-
<ul
|
|
126
|
+
<ul
|
|
127
|
+
id={commandList.listboxId}
|
|
128
|
+
role="listbox"
|
|
129
|
+
aria-label={label}
|
|
130
|
+
class="cinder-command-menu__listbox"
|
|
131
|
+
>
|
|
121
132
|
{@render items({ query })}
|
|
122
133
|
</ul>
|
|
123
134
|
{#if showEmpty && empty}
|
|
@@ -20,6 +20,8 @@ export type CommandMenuState = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export type CommandMenuProps = {
|
|
23
|
+
/** Stable listbox id. Defaults to a generated component id. */
|
|
24
|
+
listboxId?: string;
|
|
23
25
|
/** Open state. Bindable. Default `false`. */
|
|
24
26
|
open?: boolean;
|
|
25
27
|
/** Text field used as the caret-position anchor. */
|
|
@@ -62,7 +62,21 @@ function valueClass(v) {
|
|
|
62
62
|
{#if keyName !== undefined}
|
|
63
63
|
<span class="cinder-json-viewer__key">{keyName}:</span>
|
|
64
64
|
{/if}
|
|
65
|
-
<
|
|
65
|
+
<svg
|
|
66
|
+
class="cinder-json-viewer__caret"
|
|
67
|
+
data-cinder-collapsed={collapsed || undefined}
|
|
68
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
69
|
+
viewBox="0 0 20 20"
|
|
70
|
+
fill="currentColor"
|
|
71
|
+
aria-hidden="true"
|
|
72
|
+
focusable="false"
|
|
73
|
+
>
|
|
74
|
+
<path
|
|
75
|
+
fill-rule="evenodd"
|
|
76
|
+
d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06z"
|
|
77
|
+
clip-rule="evenodd"
|
|
78
|
+
></path>
|
|
79
|
+
</svg>
|
|
66
80
|
<span class="cinder-json-viewer__brace">
|
|
67
81
|
{isArray ? '[' : '{'}
|
|
68
82
|
</span>
|
|
@@ -80,12 +80,10 @@
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
.cinder-json-viewer__caret {
|
|
83
|
-
|
|
84
|
-
width: 0;
|
|
85
|
-
height: 0;
|
|
86
|
-
|
|
87
|
-
border-inline-end: 0.25rem solid transparent;
|
|
88
|
-
border-top: 0.375rem solid currentColor;
|
|
83
|
+
flex: 0 0 auto;
|
|
84
|
+
width: 0.75rem;
|
|
85
|
+
height: 0.75rem;
|
|
86
|
+
color: var(--cinder-text-muted);
|
|
89
87
|
transition: transform var(--cinder-duration-fast) var(--cinder-ease-standard);
|
|
90
88
|
}
|
|
91
89
|
|
|
@@ -93,6 +91,12 @@
|
|
|
93
91
|
transform: rotate(-90deg);
|
|
94
92
|
}
|
|
95
93
|
|
|
94
|
+
@media (prefers-reduced-motion: reduce) {
|
|
95
|
+
.cinder-json-viewer__caret {
|
|
96
|
+
transition: none;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
96
100
|
.cinder-json-viewer__brace {
|
|
97
101
|
color: var(--cinder-text-muted);
|
|
98
102
|
}
|
|
@@ -10,8 +10,9 @@ const FALLBACK_ROOT_FONT_SIZE_PX = 16;
|
|
|
10
10
|
const regionId = $props.id();
|
|
11
11
|
let { class: className, placement = 'top', showLabels = 'always', menuTogglePlacement = 'after-brand', brand, items, actions, menuToggle, mobileMenuOpen = $bindable(false), label = 'Main navigation',
|
|
12
12
|
// Strip these from rest so they cannot collide with internal attributes.
|
|
13
|
-
'aria-label': _ariaLabel, 'data-collapsible': _dataCollapsible, 'data-cinder-placement': _dataCinderPlacement, 'data-cinder-label-visibility': _dataCinderLabelVisibility, 'data-cinder-menu-toggle-placement': _dataCinderMenuTogglePlacement, onkeydown: consumerOnKeyDown, ...rest } = $props();
|
|
13
|
+
'aria-label': _ariaLabel, 'data-collapsible': _dataCollapsible, 'data-cinder-placement': _dataCinderPlacement, 'data-cinder-label-visibility': _dataCinderLabelVisibility, 'data-cinder-menu-toggle-placement': _dataCinderMenuTogglePlacement, onclick: consumerOnClick, onkeydown: consumerOnKeyDown, ...rest } = $props();
|
|
14
14
|
const navigationItemSelector = '[data-cinder-navigation-item]';
|
|
15
|
+
const toggleFocusSelector = '.cinder-navigation-bar__menu-toggle button, .cinder-navigation-bar__menu-toggle [href], .cinder-navigation-bar__menu-toggle input, .cinder-navigation-bar__menu-toggle select, .cinder-navigation-bar__menu-toggle textarea, .cinder-navigation-bar__menu-toggle [tabindex]:not([tabindex="-1"])';
|
|
15
16
|
const isCollapsible = $derived(placement === 'top' && menuToggle !== undefined);
|
|
16
17
|
let isMobileLayout = $state(false);
|
|
17
18
|
const variant = $derived(placement === 'bottom'
|
|
@@ -95,15 +96,56 @@ function isEnabledNavigationItem(item) {
|
|
|
95
96
|
return item.getAttribute('aria-disabled') !== 'true' && !item.hasAttribute('disabled');
|
|
96
97
|
}
|
|
97
98
|
function getEventNavigationItem(event) {
|
|
98
|
-
if (!(event.target instanceof
|
|
99
|
+
if (!(event.target instanceof Element) || !itemsRegionElement)
|
|
99
100
|
return null;
|
|
100
101
|
const navigationItem = event.target.closest(navigationItemSelector);
|
|
101
102
|
if (!navigationItem || !itemsRegionElement.contains(navigationItem))
|
|
102
103
|
return null;
|
|
103
|
-
if (navigationItem !== event.target)
|
|
104
|
-
return null;
|
|
105
104
|
return navigationItem;
|
|
106
105
|
}
|
|
106
|
+
function isModifiedClick(event) {
|
|
107
|
+
return event.button !== 0 || event.altKey || event.ctrlKey || event.metaKey || event.shiftKey;
|
|
108
|
+
}
|
|
109
|
+
function opensOutsideCurrentPage(item) {
|
|
110
|
+
if (!(item instanceof HTMLAnchorElement))
|
|
111
|
+
return false;
|
|
112
|
+
const target = item.getAttribute('target');
|
|
113
|
+
return (item.hasAttribute('download') ||
|
|
114
|
+
(target !== null && target.trim() !== '' && target.trim().toLowerCase() !== '_self'));
|
|
115
|
+
}
|
|
116
|
+
function canCloseAfterItemActivation(item, event) {
|
|
117
|
+
return (isCollapsible &&
|
|
118
|
+
isMobileLayout &&
|
|
119
|
+
mobileMenuOpen &&
|
|
120
|
+
isEnabledNavigationItem(item) &&
|
|
121
|
+
!isModifiedClick(event) &&
|
|
122
|
+
!opensOutsideCurrentPage(item));
|
|
123
|
+
}
|
|
124
|
+
function moveFocusBeforeClosingItemsRegion() {
|
|
125
|
+
if (!browser || !itemsRegionElement)
|
|
126
|
+
return;
|
|
127
|
+
const activeElement = document.activeElement;
|
|
128
|
+
if (activeElement instanceof Element && itemsRegionElement.contains(activeElement)) {
|
|
129
|
+
focusMenuToggle();
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function focusMenuToggle() {
|
|
133
|
+
const focusTarget = toggleElement ?? navigationBarElement?.querySelector(toggleFocusSelector);
|
|
134
|
+
focusTarget?.focus();
|
|
135
|
+
}
|
|
136
|
+
function handleClick(event) {
|
|
137
|
+
if (consumerOnClick) {
|
|
138
|
+
const currentTarget = event.currentTarget instanceof HTMLElement ? event.currentTarget : navigationBarElement;
|
|
139
|
+
consumerOnClick.call(currentTarget, event);
|
|
140
|
+
}
|
|
141
|
+
if (event.defaultPrevented)
|
|
142
|
+
return;
|
|
143
|
+
const navigationItem = getEventNavigationItem(event);
|
|
144
|
+
if (!navigationItem || !canCloseAfterItemActivation(navigationItem, event))
|
|
145
|
+
return;
|
|
146
|
+
moveFocusBeforeClosingItemsRegion();
|
|
147
|
+
mobileMenuOpen = false;
|
|
148
|
+
}
|
|
107
149
|
function focusAdjacentNavigationItem(currentItem, direction) {
|
|
108
150
|
const items = getNavigationItems();
|
|
109
151
|
if (items.length === 0)
|
|
@@ -129,12 +171,11 @@ function handleKeyDown(event) {
|
|
|
129
171
|
return;
|
|
130
172
|
if (event.key === 'Escape' && isCollapsible && isMobileLayout && mobileMenuOpen) {
|
|
131
173
|
mobileMenuOpen = false;
|
|
132
|
-
|
|
133
|
-
toggleElement?.focus();
|
|
174
|
+
focusMenuToggle();
|
|
134
175
|
return;
|
|
135
176
|
}
|
|
136
177
|
const navigationItem = getEventNavigationItem(event);
|
|
137
|
-
if (!navigationItem)
|
|
178
|
+
if (!navigationItem || navigationItem !== event.target)
|
|
138
179
|
return;
|
|
139
180
|
if (event.key === 'ArrowLeft' || event.key === 'ArrowRight') {
|
|
140
181
|
event.preventDefault();
|
|
@@ -159,6 +200,7 @@ function handleKeyDown(event) {
|
|
|
159
200
|
data-cinder-placement={placement}
|
|
160
201
|
data-cinder-label-visibility={showLabels}
|
|
161
202
|
data-cinder-menu-toggle-placement={menuTogglePlacement}
|
|
203
|
+
onclick={handleClick}
|
|
162
204
|
onkeydown={handleKeyDown}
|
|
163
205
|
>
|
|
164
206
|
{#if isCollapsible && menuToggle && menuTogglePlacement === 'before-brand'}
|
|
@@ -3,10 +3,8 @@ import PayloadInspector from './payload-inspector.svelte';
|
|
|
3
3
|
|
|
4
4
|
export default PayloadInspector;
|
|
5
5
|
export type {
|
|
6
|
-
PayloadInspectorMeta,
|
|
7
6
|
PayloadInspectorProps,
|
|
8
7
|
PayloadInspectorSchemaProps,
|
|
9
8
|
PayloadInspectorSchemaValue,
|
|
10
|
-
PayloadInspectorView,
|
|
11
9
|
} from './payload-inspector.types.ts';
|
|
12
10
|
export { PayloadInspector };
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
@layer cinder.tokens, cinder.foundation, cinder.components, cinder.utilities;
|
|
2
2
|
@import '../badge/badge.css';
|
|
3
|
-
@import '../code-block/code-block.css';
|
|
4
3
|
@import '../copy-button/copy-button.css';
|
|
5
|
-
@import '../description-list/description-list.css';
|
|
6
4
|
@import '../json-viewer/json-viewer.css';
|
|
7
|
-
@import '../tabs/tabs.css';
|
|
8
5
|
|
|
9
6
|
@layer cinder.components {
|
|
10
7
|
.cinder-payload-inspector {
|
|
11
8
|
display: flex;
|
|
12
9
|
flex-direction: column;
|
|
13
|
-
gap: var(--cinder-space-0);
|
|
14
10
|
border: 1px solid var(--cinder-border-muted);
|
|
15
11
|
border-radius: var(--cinder-radius-md);
|
|
16
12
|
overflow: hidden;
|
|
@@ -27,7 +23,7 @@
|
|
|
27
23
|
align-items: center;
|
|
28
24
|
justify-content: space-between;
|
|
29
25
|
gap: var(--cinder-space-2);
|
|
30
|
-
padding: var(--cinder-space-2) var(--cinder-space-3);
|
|
26
|
+
padding: var(--cinder-space-1) var(--cinder-space-2) var(--cinder-space-1) var(--cinder-space-3);
|
|
31
27
|
background: var(--cinder-surface-raised);
|
|
32
28
|
border-bottom: 1px solid var(--cinder-border-muted);
|
|
33
29
|
flex-wrap: wrap;
|
|
@@ -55,71 +51,29 @@
|
|
|
55
51
|
}
|
|
56
52
|
|
|
57
53
|
/* ----------------------------------------
|
|
58
|
-
*
|
|
59
|
-
* ---------------------------------------- */
|
|
60
|
-
|
|
61
|
-
.cinder-payload-inspector__tabs {
|
|
62
|
-
display: flex;
|
|
63
|
-
flex-direction: column;
|
|
64
|
-
flex: 1;
|
|
65
|
-
min-block-size: 0;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/* ----------------------------------------
|
|
69
|
-
* Panel content areas
|
|
54
|
+
* Panel content
|
|
70
55
|
* ---------------------------------------- */
|
|
71
56
|
|
|
72
57
|
.cinder-payload-inspector__panel {
|
|
73
|
-
padding: var(--cinder-space-4);
|
|
74
|
-
overflow: auto;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
.cinder-payload-inspector__panel--code {
|
|
78
|
-
padding: var(--cinder-space-0);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/* ----------------------------------------
|
|
82
|
-
* Raw view (CodeBlock wrapper)
|
|
83
|
-
* ---------------------------------------- */
|
|
84
|
-
|
|
85
|
-
.cinder-payload-inspector__raw {
|
|
86
|
-
/* Remove the built-in CodeBlock rounded corners so the block sits flush
|
|
87
|
-
inside the panel. Border radius is handled by the outer inspector. */
|
|
88
|
-
border-radius: 0;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/* ----------------------------------------
|
|
92
|
-
* Summary view
|
|
93
|
-
* ---------------------------------------- */
|
|
94
|
-
|
|
95
|
-
.cinder-payload-inspector__summary {
|
|
96
|
-
display: flex;
|
|
97
|
-
flex-direction: column;
|
|
98
|
-
gap: var(--cinder-space-4);
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.cinder-payload-inspector__summary-badges {
|
|
102
|
-
display: flex;
|
|
103
|
-
align-items: center;
|
|
104
|
-
gap: var(--cinder-space-2);
|
|
105
|
-
flex-wrap: wrap;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.cinder-payload-inspector__summary-value {
|
|
109
58
|
display: flex;
|
|
110
59
|
flex-direction: column;
|
|
111
60
|
gap: var(--cinder-space-2);
|
|
61
|
+
padding: var(--cinder-space-2);
|
|
62
|
+
overflow: auto;
|
|
112
63
|
}
|
|
113
64
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
65
|
+
/* JsonViewer carries its own border/background/padding for standalone use,
|
|
66
|
+
but nested here it would double the framing this component's own header
|
|
67
|
+
bar + outer border already provide — strip it back to flush content. */
|
|
68
|
+
.cinder-payload-inspector__panel .cinder-json-viewer {
|
|
69
|
+
padding: 0;
|
|
70
|
+
border: none;
|
|
71
|
+
border-radius: 0;
|
|
72
|
+
background: transparent;
|
|
120
73
|
}
|
|
121
74
|
|
|
122
75
|
.cinder-payload-inspector__primitive {
|
|
76
|
+
margin: 0;
|
|
123
77
|
font-family: var(--cinder-font-mono);
|
|
124
78
|
font-size: var(--cinder-text-sm);
|
|
125
79
|
color: var(--cinder-text);
|
|
@@ -127,6 +81,7 @@
|
|
|
127
81
|
padding: var(--cinder-space-2) var(--cinder-space-3);
|
|
128
82
|
border-radius: var(--cinder-radius-sm);
|
|
129
83
|
border: 1px solid var(--cinder-border-muted);
|
|
84
|
+
white-space: pre-wrap;
|
|
130
85
|
word-break: break-all;
|
|
131
86
|
}
|
|
132
87
|
|
|
@@ -156,24 +111,9 @@
|
|
|
156
111
|
display: flex;
|
|
157
112
|
align-items: center;
|
|
158
113
|
justify-content: center;
|
|
159
|
-
padding: var(--cinder-space-
|
|
114
|
+
padding: var(--cinder-space-4);
|
|
160
115
|
color: var(--cinder-text-disabled);
|
|
161
116
|
font-size: var(--cinder-text-sm);
|
|
162
117
|
font-style: italic;
|
|
163
118
|
}
|
|
164
|
-
|
|
165
|
-
/* ----------------------------------------
|
|
166
|
-
* Focus ring on focusable elements we own
|
|
167
|
-
* ---------------------------------------- */
|
|
168
|
-
|
|
169
|
-
.cinder-payload-inspector:focus-visible {
|
|
170
|
-
outline: var(--cinder-ring-width) solid transparent;
|
|
171
|
-
box-shadow: var(--_cinder-focus-ring-shadow);
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
@media (forced-colors: active) {
|
|
175
|
-
.cinder-payload-inspector:focus-visible {
|
|
176
|
-
outline: var(--cinder-ring-width) solid ButtonText;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
119
|
}
|
|
@@ -6,26 +6,26 @@
|
|
|
6
6
|
{
|
|
7
7
|
"id": "basic",
|
|
8
8
|
"title": "Basic payload inspector",
|
|
9
|
-
"description": "Inspect a structured object payload
|
|
10
|
-
"code": "<script lang=\"ts\">\n import { PayloadInspector } from '@lostgradient/cinder/payload-inspector';\n\n const payload = {\n userId: 'u_8f2a3b',\n action: 'checkout',\n cart: {\n items: [\n { id: 'p_001', name: 'Widget', qty: 2, price: 19.99 },\n { id: 'p_002', name: 'Gadget', qty: 1, price: 49.95 },\n ],\n total: 89.93,\n },\n timestamp: '2026-06-11T14:22:00Z',\n flags: { guestCheckout: false, promoApplied: true },\n };\n</script>\n\n<PayloadInspector
|
|
9
|
+
"description": "Inspect a structured object payload as an interactive tree with a copy action and byte size.",
|
|
10
|
+
"code": "<script lang=\"ts\">\n import { PayloadInspector } from '@lostgradient/cinder/payload-inspector';\n\n const payload = {\n userId: 'u_8f2a3b',\n action: 'checkout',\n cart: {\n items: [\n { id: 'p_001', name: 'Widget', qty: 2, price: 19.99 },\n { id: 'p_002', name: 'Gadget', qty: 1, price: 49.95 },\n ],\n total: 89.93,\n },\n timestamp: '2026-06-11T14:22:00Z',\n flags: { guestCheckout: false, promoApplied: true },\n };\n</script>\n\n<PayloadInspector value={payload} label=\"Checkout payload\" />\n"
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
"id": "edge-cases",
|
|
14
14
|
"title": "Edge cases",
|
|
15
15
|
"description": "Demonstrates null, invalid JSON, and empty payload states in the inspector.",
|
|
16
|
-
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { PayloadInspector } from '@lostgradient/cinder/payload-inspector';\n\n type Scenario = 'empty' | 'null' | 'invalid-json' | 'truncated' | 'primitive';\n\n let scenario = $state<Scenario>('empty');\n\n const scenarios: Record<Scenario, { value?: unknown; truncated?: boolean; label: string }> = {\n empty: { value: undefined, label: 'No payload' },\n null: { value: null, label: 'Null value' },\n 'invalid-json': { value: '{ not valid json at all', label: 'Invalid JSON string' },\n truncated: { value: { partial: 'data', more: '...' }, truncated: true, label: 'Truncated' },\n primitive: { value: 42, label: 'Number primitive' },\n };\n\n const current = $derived(scenarios[scenario]);\n</script>\n\n<div style=\"display: flex; flex-direction: column; gap: 1rem;\">\n <div style=\"display: flex; gap: 0.5rem; flex-wrap: wrap;\">\n {#each Object.keys(scenarios) as key (key)}\n <Button\n variant={scenario === key ? 'primary' : 'secondary'}\n size=\"sm\"\n onclick={() => (scenario = key as Scenario)}\n >\n {scenarios[key as Scenario].label}\n </Button>\n {/each}\n </div>\n\n <PayloadInspector
|
|
16
|
+
"code": "<script lang=\"ts\">\n import { Button } from '@lostgradient/cinder/button';\n import { PayloadInspector } from '@lostgradient/cinder/payload-inspector';\n\n type Scenario = 'empty' | 'null' | 'invalid-json' | 'truncated' | 'primitive';\n\n let scenario = $state<Scenario>('empty');\n\n const scenarios: Record<Scenario, { value?: unknown; truncated?: boolean; label: string }> = {\n empty: { value: undefined, label: 'No payload' },\n null: { value: null, label: 'Null value' },\n 'invalid-json': { value: '{ not valid json at all', label: 'Invalid JSON string' },\n truncated: { value: { partial: 'data', more: '...' }, truncated: true, label: 'Truncated' },\n primitive: { value: 42, label: 'Number primitive' },\n };\n\n const current = $derived(scenarios[scenario]);\n</script>\n\n<div style=\"display: flex; flex-direction: column; gap: 1rem;\">\n <div style=\"display: flex; gap: 0.5rem; flex-wrap: wrap;\">\n {#each Object.keys(scenarios) as key (key)}\n <Button\n variant={scenario === key ? 'primary' : 'secondary'}\n size=\"sm\"\n onclick={() => (scenario = key as Scenario)}\n >\n {scenarios[key as Scenario].label}\n </Button>\n {/each}\n </div>\n\n <PayloadInspector value={current.value} truncated={current.truncated ?? false} />\n</div>\n"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"id": "signal-payload",
|
|
20
20
|
"title": "Signal payload",
|
|
21
21
|
"description": "Inspect a workflow signal payload — a common pattern in activity result dashboards.",
|
|
22
|
-
"code": "<script lang=\"ts\">\n import { PayloadInspector } from '@lostgradient/cinder/payload-inspector';\n\n const signalPayload = {\n signalName: 'PaymentConfirmed',\n data: {\n transactionId: 'txn_5e8b2a',\n amount: 89.93,\n currency: 'USD',\n provider: 'stripe',\n confirmedAt: '2026-06-11T14:23:01Z',\n metadata: {\n statementDescriptor: 'ACME STORE',\n riskScore: 0.12,\n },\n },\n sentAt: '2026-06-11T14:23:01.543Z',\n correlationId: 'ord_9c4e1f',\n };\n</script>\n\n<PayloadInspector
|
|
22
|
+
"code": "<script lang=\"ts\">\n import { PayloadInspector } from '@lostgradient/cinder/payload-inspector';\n\n const signalPayload = {\n signalName: 'PaymentConfirmed',\n data: {\n transactionId: 'txn_5e8b2a',\n amount: 89.93,\n currency: 'USD',\n provider: 'stripe',\n confirmedAt: '2026-06-11T14:23:01Z',\n metadata: {\n statementDescriptor: 'ACME STORE',\n riskScore: 0.12,\n },\n },\n sentAt: '2026-06-11T14:23:01.543Z',\n correlationId: 'ord_9c4e1f',\n };\n</script>\n\n<PayloadInspector value={signalPayload} label=\"Signal payload\" />\n"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"id": "workflow-input",
|
|
26
26
|
"title": "Workflow input",
|
|
27
27
|
"description": "Inspecting a workflow launch payload with signal input, retry policy, and schedule metadata.",
|
|
28
|
-
"code": "<script lang=\"ts\">\n import { PayloadInspector } from '@lostgradient/cinder/payload-inspector';\n\n const workflowInput = {\n workflowType: 'OrderFulfillment',\n input: {\n orderId: 'ord_9c4e1f',\n customerId: 'cust_221a',\n priority: 'express',\n items: ['sku-100', 'sku-201', 'sku-303'],\n shipTo: {\n name: 'Alex Rivera',\n address: '42 Elm St',\n city: 'Springfield',\n zip: '12345',\n },\n },\n retryPolicy: {\n maximumAttempts: 3,\n initialInterval: '1s',\n maximumInterval: '30s',\n backoffCoefficient: 2,\n },\n searchAttributes: {\n OrderStatus: 'pending',\n CustomerId: 'cust_221a',\n },\n };\n</script>\n\n<PayloadInspector
|
|
28
|
+
"code": "<script lang=\"ts\">\n import { PayloadInspector } from '@lostgradient/cinder/payload-inspector';\n\n const workflowInput = {\n workflowType: 'OrderFulfillment',\n input: {\n orderId: 'ord_9c4e1f',\n customerId: 'cust_221a',\n priority: 'express',\n items: ['sku-100', 'sku-201', 'sku-303'],\n shipTo: {\n name: 'Alex Rivera',\n address: '42 Elm St',\n city: 'Springfield',\n zip: '12345',\n },\n },\n retryPolicy: {\n maximumAttempts: 3,\n initialInterval: '1s',\n maximumInterval: '30s',\n backoffCoefficient: 2,\n },\n searchAttributes: {\n OrderStatus: 'pending',\n CustomerId: 'cust_221a',\n },\n };\n</script>\n\n<PayloadInspector value={workflowInput} label=\"Workflow input\" />\n"
|
|
29
29
|
}
|
|
30
30
|
]
|
|
31
31
|
}
|