@penwin/discord-components-core 4.6.0 → 4.7.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/custom-elements.json +524 -43
- package/dist/bundle/index.mjs +794 -621
- package/dist/bundle/index.mjs.map +1 -1
- package/dist/bundle/styles/base.css +1 -1
- package/dist/components/discord-media-fullscreen-previewer/DiscordMediaFullscreenPreviewer.d.ts +10 -0
- package/dist/components/discord-media-fullscreen-previewer/DiscordMediaFullscreenPreviewer.d.ts.map +1 -1
- package/dist/components/discord-media-fullscreen-previewer/DiscordMediaFullscreenPreviewer.js +266 -168
- package/dist/components/discord-media-fullscreen-previewer/DiscordMediaFullscreenPreviewer.js.map +1 -1
- package/dist/components/discord-text-file-attachment-previewer/DiscordTextFileAttachmentPreviewer.d.ts +91 -15
- package/dist/components/discord-text-file-attachment-previewer/DiscordTextFileAttachmentPreviewer.d.ts.map +1 -1
- package/dist/components/discord-text-file-attachment-previewer/DiscordTextFileAttachmentPreviewer.js +465 -130
- package/dist/components/discord-text-file-attachment-previewer/DiscordTextFileAttachmentPreviewer.js.map +1 -1
- package/dist/components/svgs/TextFilePreview.d.ts +25 -0
- package/dist/components/svgs/TextFilePreview.d.ts.map +1 -0
- package/dist/components/svgs/TextFilePreview.js +69 -0
- package/dist/components/svgs/TextFilePreview.js.map +1 -0
- package/package.json +1 -1
|
@@ -2,7 +2,6 @@ import { LitElement, type PropertyValues } from 'lit';
|
|
|
2
2
|
import type { LightTheme } from '../../types.js';
|
|
3
3
|
import '../discord-link/DiscordLink.js';
|
|
4
4
|
export declare class DiscordTextFileAttachmentPreviewer extends LitElement implements LightTheme {
|
|
5
|
-
constructor();
|
|
6
5
|
/**
|
|
7
6
|
* The name of the file
|
|
8
7
|
*
|
|
@@ -12,7 +11,18 @@ export declare class DiscordTextFileAttachmentPreviewer extends LitElement imple
|
|
|
12
11
|
* ```
|
|
13
12
|
*/
|
|
14
13
|
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* The language used to highlight the content. Viewers can change it from the preview.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* 'ts'
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
15
22
|
language: string;
|
|
23
|
+
/**
|
|
24
|
+
* The text content of the file
|
|
25
|
+
*/
|
|
16
26
|
content: string;
|
|
17
27
|
/**
|
|
18
28
|
* The size of the file in bytes
|
|
@@ -35,7 +45,7 @@ export declare class DiscordTextFileAttachmentPreviewer extends LitElement imple
|
|
|
35
45
|
*/
|
|
36
46
|
bytesUnit: string;
|
|
37
47
|
/**
|
|
38
|
-
* The URL to the file,
|
|
48
|
+
* The URL to the file, used by the "Download" menu item
|
|
39
49
|
*
|
|
40
50
|
* @example
|
|
41
51
|
* ```ts
|
|
@@ -43,24 +53,90 @@ export declare class DiscordTextFileAttachmentPreviewer extends LitElement imple
|
|
|
43
53
|
* ```
|
|
44
54
|
*/
|
|
45
55
|
href: string;
|
|
56
|
+
/**
|
|
57
|
+
* Whether long lines wrap instead of scrolling sideways, as Discord does by default. Viewers can
|
|
58
|
+
* toggle it from the menu. Set `wrap-text="false"` to start with it off.
|
|
59
|
+
*/
|
|
60
|
+
wrapText: boolean;
|
|
46
61
|
lightTheme: boolean;
|
|
47
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Whether the inline preview shows more lines.
|
|
64
|
+
*/
|
|
65
|
+
private expanded;
|
|
66
|
+
/**
|
|
67
|
+
* Whether the full view (a modal dialog) is open.
|
|
68
|
+
*/
|
|
69
|
+
private fullView;
|
|
70
|
+
/**
|
|
71
|
+
* The open popup, and the footer (inline or full view) that opened it.
|
|
72
|
+
*/
|
|
73
|
+
private popup;
|
|
48
74
|
private currentSearch;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Whether the collapsed preview hides content, measured once rendered.
|
|
77
|
+
*/
|
|
78
|
+
private overflowing;
|
|
79
|
+
private lines;
|
|
80
|
+
private popper;
|
|
81
|
+
/**
|
|
82
|
+
* The trigger pressed while its popup was open. Light dismiss may already have closed the popup by
|
|
83
|
+
* the time its click arrives, so the click must not open it again.
|
|
84
|
+
*/
|
|
85
|
+
private pressedOpenTrigger;
|
|
86
|
+
/**
|
|
87
|
+
* Whether the open popup was opened from the keyboard, which moves focus into it.
|
|
88
|
+
*/
|
|
89
|
+
private openedFromKeyboard;
|
|
90
|
+
private wrapCloseTimeout;
|
|
91
|
+
/**
|
|
92
|
+
* Whether the pointer went down outside the full view, for the light-dismiss fallback.
|
|
93
|
+
*/
|
|
94
|
+
private pressedOutsideDialog;
|
|
95
|
+
private readonly dialogRef;
|
|
96
|
+
private readonly inlineBodyRef;
|
|
97
|
+
private readonly inputRef;
|
|
98
|
+
protected createRenderRoot(): this;
|
|
99
|
+
/**
|
|
100
|
+
* Open the language selector of the inline preview. Kept for the 4.x API.
|
|
101
|
+
*/
|
|
56
102
|
showSelector(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Close any open popup. Kept for the 4.x API.
|
|
105
|
+
*/
|
|
57
106
|
hideSelector(): void;
|
|
58
|
-
private popper;
|
|
59
|
-
private isFirstClickDispatch;
|
|
60
|
-
private removeHandleClickOutside;
|
|
61
107
|
disconnectedCallback(): void;
|
|
62
|
-
|
|
63
|
-
updated(changed: PropertyValues): void;
|
|
108
|
+
protected willUpdate(changed: PropertyValues): void;
|
|
109
|
+
protected updated(changed: PropertyValues): void;
|
|
110
|
+
private isPopupOpen;
|
|
111
|
+
private openPopup;
|
|
112
|
+
/**
|
|
113
|
+
* Close the open popup. Focus goes back to its trigger when it was inside the popup, without a
|
|
114
|
+
* focus ring after a pointer action.
|
|
115
|
+
*/
|
|
116
|
+
private closePopup;
|
|
117
|
+
private popupElements;
|
|
118
|
+
private showPopup;
|
|
119
|
+
private handlePopupToggle;
|
|
120
|
+
private handleTriggerPointerDown;
|
|
121
|
+
private handleTriggerClick;
|
|
122
|
+
private handleMenuTriggerKeydown;
|
|
123
|
+
private handleMenuKeydown;
|
|
124
|
+
private toggleExpanded;
|
|
125
|
+
private openFullView;
|
|
126
|
+
private closeFullView;
|
|
127
|
+
private handleDialogClose;
|
|
128
|
+
private isOutsideDialog;
|
|
129
|
+
private handleDialogPointerDown;
|
|
130
|
+
private handleDialogPointerUp;
|
|
131
|
+
private toggleWrap;
|
|
132
|
+
private selectLanguage;
|
|
133
|
+
private handleSearchInput;
|
|
134
|
+
private clearSearch;
|
|
135
|
+
private renderLines;
|
|
136
|
+
private renderHeader;
|
|
137
|
+
private renderLanguageSelector;
|
|
138
|
+
private renderMenu;
|
|
139
|
+
private renderFooter;
|
|
64
140
|
protected render(): import("lit").TemplateResult<1>;
|
|
65
141
|
}
|
|
66
142
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DiscordTextFileAttachmentPreviewer.d.ts","sourceRoot":"","sources":["../../../src/components/discord-text-file-attachment-previewer/DiscordTextFileAttachmentPreviewer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DiscordTextFileAttachmentPreviewer.d.ts","sourceRoot":"","sources":["../../../src/components/discord-text-file-attachment-previewer/DiscordTextFileAttachmentPreviewer.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAA2B,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAM/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD,OAAO,gCAAgC,CAAC;AA2FxC,qBACa,kCAAmC,SAAQ,UAAW,YAAW,UAAU;IACvF;;;;;;;OAOG;IAEI,IAAI,EAAE,MAAM,CAAC;IAEpB;;;;;;;OAOG;IAEI,QAAQ,EAAE,MAAM,CAAC;IAExB;;OAEG;IAEI,OAAO,EAAE,MAAM,CAAC;IAEvB;;;;;;;;;OASG;IAEI,KAAK,EAAE,MAAM,CAAC;IAErB;;;;;;;OAOG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