@fusion.dev/helix-headless 0.33.0 → 0.33.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/custom-elements.json
CHANGED
|
@@ -15600,7 +15600,7 @@
|
|
|
15600
15600
|
"name": "context"
|
|
15601
15601
|
},
|
|
15602
15602
|
{
|
|
15603
|
-
"description": "The copy button.",
|
|
15603
|
+
"description": "The copy button: in the header where there is one, and otherwise beside the code.",
|
|
15604
15604
|
"name": "copy"
|
|
15605
15605
|
},
|
|
15606
15606
|
{
|
|
@@ -15660,11 +15660,11 @@
|
|
|
15660
15660
|
"name": "filler"
|
|
15661
15661
|
},
|
|
15662
15662
|
{
|
|
15663
|
-
"description": "The code and the copy button beside it.",
|
|
15663
|
+
"description": "The code, and the copy button beside it where there is no header.",
|
|
15664
15664
|
"name": "frame"
|
|
15665
15665
|
},
|
|
15666
15666
|
{
|
|
15667
|
-
"description": "The bar carrying the name, where there is
|
|
15667
|
+
"description": "The bar carrying the name and the copy button, where there is a name.",
|
|
15668
15668
|
"name": "header"
|
|
15669
15669
|
},
|
|
15670
15670
|
{
|
|
@@ -15783,6 +15783,51 @@
|
|
|
15783
15783
|
"description": "The code as text, read from what the default slot is given rather than\nstored.\n\n**The host's own children rather than the slot's assigned nodes**, which\nare the same nodes: text, and every element without a `slot`. A slot exists\nonly once a render has made it, so reading through one left the first render\nwith nothing to copy.\n\nClient only, and it has to be: the server has no children to read. The\ncopy button is a client-side affordance anyway, so nothing is lost, and\ntaking the text from a property instead would be a second copy of the code\nthat goes stale the moment the slot changes. Empty while hydrating what a\nserver sent, which rendered it empty.",
|
|
15784
15784
|
"readonly": true
|
|
15785
15785
|
},
|
|
15786
|
+
{
|
|
15787
|
+
"kind": "method",
|
|
15788
|
+
"name": "renderHeader",
|
|
15789
|
+
"privacy": "private",
|
|
15790
|
+
"return": {
|
|
15791
|
+
"type": {
|
|
15792
|
+
"text": "TemplateResult | typeof nothing"
|
|
15793
|
+
}
|
|
15794
|
+
},
|
|
15795
|
+
"parameters": [
|
|
15796
|
+
{
|
|
15797
|
+
"name": "name",
|
|
15798
|
+
"type": {
|
|
15799
|
+
"text": "string"
|
|
15800
|
+
}
|
|
15801
|
+
},
|
|
15802
|
+
{
|
|
15803
|
+
"name": "value",
|
|
15804
|
+
"optional": true,
|
|
15805
|
+
"type": {
|
|
15806
|
+
"text": "string"
|
|
15807
|
+
}
|
|
15808
|
+
}
|
|
15809
|
+
],
|
|
15810
|
+
"description": "The name with the copy button beside it, or nothing when there is no name.\n\n**The button is in the header wherever there is one**, because beside the\ncode it stands over the block and the block has to make room for it. A\ndiff cannot: its washes run to the edge, so the button stood on the hunk\nline and the line under it. In the header it is over nothing.\n\n**No name draws no header**, rather than a bar to hold one button, which\nturned a `Usage` section of one-line imports into a run of empty strips.\nThe button then stands beside the code, in room the block keeps for it."
|
|
15811
|
+
},
|
|
15812
|
+
{
|
|
15813
|
+
"kind": "method",
|
|
15814
|
+
"name": "renderCopy",
|
|
15815
|
+
"privacy": "private",
|
|
15816
|
+
"return": {
|
|
15817
|
+
"type": {
|
|
15818
|
+
"text": "TemplateResult | typeof nothing"
|
|
15819
|
+
}
|
|
15820
|
+
},
|
|
15821
|
+
"parameters": [
|
|
15822
|
+
{
|
|
15823
|
+
"name": "value",
|
|
15824
|
+
"optional": true,
|
|
15825
|
+
"type": {
|
|
15826
|
+
"text": "string"
|
|
15827
|
+
}
|
|
15828
|
+
}
|
|
15829
|
+
]
|
|
15830
|
+
},
|
|
15786
15831
|
{
|
|
15787
15832
|
"kind": "method",
|
|
15788
15833
|
"name": "renderCopyButton",
|
|
@@ -53,7 +53,7 @@ import '../../copy-button/index.js';
|
|
|
53
53
|
* @csspart block - The scrolling `<pre>`.
|
|
54
54
|
* @csspart code - The `<code>` inside it.
|
|
55
55
|
* @csspart context - In a diff, a line both versions share.
|
|
56
|
-
* @csspart copy - The copy button.
|
|
56
|
+
* @csspart copy - The copy button: in the header where there is one, and otherwise beside the code.
|
|
57
57
|
* @csspart copy-button - The inner button.
|
|
58
58
|
* @csspart copy-mark - The clipboard glyph, and the confirmation that replaces it.
|
|
59
59
|
* @csspart copy-tooltip - The bubble, forwarded from the tooltip inside.
|
|
@@ -68,8 +68,8 @@ import '../../copy-button/index.js';
|
|
|
68
68
|
* @csspart copy-tooltip-top - The bubble while it is above the copy button, beside `copy-tooltip`.
|
|
69
69
|
* @csspart file - In a diff, one file's header and block.
|
|
70
70
|
* @csspart filler - In a split diff, the empty row opposite a line the other side does not have.
|
|
71
|
-
* @csspart frame - The code and the copy button beside it.
|
|
72
|
-
* @csspart header - The bar carrying the name, where there is
|
|
71
|
+
* @csspart frame - The code, and the copy button beside it where there is no header.
|
|
72
|
+
* @csspart header - The bar carrying the name and the copy button, where there is a name.
|
|
73
73
|
* @csspart hunk - In a diff, a `@@` line saying where the lines under it are.
|
|
74
74
|
* @csspart label - The file name or language, where one is given.
|
|
75
75
|
* @csspart marker - In a diff, the `+`, `-` or space that opens a line.
|
|
@@ -147,6 +147,20 @@ export declare class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
147
147
|
private get text();
|
|
148
148
|
protected firstUpdated(changed: PropertyValues): void;
|
|
149
149
|
protected render(): TemplateResult;
|
|
150
|
+
/**
|
|
151
|
+
* The name with the copy button beside it, or nothing when there is no name.
|
|
152
|
+
*
|
|
153
|
+
* **The button is in the header wherever there is one**, because beside the
|
|
154
|
+
* code it stands over the block and the block has to make room for it. A
|
|
155
|
+
* diff cannot: its washes run to the edge, so the button stood on the hunk
|
|
156
|
+
* line and the line under it. In the header it is over nothing.
|
|
157
|
+
*
|
|
158
|
+
* **No name draws no header**, rather than a bar to hold one button, which
|
|
159
|
+
* turned a `Usage` section of one-line imports into a run of empty strips.
|
|
160
|
+
* The button then stands beside the code, in room the block keeps for it.
|
|
161
|
+
*/
|
|
162
|
+
private renderHeader;
|
|
163
|
+
private renderCopy;
|
|
150
164
|
/**
|
|
151
165
|
* The button that takes the code, behind a seam the styled tier can move.
|
|
152
166
|
*
|
|
@@ -47,12 +47,20 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
47
47
|
if (files.length > 0) {
|
|
48
48
|
return this.renderDiff(files);
|
|
49
49
|
}
|
|
50
|
-
return html `${this.
|
|
50
|
+
return html `${this.renderHeader(this.label)}
|
|
51
51
|
<div part="frame">
|
|
52
52
|
<pre part="block"><code part="code"><slot @slotchange=${() => this.requestUpdate()}></slot></code></pre>
|
|
53
|
-
${this.
|
|
53
|
+
${this.label ? nothing : this.renderCopy()}
|
|
54
54
|
</div>`;
|
|
55
55
|
}
|
|
56
|
+
renderHeader(name, value) {
|
|
57
|
+
return name
|
|
58
|
+
? html `<div part="header"><span part="label">${name}</span>${this.renderCopy(value)}</div>`
|
|
59
|
+
: nothing;
|
|
60
|
+
}
|
|
61
|
+
renderCopy(value) {
|
|
62
|
+
return this.noCopy ? nothing : this.renderCopyButton(value);
|
|
63
|
+
}
|
|
56
64
|
renderCopyButton(value = this.text) {
|
|
57
65
|
return html `<${this.tag('copy-button')}
|
|
58
66
|
part="copy"
|
|
@@ -102,12 +110,12 @@ let HelixHeadlessCodeBlock = class HelixHeadlessCodeBlock extends HelixElement {
|
|
|
102
110
|
.map((line) => line.text)
|
|
103
111
|
.join('\n');
|
|
104
112
|
return html `<div part="file">
|
|
105
|
-
${name
|
|
113
|
+
${this.renderHeader(name, now)}
|
|
106
114
|
<div part="frame">
|
|
107
115
|
${this.variant === 'split'
|
|
108
116
|
? this.renderSplit(file, width)
|
|
109
117
|
: html `<pre part="block"><code part="code">${file.hunks.map((hunk) => html `${this.renderHunk(hunk)}${hunk.lines.map((line) => this.renderLine(line, width))}`)}</code></pre>`}
|
|
110
|
-
${
|
|
118
|
+
${name ? nothing : this.renderCopy(now)}
|
|
111
119
|
</div>
|
|
112
120
|
</div>`;
|
|
113
121
|
})}<slot hidden @slotchange=${() => this.requestUpdate()}></slot>`;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-headless",
|
|
3
3
|
"description": "Headless component tier. Structure, accessibility, state, and form participation. No styling.",
|
|
4
|
-
"version": "0.33.
|
|
4
|
+
"version": "0.33.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Ross Sheppard <ross.sheppard@fusion.dev>",
|
|
7
7
|
"repository": {
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
},
|
|
47
47
|
"bugs": "https://github.com/project-fusion/fusion/issues",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@fusion.dev/helix-core": "0.33.
|
|
50
|
-
"@fusion.dev/helix-icons": "0.33.
|
|
49
|
+
"@fusion.dev/helix-core": "0.33.1",
|
|
50
|
+
"@fusion.dev/helix-icons": "0.33.1",
|
|
51
51
|
"uqr": "^0.1.3"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
|
55
|
-
"@fusion.dev/helix-cem": "0.33.
|
|
56
|
-
"@fusion.dev/helix-testing": "0.33.
|
|
55
|
+
"@fusion.dev/helix-cem": "0.33.1",
|
|
56
|
+
"@fusion.dev/helix-testing": "0.33.1",
|
|
57
57
|
"@fusion.dev/scripts": "0.0.0-dev",
|
|
58
58
|
"@happy-dom/global-registrator": "^20.0.0",
|
|
59
59
|
"@lit-labs/ssr": "^4.1.0",
|
package/types/jsx.d.ts
CHANGED
|
@@ -19655,7 +19655,7 @@ export type CustomElements = {
|
|
|
19655
19655
|
* - `block`: The scrolling `<pre>`.
|
|
19656
19656
|
* - `code`: The `<code>` inside it.
|
|
19657
19657
|
* - `context`: In a diff, a line both versions share.
|
|
19658
|
-
* - `copy`: The copy button.
|
|
19658
|
+
* - `copy`: The copy button: in the header where there is one, and otherwise beside the code.
|
|
19659
19659
|
* - `copy-button`: The inner button.
|
|
19660
19660
|
* - `copy-mark`: The clipboard glyph, and the confirmation that replaces it.
|
|
19661
19661
|
* - `copy-tooltip`: The bubble, forwarded from the tooltip inside.
|
|
@@ -19670,8 +19670,8 @@ export type CustomElements = {
|
|
|
19670
19670
|
* - `copy-tooltip-top`: The bubble while it is above the copy button, beside `copy-tooltip`.
|
|
19671
19671
|
* - `file`: In a diff, one file's header and block.
|
|
19672
19672
|
* - `filler`: In a split diff, the empty row opposite a line the other side does not have.
|
|
19673
|
-
* - `frame`: The code and the copy button beside it.
|
|
19674
|
-
* - `header`: The bar carrying the name, where there is
|
|
19673
|
+
* - `frame`: The code, and the copy button beside it where there is no header.
|
|
19674
|
+
* - `header`: The bar carrying the name and the copy button, where there is a name.
|
|
19675
19675
|
* - `hunk`: In a diff, a `@@` line saying where the lines under it are.
|
|
19676
19676
|
* - `label`: The file name or language, where one is given.
|
|
19677
19677
|
* - `marker`: In a diff, the `+`, `-` or space that opens a line.
|
|
@@ -37058,7 +37058,7 @@ export type CustomElementsSolidJs = {
|
|
|
37058
37058
|
* - `block`: The scrolling `<pre>`.
|
|
37059
37059
|
* - `code`: The `<code>` inside it.
|
|
37060
37060
|
* - `context`: In a diff, a line both versions share.
|
|
37061
|
-
* - `copy`: The copy button.
|
|
37061
|
+
* - `copy`: The copy button: in the header where there is one, and otherwise beside the code.
|
|
37062
37062
|
* - `copy-button`: The inner button.
|
|
37063
37063
|
* - `copy-mark`: The clipboard glyph, and the confirmation that replaces it.
|
|
37064
37064
|
* - `copy-tooltip`: The bubble, forwarded from the tooltip inside.
|
|
@@ -37073,8 +37073,8 @@ export type CustomElementsSolidJs = {
|
|
|
37073
37073
|
* - `copy-tooltip-top`: The bubble while it is above the copy button, beside `copy-tooltip`.
|
|
37074
37074
|
* - `file`: In a diff, one file's header and block.
|
|
37075
37075
|
* - `filler`: In a split diff, the empty row opposite a line the other side does not have.
|
|
37076
|
-
* - `frame`: The code and the copy button beside it.
|
|
37077
|
-
* - `header`: The bar carrying the name, where there is
|
|
37076
|
+
* - `frame`: The code, and the copy button beside it where there is no header.
|
|
37077
|
+
* - `header`: The bar carrying the name and the copy button, where there is a name.
|
|
37078
37078
|
* - `hunk`: In a diff, a `@@` line saying where the lines under it are.
|
|
37079
37079
|
* - `label`: The file name or language, where one is given.
|
|
37080
37080
|
* - `marker`: In a diff, the `+`, `-` or space that opens a line.
|