@riebeckite/plugin-ux 0.0.5 → 0.0.7
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/client.js +3 -1
- package/dist/index.js +4 -1
- package/dist/src/inject.d.ts +2 -1
- package/package.json +2 -2
- package/style.css +123 -127
package/dist/client.js
CHANGED
|
@@ -200,7 +200,9 @@ function setupTocScrollSpy() {
|
|
|
200
200
|
scheduleOnScroll(updateActive);
|
|
201
201
|
}
|
|
202
202
|
function setupCodeCopy(config) {
|
|
203
|
-
const blocks = Array.from(
|
|
203
|
+
const blocks = Array.from(
|
|
204
|
+
document.querySelectorAll("pre > code")
|
|
205
|
+
);
|
|
204
206
|
for (const code of blocks) {
|
|
205
207
|
const pre = code.parentElement;
|
|
206
208
|
if (!pre || pre.dataset.rbUxCopy === "true") continue;
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,9 @@ import {
|
|
|
6
6
|
isPublished
|
|
7
7
|
} from "@riebeckite/core";
|
|
8
8
|
|
|
9
|
+
// src/inject.ts
|
|
10
|
+
import { escapeScriptJson } from "@riebeckite/core";
|
|
11
|
+
|
|
9
12
|
// src/options.ts
|
|
10
13
|
var UX_CONFIG_ELEMENT_ID = "rb-ux-config";
|
|
11
14
|
var UX_CONFIG_ATTRIBUTE = "data-rb-ux-config";
|
|
@@ -41,7 +44,7 @@ function normalizeLabel(value, fallback) {
|
|
|
41
44
|
|
|
42
45
|
// src/inject.ts
|
|
43
46
|
function renderUxConfigElement(config) {
|
|
44
|
-
const json = JSON.stringify(config)
|
|
47
|
+
const json = escapeScriptJson(JSON.stringify(config));
|
|
45
48
|
return `<script type="application/json" id="${UX_CONFIG_ELEMENT_ID}" ${UX_CONFIG_ATTRIBUTE}>${json}</script>`;
|
|
46
49
|
}
|
|
47
50
|
function injectUxConfig(html, config) {
|
package/dist/src/inject.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import { type UxResolvedConfig } from "./options.js";
|
|
|
4
4
|
*
|
|
5
5
|
* Client initializers are static and receive no plugin options, so the build
|
|
6
6
|
* injects this element into the article HTML and reads it back at runtime.
|
|
7
|
-
*
|
|
7
|
+
* `escapeScriptJson` neutralizes `<`, `>`, `&`, U+2028 and U+2029 so labels
|
|
8
|
+
* can never terminate the script element.
|
|
8
9
|
*/
|
|
9
10
|
export declare function renderUxConfigElement(config: UxResolvedConfig): string;
|
|
10
11
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-ux",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"./style.css": "./style.css"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@riebeckite/core": "0.0.
|
|
24
|
+
"@riebeckite/core": "0.0.7"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public"
|
package/style.css
CHANGED
|
@@ -1,127 +1,123 @@
|
|
|
1
|
-
.rb-ux__progress {
|
|
2
|
-
position: fixed;
|
|
3
|
-
inset-block-start: 0;
|
|
4
|
-
inset-inline: 0;
|
|
5
|
-
z-index: 60;
|
|
6
|
-
height: 3px;
|
|
7
|
-
pointer-events: none;
|
|
8
|
-
background: color-mix(
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.rb-ux__back-to-top:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.rb-
|
|
73
|
-
position:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
.rb-ux__copy {
|
|
125
|
-
display: none;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
1
|
+
.rb-ux__progress {
|
|
2
|
+
position: fixed;
|
|
3
|
+
inset-block-start: 0;
|
|
4
|
+
inset-inline: 0;
|
|
5
|
+
z-index: 60;
|
|
6
|
+
height: 3px;
|
|
7
|
+
pointer-events: none;
|
|
8
|
+
background: color-mix(in srgb, var(--rb-color-ink, #1c1a17) 8%, transparent);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.rb-ux__progress-bar {
|
|
12
|
+
display: block;
|
|
13
|
+
width: 100%;
|
|
14
|
+
height: 100%;
|
|
15
|
+
transform: scaleX(0);
|
|
16
|
+
transform-origin: left center;
|
|
17
|
+
background: var(--rb-color-accent, #686868);
|
|
18
|
+
transition: transform 100ms linear;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rb-ux__back-to-top {
|
|
22
|
+
position: fixed;
|
|
23
|
+
inset-block-end: 1.5rem;
|
|
24
|
+
inset-inline-end: 1.5rem;
|
|
25
|
+
z-index: 60;
|
|
26
|
+
display: grid;
|
|
27
|
+
place-items: center;
|
|
28
|
+
width: 2.75rem;
|
|
29
|
+
height: 2.75rem;
|
|
30
|
+
padding: 0;
|
|
31
|
+
border: 1px solid
|
|
32
|
+
var(--rb-color-border-strong, var(--rb-color-border, #d0ccc4));
|
|
33
|
+
border-radius: 999px;
|
|
34
|
+
background: var(--rb-color-surface, var(--rb-color-paper, #ffffff));
|
|
35
|
+
color: var(--rb-color-ink, #1c1a17);
|
|
36
|
+
font-size: 1.15rem;
|
|
37
|
+
line-height: 1;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
opacity: 0;
|
|
40
|
+
visibility: hidden;
|
|
41
|
+
transform: translateY(0.5rem);
|
|
42
|
+
transition:
|
|
43
|
+
opacity 150ms ease,
|
|
44
|
+
transform 150ms ease,
|
|
45
|
+
visibility 150ms ease;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.rb-ux__back-to-top--visible {
|
|
49
|
+
opacity: 1;
|
|
50
|
+
visibility: visible;
|
|
51
|
+
transform: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.rb-ux__back-to-top:hover {
|
|
55
|
+
background: var(--rb-color-surface-hover, var(--rb-color-surface, #f4f2ee));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.rb-ux__back-to-top:focus-visible {
|
|
59
|
+
outline: 2px solid var(--rb-color-accent, #686868);
|
|
60
|
+
outline-offset: 2px;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.rb-ux__toc-active {
|
|
64
|
+
color: var(--rb-color-accent, #686868);
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.rb-ux__code {
|
|
69
|
+
position: relative;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rb-ux__copy {
|
|
73
|
+
position: absolute;
|
|
74
|
+
inset-block-start: 0.5rem;
|
|
75
|
+
inset-inline-end: 0.5rem;
|
|
76
|
+
z-index: 1;
|
|
77
|
+
padding: 0.2rem 0.5rem;
|
|
78
|
+
border: 1px solid
|
|
79
|
+
var(--rb-color-border, color-mix(in srgb, currentColor 20%, transparent));
|
|
80
|
+
border-radius: 4px;
|
|
81
|
+
background: var(--rb-color-surface, var(--rb-color-paper, #ffffff));
|
|
82
|
+
color: var(--rb-color-muted, #69645c);
|
|
83
|
+
font-size: 0.75rem;
|
|
84
|
+
line-height: 1.4;
|
|
85
|
+
cursor: pointer;
|
|
86
|
+
opacity: 0.9;
|
|
87
|
+
transition:
|
|
88
|
+
opacity 120ms ease,
|
|
89
|
+
color 120ms ease,
|
|
90
|
+
border-color 120ms ease;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.rb-ux__copy:hover,
|
|
94
|
+
.rb-ux__copy:focus-visible {
|
|
95
|
+
opacity: 1;
|
|
96
|
+
color: var(--rb-color-ink, #1c1a17);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.rb-ux__copy:focus-visible {
|
|
100
|
+
outline: 2px solid var(--rb-color-accent, #686868);
|
|
101
|
+
outline-offset: 2px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.rb-ux__copy--copied {
|
|
105
|
+
color: var(--rb-color-accent, #686868);
|
|
106
|
+
border-color: var(--rb-color-accent, #686868);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
@media (prefers-reduced-motion: reduce) {
|
|
110
|
+
.rb-ux__progress-bar,
|
|
111
|
+
.rb-ux__back-to-top,
|
|
112
|
+
.rb-ux__copy {
|
|
113
|
+
transition: none;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@media print {
|
|
118
|
+
.rb-ux__progress,
|
|
119
|
+
.rb-ux__back-to-top,
|
|
120
|
+
.rb-ux__copy {
|
|
121
|
+
display: none;
|
|
122
|
+
}
|
|
123
|
+
}
|