@lynx-js/web-elements 0.12.0 → 0.12.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/CHANGELOG.md +51 -15
- package/dist/elements/XFoldViewNg/XFoldviewSlotNgTouchEventsHandler.js +29 -3
- package/dist/elements/XList/XList.d.ts +2 -0
- package/dist/elements/XList/XList.js +4 -0
- package/dist/elements/XMarkdown/XMarkdown.d.ts +43 -0
- package/dist/elements/XMarkdown/XMarkdown.js +346 -0
- package/dist/elements/XMarkdown/XMarkdownAttributes.d.ts +35 -0
- package/dist/elements/XMarkdown/XMarkdownAttributes.js +1232 -0
- package/dist/elements/XMarkdown/XMarkdownDeps.d.ts +2 -0
- package/dist/elements/XMarkdown/XMarkdownDeps.js +11 -0
- package/dist/elements/XMarkdown/index.d.ts +7 -0
- package/dist/elements/XMarkdown/index.js +11 -0
- package/dist/elements/all.d.ts +1 -0
- package/dist/elements/all.js +1 -0
- package/dist/elements/htmlTemplates.d.ts +2 -1
- package/dist/elements/htmlTemplates.js +87 -0
- package/index.css +1 -0
- package/package.json +15 -3
- package/src/elements/XList/x-list.css +31 -0
- package/src/elements/XMarkdown/x-markdown.css +15 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
3
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
4
|
+
// LICENSE file in the root directory of this source tree.
|
|
5
|
+
*/
|
|
6
|
+
// Keep runtime interop consistent with dynamic import usage in XMarkdownAttributes.
|
|
7
|
+
import * as mdModule from 'markdown-it';
|
|
8
|
+
import * as dpModule from 'dompurify';
|
|
9
|
+
export const MarkdownIt = (mdModule.default ?? mdModule);
|
|
10
|
+
export const createDOMPurify = (dpModule.default ?? dpModule);
|
|
11
|
+
//# sourceMappingURL=XMarkdownDeps.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
2
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
3
|
+
// LICENSE file in the root directory of this source tree.
|
|
4
|
+
/**
|
|
5
|
+
* @module elements/XMarkdown
|
|
6
|
+
*
|
|
7
|
+
* `x-markdown` renders markdown content with minimal styling.
|
|
8
|
+
* It supports the `content` and `markdown-style` attributes.
|
|
9
|
+
*/
|
|
10
|
+
export { XMarkdown } from './XMarkdown.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
package/dist/elements/all.d.ts
CHANGED
package/dist/elements/all.js
CHANGED
|
@@ -7,11 +7,12 @@ export declare const templateFilterImage: (attributes: {
|
|
|
7
7
|
src?: string;
|
|
8
8
|
}) => string;
|
|
9
9
|
export declare const templateXInput = "<style>\n #input:focus {\n outline: none;\n }\n #form {\n display: none;\n }\n</style>\n<form id=\"form\" part=\"form\" method=\"dialog\">\n <input\n id=\"input\"\n part=\"input\"\n step=\"any\"\n type=\"text\"\n inputmode=\"text\"\n spell-check=\"true\"\n />\n</form>";
|
|
10
|
-
export declare const templateXList = "<style>\n .placeholder-dom {\n display: none;\n flex: 0 0 0;\n align-self: stretch;\n min-height: 0;\n min-width: 0;\n }\n .observer-container {\n flex-direction: inherit;\n overflow: visible;\n }\n .observer {\n display: flex;\n }\n</style>\n<div id=\"content\" part=\"content\">\n <div\n class=\"observer-container placeholder-dom\"\n part=\"upper-threshold-observer\"\n >\n <div\n class=\"observer placeholder-dom\"\n id=\"upper-threshold-observer\"\n ></div>\n </div>\n <slot part=\"slot\"></slot>\n <div\n class=\"observer-container placeholder-dom\"\n part=\"lower-threshold-observer\"\n >\n <div\n class=\"observer placeholder-dom\"\n id=\"lower-threshold-observer\"\n ></div>\n </div>\n</div>";
|
|
10
|
+
export declare const templateXList = "<style>\n .placeholder-dom {\n display: none;\n flex: 0 0 0;\n align-self: stretch;\n min-height: 0;\n min-width: 0;\n }\n .observer-container {\n flex-direction: inherit;\n overflow: visible;\n }\n .observer {\n display: flex;\n }\n</style>\n<div id=\"content\" part=\"content\">\n <div\n class=\"observer-container placeholder-dom\"\n part=\"upper-threshold-observer\"\n >\n <div\n class=\"observer placeholder-dom\"\n id=\"upper-threshold-observer\"\n part=\"upper-threshold-sentinel\"\n ></div>\n </div>\n <slot part=\"slot\"></slot>\n <div\n class=\"observer-container placeholder-dom\"\n part=\"lower-threshold-observer\"\n >\n <div\n class=\"observer placeholder-dom\"\n id=\"lower-threshold-observer\"\n part=\"lower-threshold-sentinel\"\n ></div>\n </div>\n</div>";
|
|
11
11
|
export declare const templateXOverlayNg = "<style>\n #dialog[open] {\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n position: fixed;\n overscroll-behavior: contain;\n scrollbar-width: none;\n }\n #dialog[open]::-webkit-scrollbar {\n display: none;\n }\n #dialog::backdrop {\n background-color: transparent;\n }\n .overlay-inner {\n position: sticky;\n top: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n }\n .overlay-inner > * {\n pointer-events: auto;\n }\n .overlay-placeholder {\n width: 100%;\n height: 1px;\n }\n</style>\n<dialog id=\"dialog\" part=\"dialog\">\n <div class=\"overlay-inner\">\n <slot></slot>\n </div>\n <div class=\"overlay-placeholder\"></div>\n</dialog>";
|
|
12
12
|
export declare const templateXRefreshView = "<style>\n .bounce-container {\n overflow: scroll;\n overscroll-behavior: contain;\n scroll-snap-type: y mandatory;\n scroll-behavior: smooth;\n scrollbar-width: none;\n }\n .overflow-placeholder {\n min-height: 30%;\n min-width: 100%;\n flex-shrink: 0;\n scroll-snap-align: none;\n }\n .not-shrink {\n height: 100%;\n width: 100%;\n min-height: 100%;\n min-width: 100%;\n flex-shrink: 0;\n }\n .vertical {\n display: flex;\n flex-direction: column;\n }\n #content {\n scroll-snap-align: center;\n }\n</style>\n<div id=\"container\" part=\"container\" class=\"bounce-container not-shrink vertical\">\n <div\n id=\"placeholder-top\"\n class=\"overflow-placeholder bounce-item\"\n part=\"placeholder-top\"\n ></div>\n <slot name=\"header\"></slot>\n <div id=\"content\" part=\"content\" class=\"not-shrink vertical\">\n <slot part=\"slot\"></slot>\n </div>\n <slot name=\"footer\"></slot>\n <div\n id=\"placeholder-bot\"\n class=\"overflow-placeholder bounce-item\"\n part=\"placeholder-bot\"\n ></div>\n</div>";
|
|
13
13
|
export declare const templateXSwiper = "<style>\n #bounce-padding {\n display: none;\n flex: 0 0 0;\n align-self: stretch;\n scroll-snap-align: none;\n flex-basis: 100%;\n }\n #content {\n position: relative;\n display: flex;\n flex: 0 0 100%;\n flex-direction: inherit;\n flex-wrap: inherit;\n align-self: stretch;\n justify-content: inherit;\n align-items: inherit;\n overflow: inherit;\n scrollbar-width: none;\n scroll-snap-align: start;\n scroll-snap-type: inherit;\n }\n div::-webkit-scrollbar {\n display: none;\n }\n #indicator-container {\n display: none;\n }\n #indicator-container > div {\n animation-name: indicator-dot;\n animation-duration: 100ms;\n }\n @keyframes indicator-dot {\n 30%,\n 70% {\n background-color: var(--indicator-color);\n }\n 31%,\n 69% {\n background-color: var(--indicator-active-color);\n }\n }\n</style>\n<style id=\"indicator-style\"></style>\n<div id=\"bounce-padding\" part=\"bounce-padding\"></div>\n<div id=\"indicator-container\" part=\"indicator-container\"></div>\n<div id=\"content\" part=\"content\">\n <slot part=\"slot-start\" name=\"circular-start\" id=\"circular-start\"></slot>\n <slot part=\"slot\"></slot>\n <slot part=\"slot-end\" name=\"circular-end\" id=\"circular-end\"></slot>\n</div>";
|
|
14
14
|
export declare const templateXText = "<div id=\"inner-box\" part=\"inner-box\"><slot part=\"slot\"></slot><slot name=\"inline-truncation\"></slot></div>";
|
|
15
|
+
export declare const templateXMarkdown = "<style>\n :host {\n display: block;\n }\n .markdown-body {\n display: block;\n line-height: 1.4;\n color: inherit;\n word-break: break-word;\n position: relative;\n }\n .markdown-body p {\n margin: 0 0 0.75em 0;\n }\n .markdown-body h1,\n .markdown-body h2,\n .markdown-body h3,\n .markdown-body h4,\n .markdown-body h5,\n .markdown-body h6 {\n margin: 0.8em 0 0.4em 0;\n }\n .markdown-body ul,\n .markdown-body ol {\n margin: 0 0 0.75em 1.5em;\n }\n .markdown-body pre {\n margin: 0 0 0.75em 0;\n padding: 8px 12px;\n border-radius: 6px;\n background: #f6f8fa;\n overflow: auto;\n }\n .markdown-body code {\n font-family: ui-monospace, SFMono-Regular, SFMono, Menlo, Consolas,\n \"Liberation Mono\", monospace;\n }\n .markdown-body pre code {\n display: block;\n padding: 0;\n }\n .markdown-body img {\n max-width: 100%;\n height: auto;\n display: block;\n }\n .markdown-body .md-inline-view {\n display: inline-block;\n vertical-align: baseline;\n }\n .markdown-body .md-truncation {\n position: absolute;\n right: 0;\n bottom: 0;\n background-color: inherit;\n }\n .markdown-body .md-image-figure {\n margin: 0 0 0.75em 0;\n }\n .markdown-body .md-image-caption {\n margin-top: 4px;\n color: #666;\n font-size: 0.875em;\n }\n .markdown-body .md-text-mask-effect {\n position: relative;\n display: inline-block;\n }\n .markdown-body .md-text-mask-effect-overlay {\n position: absolute;\n inset: 0;\n pointer-events: none;\n user-select: none;\n white-space: pre;\n color: transparent;\n -webkit-background-clip: text;\n background-clip: text;\n }\n .markdown-body a {\n color: #0366d6;\n text-decoration: underline;\n }\n</style>\n<style id=\"markdown-style\"></style>\n<div id=\"markdown-root\" part=\"root\" class=\"markdown-body\"></div>";
|
|
15
16
|
export declare const templateInlineImage: (attributes: {
|
|
16
17
|
src?: string;
|
|
17
18
|
}) => string;
|
|
@@ -142,6 +142,7 @@ export const templateXList = `<style>
|
|
|
142
142
|
<div
|
|
143
143
|
class="observer placeholder-dom"
|
|
144
144
|
id="upper-threshold-observer"
|
|
145
|
+
part="upper-threshold-sentinel"
|
|
145
146
|
></div>
|
|
146
147
|
</div>
|
|
147
148
|
<slot part="slot"></slot>
|
|
@@ -152,6 +153,7 @@ export const templateXList = `<style>
|
|
|
152
153
|
<div
|
|
153
154
|
class="observer placeholder-dom"
|
|
154
155
|
id="lower-threshold-observer"
|
|
156
|
+
part="lower-threshold-sentinel"
|
|
155
157
|
></div>
|
|
156
158
|
</div>
|
|
157
159
|
</div>`;
|
|
@@ -294,6 +296,91 @@ export const templateXSwiper = `<style>
|
|
|
294
296
|
<slot part="slot-end" name="circular-end" id="circular-end"></slot>
|
|
295
297
|
</div>`;
|
|
296
298
|
export const templateXText = `<div id="inner-box" part="inner-box"><slot part="slot"></slot><slot name="inline-truncation"></slot></div>`;
|
|
299
|
+
export const templateXMarkdown = `<style>
|
|
300
|
+
:host {
|
|
301
|
+
display: block;
|
|
302
|
+
}
|
|
303
|
+
.markdown-body {
|
|
304
|
+
display: block;
|
|
305
|
+
line-height: 1.4;
|
|
306
|
+
color: inherit;
|
|
307
|
+
word-break: break-word;
|
|
308
|
+
position: relative;
|
|
309
|
+
}
|
|
310
|
+
.markdown-body p {
|
|
311
|
+
margin: 0 0 0.75em 0;
|
|
312
|
+
}
|
|
313
|
+
.markdown-body h1,
|
|
314
|
+
.markdown-body h2,
|
|
315
|
+
.markdown-body h3,
|
|
316
|
+
.markdown-body h4,
|
|
317
|
+
.markdown-body h5,
|
|
318
|
+
.markdown-body h6 {
|
|
319
|
+
margin: 0.8em 0 0.4em 0;
|
|
320
|
+
}
|
|
321
|
+
.markdown-body ul,
|
|
322
|
+
.markdown-body ol {
|
|
323
|
+
margin: 0 0 0.75em 1.5em;
|
|
324
|
+
}
|
|
325
|
+
.markdown-body pre {
|
|
326
|
+
margin: 0 0 0.75em 0;
|
|
327
|
+
padding: 8px 12px;
|
|
328
|
+
border-radius: 6px;
|
|
329
|
+
background: #f6f8fa;
|
|
330
|
+
overflow: auto;
|
|
331
|
+
}
|
|
332
|
+
.markdown-body code {
|
|
333
|
+
font-family: ui-monospace, SFMono-Regular, SFMono, Menlo, Consolas,
|
|
334
|
+
"Liberation Mono", monospace;
|
|
335
|
+
}
|
|
336
|
+
.markdown-body pre code {
|
|
337
|
+
display: block;
|
|
338
|
+
padding: 0;
|
|
339
|
+
}
|
|
340
|
+
.markdown-body img {
|
|
341
|
+
max-width: 100%;
|
|
342
|
+
height: auto;
|
|
343
|
+
display: block;
|
|
344
|
+
}
|
|
345
|
+
.markdown-body .md-inline-view {
|
|
346
|
+
display: inline-block;
|
|
347
|
+
vertical-align: baseline;
|
|
348
|
+
}
|
|
349
|
+
.markdown-body .md-truncation {
|
|
350
|
+
position: absolute;
|
|
351
|
+
right: 0;
|
|
352
|
+
bottom: 0;
|
|
353
|
+
background-color: inherit;
|
|
354
|
+
}
|
|
355
|
+
.markdown-body .md-image-figure {
|
|
356
|
+
margin: 0 0 0.75em 0;
|
|
357
|
+
}
|
|
358
|
+
.markdown-body .md-image-caption {
|
|
359
|
+
margin-top: 4px;
|
|
360
|
+
color: #666;
|
|
361
|
+
font-size: 0.875em;
|
|
362
|
+
}
|
|
363
|
+
.markdown-body .md-text-mask-effect {
|
|
364
|
+
position: relative;
|
|
365
|
+
display: inline-block;
|
|
366
|
+
}
|
|
367
|
+
.markdown-body .md-text-mask-effect-overlay {
|
|
368
|
+
position: absolute;
|
|
369
|
+
inset: 0;
|
|
370
|
+
pointer-events: none;
|
|
371
|
+
user-select: none;
|
|
372
|
+
white-space: pre;
|
|
373
|
+
color: transparent;
|
|
374
|
+
-webkit-background-clip: text;
|
|
375
|
+
background-clip: text;
|
|
376
|
+
}
|
|
377
|
+
.markdown-body a {
|
|
378
|
+
color: #0366d6;
|
|
379
|
+
text-decoration: underline;
|
|
380
|
+
}
|
|
381
|
+
</style>
|
|
382
|
+
<style id="markdown-style"></style>
|
|
383
|
+
<div id="markdown-root" part="root" class="markdown-body"></div>`;
|
|
297
384
|
export const templateInlineImage = templateXImage;
|
|
298
385
|
export const templateXTextarea = `<style>
|
|
299
386
|
#textarea:focus,
|
package/index.css
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
@import url("./src/elements/XSvg/x-svg.css");
|
|
14
14
|
@import url("./src/elements/XImage/x-image.css");
|
|
15
15
|
@import url("./src/elements/XInput/x-input.css");
|
|
16
|
+
@import url("./src/elements/XMarkdown/x-markdown.css");
|
|
16
17
|
@import url("./src/elements/XOverlayNg/x-overlay-ng.css");
|
|
17
18
|
@import url("./src/elements/XRefreshView/x-refresh-view.css");
|
|
18
19
|
@import url("./src/elements/XSwiper/x-swiper.css");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lynx-js/web-elements",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"exports": {
|
|
14
14
|
".": {
|
|
15
|
+
"@lynx-js/source-field": "./src/elements/index.ts",
|
|
15
16
|
"types": "./dist/elements/index.d.ts",
|
|
16
17
|
"default": "./dist/elements/index.js"
|
|
17
18
|
},
|
|
@@ -58,6 +59,11 @@
|
|
|
58
59
|
"types": "./dist/elements/XInput/index.d.ts",
|
|
59
60
|
"default": "./dist/elements/XInput/index.js"
|
|
60
61
|
},
|
|
62
|
+
"./XMarkdown": {
|
|
63
|
+
"@lynx-js/source-field": "./src/elements/XMarkdown/index.ts",
|
|
64
|
+
"types": "./dist/elements/XMarkdown/index.d.ts",
|
|
65
|
+
"default": "./dist/elements/XMarkdown/index.js"
|
|
66
|
+
},
|
|
61
67
|
"./XOverlayNg": {
|
|
62
68
|
"@lynx-js/source-field": "./src/elements/XOverlayNg/index.ts",
|
|
63
69
|
"types": "./dist/elements/XOverlayNg/index.d.ts",
|
|
@@ -112,7 +118,8 @@
|
|
|
112
118
|
"@lynx-js/source-field": "./src/elements/htmlTemplates.ts",
|
|
113
119
|
"types": "./dist/elements/htmlTemplates.d.ts",
|
|
114
120
|
"default": "./dist/elements/htmlTemplates.js"
|
|
115
|
-
}
|
|
121
|
+
},
|
|
122
|
+
"./package.json": "./package.json"
|
|
116
123
|
},
|
|
117
124
|
"main": "dist/index.js",
|
|
118
125
|
"typings": "dist/index.d.ts",
|
|
@@ -126,10 +133,15 @@
|
|
|
126
133
|
"index.css",
|
|
127
134
|
"**/*.css"
|
|
128
135
|
],
|
|
136
|
+
"dependencies": {
|
|
137
|
+
"dompurify": "^3.3.1",
|
|
138
|
+
"markdown-it": "^14.1.0"
|
|
139
|
+
},
|
|
129
140
|
"devDependencies": {
|
|
130
141
|
"@playwright/test": "^1.58.2",
|
|
131
|
-
"@rsbuild/core": "1.7.
|
|
142
|
+
"@rsbuild/core": "1.7.5",
|
|
132
143
|
"@rsbuild/plugin-source-build": "1.0.4",
|
|
144
|
+
"@types/markdown-it": "^14.1.1",
|
|
133
145
|
"nyc": "^17.1.0",
|
|
134
146
|
"tslib": "^2.8.1",
|
|
135
147
|
"@lynx-js/playwright-fixtures": "0.0.0"
|
|
@@ -157,6 +157,37 @@ x-list[x-enable-scrolltoloweredge-event]::part(lower-threshold-observer) {
|
|
|
157
157
|
display: flex;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
x-list[x-enable-scrolltoupper-event]::part(upper-threshold-sentinel),
|
|
161
|
+
x-list[x-enable-scrolltoupperedge-event]::part(upper-threshold-sentinel),
|
|
162
|
+
x-list[x-enable-scrolltolower-event]::part(lower-threshold-sentinel),
|
|
163
|
+
x-list[x-enable-scrolltoloweredge-event]::part(lower-threshold-sentinel) {
|
|
164
|
+
flex: 0 0 1px;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
x-list[x-enable-scrolltoupper-event]::part(upper-threshold-sentinel),
|
|
168
|
+
x-list[x-enable-scrolltoupperedge-event]::part(upper-threshold-sentinel) {
|
|
169
|
+
margin-bottom: -1px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
x-list[x-enable-scrolltolower-event]::part(lower-threshold-sentinel),
|
|
173
|
+
x-list[x-enable-scrolltoloweredge-event]::part(lower-threshold-sentinel) {
|
|
174
|
+
margin-top: -1px;
|
|
175
|
+
transform: translateY(1px);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
x-list[scroll-orientation="horizontal"][x-enable-scrolltoupper-event]::part(upper-threshold-sentinel),
|
|
179
|
+
x-list[scroll-orientation="horizontal"][x-enable-scrolltoupperedge-event]::part(upper-threshold-sentinel) {
|
|
180
|
+
margin-bottom: 0;
|
|
181
|
+
margin-right: -1px;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
x-list[scroll-orientation="horizontal"][x-enable-scrolltolower-event]::part(lower-threshold-sentinel),
|
|
185
|
+
x-list[scroll-orientation="horizontal"][x-enable-scrolltoloweredge-event]::part(lower-threshold-sentinel) {
|
|
186
|
+
margin-top: 0;
|
|
187
|
+
margin-left: -1px;
|
|
188
|
+
transform: translateX(1px);
|
|
189
|
+
}
|
|
190
|
+
|
|
160
191
|
x-list::part(lower-threshold-observer) {
|
|
161
192
|
flex-direction: column-reverse;
|
|
162
193
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
// Copyright 2024 The Lynx Authors. All rights reserved.
|
|
3
|
+
// Licensed under the Apache License Version 2.0 that can be found in the
|
|
4
|
+
// LICENSE file in the root directory of this source tree.
|
|
5
|
+
*/
|
|
6
|
+
x-markdown {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
align-items: stretch;
|
|
10
|
+
color: inherit;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
x-markdown::part(root) {
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|