@kyndryl-design-system/shidoka-applications 2.94.2 → 2.95.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.
Files changed (29) hide show
  1. package/common/scss/_resizable-drag-handle.scss +218 -0
  2. package/components/reusable/blockCodeView/blockCodeView.d.ts +5 -0
  3. package/components/reusable/blockCodeView/blockCodeView.d.ts.map +1 -1
  4. package/components/reusable/blockCodeView/blockCodeView.js +77 -11
  5. package/components/reusable/blockCodeView/blockCodeView.js.map +1 -1
  6. package/components/reusable/divider/divider.d.ts +21 -0
  7. package/components/reusable/divider/divider.d.ts.map +1 -1
  8. package/components/reusable/divider/divider.js +261 -7
  9. package/components/reusable/divider/divider.js.map +1 -1
  10. package/components/reusable/divider/index.js +1 -1
  11. package/components/reusable/sideDrawer/sideDrawer.js +35 -14
  12. package/components/reusable/sideDrawer/sideDrawer.js.map +1 -1
  13. package/components/reusable/splitView/index.d.ts +2 -0
  14. package/components/reusable/splitView/index.d.ts.map +1 -0
  15. package/components/reusable/splitView/index.js +2 -0
  16. package/components/reusable/splitView/index.js.map +1 -0
  17. package/components/reusable/splitView/splitView.d.ts +118 -0
  18. package/components/reusable/splitView/splitView.d.ts.map +1 -0
  19. package/components/reusable/splitView/splitView.js +201 -0
  20. package/components/reusable/splitView/splitView.js.map +1 -0
  21. package/components/reusable/table/index.js +1 -1
  22. package/components/reusable/table/table-header.js +1 -1
  23. package/components/reusable/table/table.skeleton.js +1 -1
  24. package/index.d.ts +1 -0
  25. package/index.d.ts.map +1 -1
  26. package/index.js +1 -1
  27. package/package.json +1 -1
  28. package/{table.skeleton-8SeANQrs.js → table.skeleton-Z5CiwFgv.js} +2 -2
  29. package/{table.skeleton-8SeANQrs.js.map → table.skeleton-Z5CiwFgv.js.map} +1 -1
@@ -0,0 +1,218 @@
1
+ // Shared drag grip for kyn-side-drawer and kyn-divider[drag-handle].
2
+ // Expects: <div class="drag-handle"><span class="drag-lines"></span></div>
3
+ //
4
+ // Custom properties (set on host or ancestor to override):
5
+ // --kyn-resize-grip-line / -active both grip lines
6
+ // --kyn-resize-grip-line-start / -end per-line color (light/dark border)
7
+ // --kyn-resize-grip-line-start-active / -end-active
8
+ // --kyn-resize-grip-surface-hover / -drag surface fills
9
+
10
+ @mixin resizable-drag-handle-vertical($width, $border-radius: 4px) {
11
+ $line: var(
12
+ --kyn-resize-grip-line,
13
+ var(--kyn-color-side-drawer-icon, var(--kd-color-icon-secondary))
14
+ );
15
+ $line-active: var(
16
+ --kyn-resize-grip-line-active,
17
+ var(--kd-color-icon-tertiary)
18
+ );
19
+
20
+ .drag-handle {
21
+ position: absolute;
22
+ top: 0;
23
+ left: 0;
24
+ bottom: 0;
25
+ width: $width;
26
+ cursor: ew-resize;
27
+ background: transparent;
28
+ border-radius: $border-radius;
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ transition: background-color 150ms ease-out;
33
+ z-index: 2;
34
+
35
+ &:hover {
36
+ background: var(
37
+ --kyn-resize-grip-surface-hover,
38
+ var(--kd-color-border-variants-light)
39
+ );
40
+
41
+ .drag-lines {
42
+ &::before {
43
+ background: var(
44
+ --kyn-resize-grip-line-start-active,
45
+ var(--kyn-resize-grip-line-active, var(--kd-color-icon-tertiary))
46
+ );
47
+ }
48
+
49
+ &::after {
50
+ background: var(
51
+ --kyn-resize-grip-line-end-active,
52
+ var(--kyn-resize-grip-line-active, var(--kd-color-icon-tertiary))
53
+ );
54
+ }
55
+ }
56
+ }
57
+
58
+ &.dragging {
59
+ background: var(
60
+ --kyn-resize-grip-surface-drag,
61
+ var(--kd-color-border-variants-drag)
62
+ );
63
+
64
+ .drag-lines {
65
+ &::before {
66
+ background: var(
67
+ --kyn-resize-grip-line-start-active,
68
+ var(--kyn-resize-grip-line-active, var(--kd-color-icon-tertiary))
69
+ );
70
+ }
71
+
72
+ &::after {
73
+ background: var(
74
+ --kyn-resize-grip-line-end-active,
75
+ var(--kyn-resize-grip-line-active, var(--kd-color-icon-tertiary))
76
+ );
77
+ }
78
+ }
79
+ }
80
+ }
81
+
82
+ .drag-lines {
83
+ display: flex;
84
+ flex-direction: row;
85
+ align-items: stretch;
86
+ justify-content: center;
87
+ flex: 0 0 auto;
88
+ gap: 2px;
89
+ width: auto;
90
+ height: 32px;
91
+ pointer-events: none;
92
+
93
+ &::before {
94
+ content: '';
95
+ display: block;
96
+ flex: 0 0 1px;
97
+ width: 1px;
98
+ height: 32px;
99
+ background: var(--kyn-resize-grip-line-start, #{$line});
100
+ transition: background-color 150ms ease-out;
101
+ }
102
+
103
+ &::after {
104
+ content: '';
105
+ display: block;
106
+ flex: 0 0 1px;
107
+ width: 1px;
108
+ height: 32px;
109
+ background: var(--kyn-resize-grip-line-end, #{$line});
110
+ transition: background-color 150ms ease-out;
111
+ }
112
+ }
113
+ }
114
+
115
+ @mixin resizable-drag-handle-horizontal($height, $border-radius: 4px) {
116
+ $line: var(
117
+ --kyn-resize-grip-line,
118
+ var(--kyn-color-side-drawer-icon, var(--kd-color-icon-secondary))
119
+ );
120
+ $line-active: var(
121
+ --kyn-resize-grip-line-active,
122
+ var(--kd-color-icon-tertiary)
123
+ );
124
+
125
+ .drag-handle {
126
+ position: absolute;
127
+ left: 0;
128
+ right: 0;
129
+ top: 0;
130
+ height: $height;
131
+ cursor: ns-resize;
132
+ background: transparent;
133
+ border-radius: $border-radius;
134
+ display: flex;
135
+ align-items: center;
136
+ justify-content: center;
137
+ transition: background-color 150ms ease-out;
138
+ z-index: 2;
139
+
140
+ &:hover {
141
+ background: var(
142
+ --kyn-resize-grip-surface-hover,
143
+ var(--kd-color-border-variants-light)
144
+ );
145
+
146
+ .drag-lines {
147
+ &::before {
148
+ background: var(
149
+ --kyn-resize-grip-line-start-active,
150
+ var(--kyn-resize-grip-line-active, var(--kd-color-icon-tertiary))
151
+ );
152
+ }
153
+
154
+ &::after {
155
+ background: var(
156
+ --kyn-resize-grip-line-end-active,
157
+ var(--kyn-resize-grip-line-active, var(--kd-color-icon-tertiary))
158
+ );
159
+ }
160
+ }
161
+ }
162
+
163
+ &.dragging {
164
+ background: var(
165
+ --kyn-resize-grip-surface-drag,
166
+ var(--kd-color-border-variants-drag)
167
+ );
168
+
169
+ .drag-lines {
170
+ &::before {
171
+ background: var(
172
+ --kyn-resize-grip-line-start-active,
173
+ var(--kyn-resize-grip-line-active, var(--kd-color-icon-tertiary))
174
+ );
175
+ }
176
+
177
+ &::after {
178
+ background: var(
179
+ --kyn-resize-grip-line-end-active,
180
+ var(--kyn-resize-grip-line-active, var(--kd-color-icon-tertiary))
181
+ );
182
+ }
183
+ }
184
+ }
185
+ }
186
+
187
+ .drag-lines {
188
+ display: flex;
189
+ flex-direction: column;
190
+ align-items: stretch;
191
+ justify-content: center;
192
+ flex: 0 0 auto;
193
+ gap: 2px;
194
+ width: 32px;
195
+ height: auto;
196
+ pointer-events: none;
197
+
198
+ &::before {
199
+ content: '';
200
+ display: block;
201
+ flex: 0 0 1px;
202
+ width: 32px;
203
+ height: 1px;
204
+ background: var(--kyn-resize-grip-line-start, #{$line});
205
+ transition: background-color 150ms ease-out;
206
+ }
207
+
208
+ &::after {
209
+ content: '';
210
+ display: block;
211
+ flex: 0 0 1px;
212
+ width: 32px;
213
+ height: 1px;
214
+ background: var(--kyn-resize-grip-line-end, #{$line});
215
+ transition: background-color 150ms ease-out;
216
+ }
217
+ }
218
+ }
@@ -18,6 +18,11 @@ export declare class BlockCodeView extends LitElement {
18
18
  accessor startLineNumber: number;
19
19
  /** Customizable max-height setting for code snippet container. */
20
20
  accessor maxHeight: number | null;
21
+ /**
22
+ * Enables a full-height flush layout intended for pane/rail containers where the code view
23
+ * should occupy the entire available height.
24
+ */
25
+ accessor flush: boolean;
21
26
  /** Optionally displayed label above code snippet container. */
22
27
  accessor codeViewLabel: string;
23
28
  /** Optionally display button to copy code snippet. */
@@ -1 +1 @@
1
- {"version":3,"file":"blockCodeView.d.ts","sourceRoot":"","sources":["../../../../src/components/reusable/blockCodeView/blockCodeView.ts"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,UAAU,CAAC,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC;IAMtD,OAAO,CAAC,aAAa;IAsDrB,OAAO,CAAC,cAAc;IAmBtB,OAAO,CAAC,cAAc;IAkCtB,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,iBAAiB;IAoBzB,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,uBAAuB;IAQ/B,OAAO,CAAC,aAAa;IAuBrB,OAAO,CAAC,uBAAuB;IAc/B,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,QAAQ;IA0BhB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,cAAc;CAmBvB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,qBAAqB,EAAE,aAAa,CAAC;KACtC;CACF"}
@@ -1,4 +1,4 @@
1
- import{__setFunctionName as e,__esDecorate as t,__runInitializers as i,__classPrivateFieldGet as o,__classPrivateFieldSet as a}from"tslib";import{unsafeSVG as n}from"lit-html/directives/unsafe-svg.js";import{css as s,LitElement as r,unsafeCSS as c,html as l}from"lit";import{customElement as d,property as h,state as p}from"lit/decorators.js";import{classMap as g}from"lit/directives/class-map.js";import{ifDefined as m}from"lit/directives/if-defined.js";import{deepmerge as u}from"deepmerge-ts";import k from"prismjs";import"prismjs/plugins/autoloader/prism-autoloader";import"prismjs/plugins/line-numbers/prism-line-numbers";import{a9 as v,aa as y,i as b}from"../../../vendor/@kyndryl-design-system/shidoka-icons-BKNlykoZ.js";import"../button/button.js";import"lit-html/directives/class-map.js";import"../../../common/helpers/helpers.js";import"../button/defs.js";var x,w=s`*,
1
+ import{__setFunctionName as e,__esDecorate as t,__runInitializers as i,__classPrivateFieldGet as o,__classPrivateFieldSet as a}from"tslib";import{unsafeSVG as n}from"lit-html/directives/unsafe-svg.js";import{css as s,LitElement as r,unsafeCSS as l,html as c}from"lit";import{customElement as d,property as h,state as p}from"lit/decorators.js";import{classMap as g}from"lit/directives/class-map.js";import{ifDefined as u}from"lit/directives/if-defined.js";import{deepmerge as m}from"deepmerge-ts";import k from"prismjs";import"prismjs/plugins/autoloader/prism-autoloader";import"prismjs/plugins/line-numbers/prism-line-numbers";import{a9 as v,aa as b,i as y}from"../../../vendor/@kyndryl-design-system/shidoka-icons-BKNlykoZ.js";import"../button/button.js";import"lit-html/directives/class-map.js";import"../../../common/helpers/helpers.js";import"../button/defs.js";var w,x=s`*,
2
2
  *::before,
3
3
  *::after {
4
4
  box-sizing: border-box;
@@ -37,6 +37,17 @@ import{__setFunctionName as e,__esDecorate as t,__runInitializers as i,__classPr
37
37
  position: relative;
38
38
  }
39
39
 
40
+ :host([flush]) {
41
+ display: flex;
42
+ flex-direction: column;
43
+ flex: 1 1 auto;
44
+ min-height: 0;
45
+ height: 100%;
46
+ width: 100%;
47
+ box-sizing: border-box;
48
+ background: var(--kd-color-code-view-background);
49
+ }
50
+
40
51
  pre.line-numbers {
41
52
  position: relative;
42
53
  padding-left: 0;
@@ -84,6 +95,61 @@ pre.line-numbers .line-numbers-rows > span:before {
84
95
  margin-left: -85px;
85
96
  }
86
97
 
98
+ :host([flush]) .multi-line.code-view__container {
99
+ flex: 1 1 auto;
100
+ min-height: 0;
101
+ height: 100%;
102
+ width: 100%;
103
+ display: flex;
104
+ flex-direction: column;
105
+ box-sizing: border-box;
106
+ border-radius: 0;
107
+ min-width: 0;
108
+ background: var(--kd-color-code-view-background);
109
+ padding: var(--kd-spacing-24);
110
+ }
111
+
112
+ :host([flush]) .multi-line.code-view__container .code-snippet-wrapper {
113
+ flex: 1 1 auto;
114
+ min-height: 0;
115
+ overflow: hidden;
116
+ display: flex;
117
+ flex-direction: column;
118
+ }
119
+
120
+ :host([flush]) .multi-line.code-view__container pre.no-line-numbers code {
121
+ margin-left: 0 !important;
122
+ }
123
+
124
+ :host([flush]) .multi-line.code-view__container pre {
125
+ flex: 1 1 auto;
126
+ min-height: 0;
127
+ overflow: auto;
128
+ max-height: none !important;
129
+ margin: 0;
130
+ padding: 0;
131
+ box-sizing: border-box;
132
+ white-space: pre-wrap;
133
+ word-break: break-word;
134
+ overflow-wrap: anywhere;
135
+ tab-size: 2;
136
+ }
137
+
138
+ :host([flush]) .multi-line.code-view__container pre code {
139
+ display: block;
140
+ width: 100%;
141
+ max-width: 100%;
142
+ white-space: pre-wrap;
143
+ word-break: break-word;
144
+ overflow-wrap: anywhere;
145
+ }
146
+
147
+ /* Copy control sits in the padded inset in flush mode. */
148
+ :host([flush]) .multi-line.code-view__container .code-view__copy-button {
149
+ top: calc(var(--kd-spacing-24) + var(--kd-spacing-8));
150
+ right: calc(var(--kd-spacing-24) + var(--kd-spacing-8));
151
+ }
152
+
87
153
  .code-view__label {
88
154
  margin-bottom: var(--kd-spacing-12);
89
155
  }
@@ -637,8 +703,8 @@ code.language-git:before {
637
703
  .shidoka-syntax-theme .code-snippet-wrapper pre *::-moz-selection {
638
704
  background-color: light-dark(rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.3));
639
705
  color: inherit;
640
- }`;const _={collapsed:"Collapsed",expanded:"Expanded"},S=k;(null===(x=S.plugins)||void 0===x?void 0:x.autoloader)&&(S.plugins.autoloader.languages_path="https://cdn.jsdelivr.net/npm/prismjs@1/components/");const L={markup:["<",">","/","div","span","class","id"],html:["<",">","/","div","span","class","id"],css:["{","}",":",";","#","."],javascript:["function","const","let","var","=>"],typescript:["interface","type",":","as"],python:["def","import","from","class"],java:["public","private","class","void"]};let z=(()=>{var s,x,S,z,T,C,H,O,E,N,j,B,M,$,V,W,A,q,R,D;let F,U,P,K,I,J,X,G,Q,Y,Z,ee,te,ie,oe,ae,ne,se,re,ce,le,de,he=[d("kyn-block-code-view")],pe=[],ge=r,me=[],ue=[],ke=[],ve=[],ye=[],be=[],xe=[],we=[],fe=[],_e=[],Se=[],Le=[],ze=[],Te=[],Ce=[],He=[],Oe=[],Ee=[],Ne=[],je=[],Be=[],Me=[],$e=[],Ve=[],We=[],Ae=[],qe=[],Re=[],De=[],Fe=[],Ue=[],Pe=[],Ke=[],Ie=[],Je=[],Xe=[],Ge=[],Qe=[],Ye=[],Ze=[];return U=class extends ge{get darkTheme(){return o(this,s,"f")}set darkTheme(e){a(this,s,e,"f")}get language(){return o(this,x,"f")}set language(e){a(this,x,e,"f")}get lineNumbers(){return o(this,S,"f")}set lineNumbers(e){a(this,S,e,"f")}get startLineNumber(){return o(this,z,"f")}set startLineNumber(e){a(this,z,e,"f")}get maxHeight(){return o(this,T,"f")}set maxHeight(e){a(this,T,e,"f")}get codeViewLabel(){return o(this,C,"f")}set codeViewLabel(e){a(this,C,e,"f")}get copyOptionVisible(){return o(this,H,"f")}set copyOptionVisible(e){a(this,H,e,"f")}get codeViewExpandable(){return o(this,O,"f")}set codeViewExpandable(e){a(this,O,e,"f")}get copyButtonText(){return o(this,E,"f")}set copyButtonText(e){a(this,E,e,"f")}get copyButtonDescriptionAttr(){return o(this,N,"f")}set copyButtonDescriptionAttr(e){a(this,N,e,"f")}get codeSnippet(){return o(this,j,"f")}set codeSnippet(e){a(this,j,e,"f")}get textStrings(){return o(this,B,"f")}set textStrings(e){a(this,B,e,"f")}get _textStrings(){return o(this,M,"f")}set _textStrings(e){a(this,M,e,"f")}get _isSingleLine(){return o(this,$,"f")}set _isSingleLine(e){a(this,$,e,"f")}get hasOverflow(){return o(this,V,"f")}set hasOverflow(e){a(this,V,e,"f")}get codeExpanded(){return o(this,W,"f")}set codeExpanded(e){a(this,W,e,"f")}get _copyState(){return o(this,A,"f")}set _copyState(e){a(this,A,e,"f")}get _effectiveLanguage(){return o(this,q,"f")}set _effectiveLanguage(e){a(this,q,e,"f")}get _codeFitsContainerOnLoad(){return o(this,R,"f")}set _codeFitsContainerOnLoad(e){a(this,R,e,"f")}get _expandedHeight(){return o(this,D,"f")}set _expandedHeight(e){a(this,D,e,"f")}updated(e){e.has("darkTheme")&&this.requestUpdate();const t=e.has("codeSnippet")||e.has("language")||e.has("maxHeight");e.has("lineNumbers")?setTimeout((()=>{this.highlightCode(),this.checkOverflow()}),0):t&&(this.highlightCode(),this.checkOverflow()),e.has("copyButtonText")&&(this._copyState={...this._copyState,text:this.copyButtonText}),e.has("startLineNumber")&&(this.startLineNumber<1&&(this.startLineNumber=1),this.highlightCode()),super.updated(e)}render(){const e=`${this.getContainerStyle()};`;return l`
641
- ${this.codeViewLabel?l`<div class="code-view__label">
706
+ }`;const _={collapsed:"Collapsed",expanded:"Expanded"},S=k;(null===(w=S.plugins)||void 0===w?void 0:w.autoloader)&&(S.plugins.autoloader.languages_path="https://cdn.jsdelivr.net/npm/prismjs@1/components/");const L={markup:["<",">","/","div","span","class","id"],html:["<",">","/","div","span","class","id"],css:["{","}",":",";","#","."],javascript:["function","const","let","var","=>"],typescript:["interface","type",":","as"],python:["def","import","from","class"],java:["public","private","class","void"]};let z=(()=>{var s,w,S,z,T,C,H,O,E,N,j,B,M,$,V,W,A,q,R,D,F;let U,P,K,I,J,X,G,Q,Y,Z,ee,te,ie,oe,ae,ne,se,re,le,ce,de,he,pe,ge=[d("kyn-block-code-view")],ue=[],me=r,ke=[],ve=[],be=[],ye=[],we=[],xe=[],fe=[],_e=[],Se=[],Le=[],ze=[],Te=[],Ce=[],He=[],Oe=[],Ee=[],Ne=[],je=[],Be=[],Me=[],$e=[],Ve=[],We=[],Ae=[],qe=[],Re=[],De=[],Fe=[],Ue=[],Pe=[],Ke=[],Ie=[],Je=[],Xe=[],Ge=[],Qe=[],Ye=[],Ze=[],et=[],tt=[],it=[],ot=[];return P=class extends me{get darkTheme(){return o(this,s,"f")}set darkTheme(e){a(this,s,e,"f")}get language(){return o(this,w,"f")}set language(e){a(this,w,e,"f")}get lineNumbers(){return o(this,S,"f")}set lineNumbers(e){a(this,S,e,"f")}get startLineNumber(){return o(this,z,"f")}set startLineNumber(e){a(this,z,e,"f")}get maxHeight(){return o(this,T,"f")}set maxHeight(e){a(this,T,e,"f")}get flush(){return o(this,C,"f")}set flush(e){a(this,C,e,"f")}get codeViewLabel(){return o(this,H,"f")}set codeViewLabel(e){a(this,H,e,"f")}get copyOptionVisible(){return o(this,O,"f")}set copyOptionVisible(e){a(this,O,e,"f")}get codeViewExpandable(){return o(this,E,"f")}set codeViewExpandable(e){a(this,E,e,"f")}get copyButtonText(){return o(this,N,"f")}set copyButtonText(e){a(this,N,e,"f")}get copyButtonDescriptionAttr(){return o(this,j,"f")}set copyButtonDescriptionAttr(e){a(this,j,e,"f")}get codeSnippet(){return o(this,B,"f")}set codeSnippet(e){a(this,B,e,"f")}get textStrings(){return o(this,M,"f")}set textStrings(e){a(this,M,e,"f")}get _textStrings(){return o(this,$,"f")}set _textStrings(e){a(this,$,e,"f")}get _isSingleLine(){return o(this,V,"f")}set _isSingleLine(e){a(this,V,e,"f")}get hasOverflow(){return o(this,W,"f")}set hasOverflow(e){a(this,W,e,"f")}get codeExpanded(){return o(this,A,"f")}set codeExpanded(e){a(this,A,e,"f")}get _copyState(){return o(this,q,"f")}set _copyState(e){a(this,q,e,"f")}get _effectiveLanguage(){return o(this,R,"f")}set _effectiveLanguage(e){a(this,R,e,"f")}get _codeFitsContainerOnLoad(){return o(this,D,"f")}set _codeFitsContainerOnLoad(e){a(this,D,e,"f")}get _expandedHeight(){return o(this,F,"f")}set _expandedHeight(e){a(this,F,e,"f")}updated(e){e.has("darkTheme")&&this.requestUpdate();const t=e.has("codeSnippet")||e.has("language")||e.has("maxHeight");e.has("lineNumbers")?setTimeout((()=>{this.highlightCode(),this.checkOverflow()}),0):t&&(this.highlightCode(),this.checkOverflow()),e.has("copyButtonText")&&(this._copyState={...this._copyState,text:this.copyButtonText}),e.has("startLineNumber")&&(this.startLineNumber<1&&(this.startLineNumber=1),this.highlightCode()),super.updated(e)}render(){const e=`${this.getContainerStyle()};`;return c`
707
+ ${this.codeViewLabel?c`<div class="code-view__label">
642
708
  <label>${this.codeViewLabel}</label>
643
709
  </div>`:null}
644
710
  <div class="${this.getContainerClasses()}" style="${e}">
@@ -647,29 +713,29 @@ code.language-git:before {
647
713
  @keydown=${this.handleKeypress}
648
714
  role="region"
649
715
  class=${this.lineNumbers&&!this._isSingleLine?"line-numbers":"no-line-numbers"}
650
- data-start=${m(this.lineNumbers?Math.max(1,this.startLineNumber):void 0)}
716
+ data-start=${u(this.lineNumbers?Math.max(1,this.startLineNumber):void 0)}
651
717
  >
652
718
  <code tabindex="0" class="language-${this._effectiveLanguage}"></code>
653
719
  </pre>
654
720
  </div>
655
721
  ${this.renderCopyButton()} ${this.renderExpandButton()}
656
722
  </div>
657
- `}getContainerClasses(){var e;return g({"code-view__container":!0,"single-line":this._isSingleLine,"multi-line":!this._isSingleLine,"copy-button-text-true":this.copyButtonText&&this.copyButtonText.length>0,"copy-button-text-false":!this.copyButtonText,"shidoka-syntax-theme":!0,"shidoka-syntax-theme--dark":"dark"===this.darkTheme,"shidoka-syntax-theme--light":"light"===this.darkTheme,"expanded-code-view":this.codeExpanded,"has-overflow":this.hasOverflow,"copy-active":null===(e=this._copyState)||void 0===e?void 0:e.copied})}renderCopyButton(){return this.copyOptionVisible?l`
723
+ `}getContainerClasses(){var e;return g({"code-view__container":!0,"single-line":this._isSingleLine,"multi-line":!this._isSingleLine,"copy-button-text-true":this.copyButtonText&&this.copyButtonText.length>0,"copy-button-text-false":!this.copyButtonText,"shidoka-syntax-theme":!0,"shidoka-syntax-theme--dark":"dark"===this.darkTheme,"shidoka-syntax-theme--light":"light"===this.darkTheme,"expanded-code-view":this.codeExpanded,"has-overflow":this.hasOverflow,"copy-active":null===(e=this._copyState)||void 0===e?void 0:e.copied})}renderCopyButton(){return this.copyOptionVisible?c`
658
724
  <kyn-button
659
725
  class="code-view__copy-button"
660
726
  kind="secondary"
661
727
  size="small"
662
728
  iconPosition="left"
663
729
  ?disabled=${this._copyState.copied}
664
- description=${m(this.copyButtonDescriptionAttr)}
730
+ description=${u(this.copyButtonDescriptionAttr)}
665
731
  @click=${this.copyCode}
666
732
  >
667
733
  <span slot="icon" class="copy-icon">
668
- ${this._copyState.copied?n(v):n(y)}
734
+ ${this._copyState.copied?n(v):n(b)}
669
735
  </span>
670
- ${this._copyState.text?l`<span class="copy-text">${this._copyState.text}</span>`:null}
736
+ ${this._copyState.text?c`<span class="copy-text">${this._copyState.text}</span>`:null}
671
737
  </kyn-button>
672
- `:null}renderExpandButton(){return!this.codeViewExpandable||!this.hasOverflow&&this._codeFitsContainerOnLoad?null:l`
738
+ `:null}renderExpandButton(){return!this.codeViewExpandable||!this.hasOverflow&&this._codeFitsContainerOnLoad?null:c`
673
739
  <kyn-button
674
740
  class="code-view__expand-button"
675
741
  kind="ghost"
@@ -679,7 +745,7 @@ code.language-git:before {
679
745
  description=${this.codeExpanded?this._textStrings.collapsed:this._textStrings.expanded}
680
746
  @click=${this.expandCodeView}
681
747
  >
682
- <span slot="icon" class="expand-icon">${n(b)}</span>
748
+ <span slot="icon" class="expand-icon">${n(y)}</span>
683
749
  </kyn-button>
684
- `}willUpdate(e){e.has("codeExpanded")&&(this._textStrings=u(_,this.textStrings))}highlightCode(){var e;const t=this.removeLeadingWhitespace(this.codeSnippet);this._isSingleLine=1===t.trim().split("\n").length,this._effectiveLanguage=this.language||this.detectLanguage(t);const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("pre"),o=null==i?void 0:i.querySelector("code");if(!o||!i)return;const a=i.querySelector(".line-numbers-rows");a&&a.remove(),o.className=`language-${this._effectiveLanguage}`,o.textContent=t,this.lineNumbers&&!this._isSingleLine?(i.classList.add("line-numbers"),i.setAttribute("data-start",String(this.startLineNumber))):(i.classList.remove("line-numbers"),i.removeAttribute("data-start")),setTimeout((()=>{k.highlightElement(o),setTimeout((()=>{var e;if(this.lineNumbers)try{(null===(e=k.plugins)||void 0===e?void 0:e.lineNumbers)&&(i.querySelector(".line-numbers-rows")||(k.hooks.run("complete",{element:o}),k.plugins.lineNumbers.resize(i))),i.querySelector(".line-numbers-rows")||this.addLineNumbers(i,o)}catch(e){console.warn("Line numbers initialization error:",e),this.addLineNumbers(i,o)}this.checkOverflow()}),50)}),0)}addLineNumbers(e,t){if(e.querySelector(".line-numbers-rows"))return;const i=(t.textContent||"").split("\n").length,o=Math.max(1,parseInt(e.getAttribute("data-start")||"1",10)),a=document.createElement("span");a.className="line-numbers-rows";const n=Array(i).fill("<span></span>").join("");a.innerHTML=n,e.appendChild(a),e.style.counterReset="linenumber "+(o-1)}detectLanguage(e){if(!e.trim())return"plaintext";const t=["markup","html","xml","svg","mathml","css","javascript","typescript","python","java","c","cpp"];let i={language:"plaintext",relevance:0};for(const o of t)if(k.languages[o]){const t=k.tokenize(e,k.languages[o]),a=this.calculateRelevance(t,o);a>i.relevance&&(i={language:o,relevance:a})}return"markup"===i.language?this.determineMarkupLanguage(e):i.language}calculateRelevance(e,t){return e.reduce(((e,i)=>("string"!=typeof i&&(e+=this.getTokenRelevance(i,t)),e)),0)}getTokenRelevance(e,t){let i=1+(e.alias?Array.isArray(e.alias)?e.alias.length:1:0);return this.isLanguageSpecificToken(e,t)&&(i+=2),e.content&&(Array.isArray(e.content)?i+=e.content.reduce(((e,i)=>e+("string"==typeof i?0:this.getTokenRelevance(i,t))),0):"string"!=typeof e.content&&(i+=this.getTokenRelevance(e.content,t))),i}isLanguageSpecificToken(e,t){return(L[t]||[]).some((t=>e.content.toString().includes(t)))}determineMarkupLanguage(e){return/<\/?[a-z][\s\S]*>/i.test(e)?"html":/<\?xml/i.test(e)?"xml":/<svg/i.test(e)?"svg":/<math/i.test(e)?"mathml":"markup"}checkOverflow(){setTimeout((()=>{requestAnimationFrame((()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".code-snippet-wrapper"),i=null==t?void 0:t.querySelector("pre");if(i&&t){const e=i.scrollHeight,o=this.codeExpanded?this._expandedHeight||t.clientHeight:null!==this.maxHeight?this.maxHeight:t.clientHeight;this.hasOverflow=e>o,this._codeFitsContainerOnLoad=e<=(this.maxHeight||t.clientHeight)}}))}),100)}removeLeadingWhitespace(e){if(!e)return"";const t=e.split("\n"),i=t.reduce(((e,t)=>{const i=t.match(/^[ \t]*/),o=i?i[0].length:0;return t.trim().length?Math.min(e,o):e}),1/0);return t.map((e=>e.slice(i))).join("\n").trim()}formatExampleCode(e){return{code:e}}copyCode(e){const t=this._copyState.text;navigator.clipboard.writeText(this.codeSnippet).then((()=>{this._copyState={copied:!0,text:t.length>1?"Copied!":""},this.requestUpdate(),this.dispatchEvent(new CustomEvent("on-copy",{detail:{origEvent:e,fullSnippet:this.formatExampleCode(this.codeSnippet)}})),setTimeout((()=>{this._copyState={copied:!1,text:t},this.requestUpdate()}),5e3)})).catch((e=>console.error("Failed to copy code:",e)))}getContainerStyle(){return this.codeExpanded?this._expandedHeight?`max-height: ${this._expandedHeight}px`:"":null!==this.maxHeight?`max-height: ${this.maxHeight}px`:""}expandCodeView(){var e;if(this.codeExpanded=!this.codeExpanded,this.codeExpanded){const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("pre");this._expandedHeight=(null==t?void 0:t.scrollHeight)||null}else this._expandedHeight=null;this.requestUpdate(),setTimeout((()=>this.checkOverflow()),0)}handleKeypress(e){const t=e.currentTarget,i=t.scrollHeight>t.clientHeight,o=t.scrollWidth>t.clientWidth;"ArrowDown"===e.key||"ArrowUp"===e.key?i&&(t.scrollTop+="ArrowDown"===e.key?40:-40,e.preventDefault()):"ArrowRight"!==e.key&&"ArrowLeft"!==e.key||o&&(t.scrollLeft+="ArrowRight"===e.key?40:-40,e.preventDefault())}constructor(){super(...arguments),s.set(this,i(this,me,"default")),x.set(this,(i(this,ue),i(this,ke,""))),S.set(this,(i(this,ve),i(this,ye,!1))),z.set(this,(i(this,be),i(this,xe,1))),T.set(this,(i(this,we),i(this,fe,null))),C.set(this,(i(this,_e),i(this,Se,""))),H.set(this,(i(this,Le),i(this,ze,!1))),O.set(this,(i(this,Te),i(this,Ce,!1))),E.set(this,(i(this,He),i(this,Oe,""))),N.set(this,(i(this,Ee),i(this,Ne,""))),j.set(this,(i(this,je),i(this,Be,""))),B.set(this,(i(this,Me),i(this,$e,_))),M.set(this,(i(this,Ve),i(this,We,_))),$.set(this,(i(this,Ae),i(this,qe,!1))),V.set(this,(i(this,Re),i(this,De,!1))),W.set(this,(i(this,Fe),i(this,Ue,!1))),A.set(this,(i(this,Pe),i(this,Ke,{copied:!1,text:""}))),q.set(this,(i(this,Ie),i(this,Je,""))),R.set(this,(i(this,Xe),i(this,Ge,!0))),D.set(this,(i(this,Qe),i(this,Ye,null))),i(this,Ze)}},s=new WeakMap,x=new WeakMap,S=new WeakMap,z=new WeakMap,T=new WeakMap,C=new WeakMap,H=new WeakMap,O=new WeakMap,E=new WeakMap,N=new WeakMap,j=new WeakMap,B=new WeakMap,M=new WeakMap,$=new WeakMap,V=new WeakMap,W=new WeakMap,A=new WeakMap,q=new WeakMap,R=new WeakMap,D=new WeakMap,e(U,"BlockCodeView"),(()=>{var e;const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=ge[Symbol.metadata])&&void 0!==e?e:null):void 0;P=[h({type:String})],K=[h({type:String})],I=[h({type:Boolean})],J=[h({type:Number})],X=[h({type:Number})],G=[h({type:String})],Q=[h({type:Boolean})],Y=[h({type:Boolean})],Z=[h({type:String})],ee=[h({type:String})],te=[h({type:String})],ie=[h({type:Object})],oe=[p()],ae=[p()],ne=[p()],se=[p()],re=[p()],ce=[p()],le=[p()],de=[p()],t(U,null,P,{kind:"accessor",name:"darkTheme",static:!1,private:!1,access:{has:e=>"darkTheme"in e,get:e=>e.darkTheme,set:(e,t)=>{e.darkTheme=t}},metadata:i},me,ue),t(U,null,K,{kind:"accessor",name:"language",static:!1,private:!1,access:{has:e=>"language"in e,get:e=>e.language,set:(e,t)=>{e.language=t}},metadata:i},ke,ve),t(U,null,I,{kind:"accessor",name:"lineNumbers",static:!1,private:!1,access:{has:e=>"lineNumbers"in e,get:e=>e.lineNumbers,set:(e,t)=>{e.lineNumbers=t}},metadata:i},ye,be),t(U,null,J,{kind:"accessor",name:"startLineNumber",static:!1,private:!1,access:{has:e=>"startLineNumber"in e,get:e=>e.startLineNumber,set:(e,t)=>{e.startLineNumber=t}},metadata:i},xe,we),t(U,null,X,{kind:"accessor",name:"maxHeight",static:!1,private:!1,access:{has:e=>"maxHeight"in e,get:e=>e.maxHeight,set:(e,t)=>{e.maxHeight=t}},metadata:i},fe,_e),t(U,null,G,{kind:"accessor",name:"codeViewLabel",static:!1,private:!1,access:{has:e=>"codeViewLabel"in e,get:e=>e.codeViewLabel,set:(e,t)=>{e.codeViewLabel=t}},metadata:i},Se,Le),t(U,null,Q,{kind:"accessor",name:"copyOptionVisible",static:!1,private:!1,access:{has:e=>"copyOptionVisible"in e,get:e=>e.copyOptionVisible,set:(e,t)=>{e.copyOptionVisible=t}},metadata:i},ze,Te),t(U,null,Y,{kind:"accessor",name:"codeViewExpandable",static:!1,private:!1,access:{has:e=>"codeViewExpandable"in e,get:e=>e.codeViewExpandable,set:(e,t)=>{e.codeViewExpandable=t}},metadata:i},Ce,He),t(U,null,Z,{kind:"accessor",name:"copyButtonText",static:!1,private:!1,access:{has:e=>"copyButtonText"in e,get:e=>e.copyButtonText,set:(e,t)=>{e.copyButtonText=t}},metadata:i},Oe,Ee),t(U,null,ee,{kind:"accessor",name:"copyButtonDescriptionAttr",static:!1,private:!1,access:{has:e=>"copyButtonDescriptionAttr"in e,get:e=>e.copyButtonDescriptionAttr,set:(e,t)=>{e.copyButtonDescriptionAttr=t}},metadata:i},Ne,je),t(U,null,te,{kind:"accessor",name:"codeSnippet",static:!1,private:!1,access:{has:e=>"codeSnippet"in e,get:e=>e.codeSnippet,set:(e,t)=>{e.codeSnippet=t}},metadata:i},Be,Me),t(U,null,ie,{kind:"accessor",name:"textStrings",static:!1,private:!1,access:{has:e=>"textStrings"in e,get:e=>e.textStrings,set:(e,t)=>{e.textStrings=t}},metadata:i},$e,Ve),t(U,null,oe,{kind:"accessor",name:"_textStrings",static:!1,private:!1,access:{has:e=>"_textStrings"in e,get:e=>e._textStrings,set:(e,t)=>{e._textStrings=t}},metadata:i},We,Ae),t(U,null,ae,{kind:"accessor",name:"_isSingleLine",static:!1,private:!1,access:{has:e=>"_isSingleLine"in e,get:e=>e._isSingleLine,set:(e,t)=>{e._isSingleLine=t}},metadata:i},qe,Re),t(U,null,ne,{kind:"accessor",name:"hasOverflow",static:!1,private:!1,access:{has:e=>"hasOverflow"in e,get:e=>e.hasOverflow,set:(e,t)=>{e.hasOverflow=t}},metadata:i},De,Fe),t(U,null,se,{kind:"accessor",name:"codeExpanded",static:!1,private:!1,access:{has:e=>"codeExpanded"in e,get:e=>e.codeExpanded,set:(e,t)=>{e.codeExpanded=t}},metadata:i},Ue,Pe),t(U,null,re,{kind:"accessor",name:"_copyState",static:!1,private:!1,access:{has:e=>"_copyState"in e,get:e=>e._copyState,set:(e,t)=>{e._copyState=t}},metadata:i},Ke,Ie),t(U,null,ce,{kind:"accessor",name:"_effectiveLanguage",static:!1,private:!1,access:{has:e=>"_effectiveLanguage"in e,get:e=>e._effectiveLanguage,set:(e,t)=>{e._effectiveLanguage=t}},metadata:i},Je,Xe),t(U,null,le,{kind:"accessor",name:"_codeFitsContainerOnLoad",static:!1,private:!1,access:{has:e=>"_codeFitsContainerOnLoad"in e,get:e=>e._codeFitsContainerOnLoad,set:(e,t)=>{e._codeFitsContainerOnLoad=t}},metadata:i},Ge,Qe),t(U,null,de,{kind:"accessor",name:"_expandedHeight",static:!1,private:!1,access:{has:e=>"_expandedHeight"in e,get:e=>e._expandedHeight,set:(e,t)=>{e._expandedHeight=t}},metadata:i},Ye,Ze),t(null,F={value:U},he,{kind:"class",name:U.name,metadata:i},null,pe),U=F.value,i&&Object.defineProperty(U,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})(),U.styles=[c(w),c(f)],i(U,pe),U})();export{z as BlockCodeView};
750
+ `}willUpdate(e){e.has("codeExpanded")&&(this._textStrings=m(_,this.textStrings))}highlightCode(){var e;const t=this.removeLeadingWhitespace(this.codeSnippet);this._isSingleLine=1===t.trim().split("\n").length,this._effectiveLanguage=this.language||this.detectLanguage(t);const i=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("pre"),o=null==i?void 0:i.querySelector("code");if(!o||!i)return;const a=i.querySelector(".line-numbers-rows");a&&a.remove(),o.className=`language-${this._effectiveLanguage}`,o.textContent=t,this.lineNumbers&&!this._isSingleLine?(i.classList.add("line-numbers"),i.setAttribute("data-start",String(this.startLineNumber))):(i.classList.remove("line-numbers"),i.removeAttribute("data-start")),setTimeout((()=>{k.highlightElement(o),setTimeout((()=>{var e;if(this.lineNumbers)try{(null===(e=k.plugins)||void 0===e?void 0:e.lineNumbers)&&(i.querySelector(".line-numbers-rows")||(k.hooks.run("complete",{element:o}),k.plugins.lineNumbers.resize(i))),i.querySelector(".line-numbers-rows")||this.addLineNumbers(i,o)}catch(e){console.warn("Line numbers initialization error:",e),this.addLineNumbers(i,o)}this.checkOverflow()}),50)}),0)}addLineNumbers(e,t){if(e.querySelector(".line-numbers-rows"))return;const i=(t.textContent||"").split("\n").length,o=Math.max(1,parseInt(e.getAttribute("data-start")||"1",10)),a=document.createElement("span");a.className="line-numbers-rows";const n=Array(i).fill("<span></span>").join("");a.innerHTML=n,e.appendChild(a),e.style.counterReset="linenumber "+(o-1)}detectLanguage(e){if(!e.trim())return"plaintext";const t=["markup","html","xml","svg","mathml","css","javascript","typescript","python","java","c","cpp"];let i={language:"plaintext",relevance:0};for(const o of t)if(k.languages[o]){const t=k.tokenize(e,k.languages[o]),a=this.calculateRelevance(t,o);a>i.relevance&&(i={language:o,relevance:a})}return"markup"===i.language?this.determineMarkupLanguage(e):i.language}calculateRelevance(e,t){return e.reduce(((e,i)=>("string"!=typeof i&&(e+=this.getTokenRelevance(i,t)),e)),0)}getTokenRelevance(e,t){let i=1+(e.alias?Array.isArray(e.alias)?e.alias.length:1:0);return this.isLanguageSpecificToken(e,t)&&(i+=2),e.content&&(Array.isArray(e.content)?i+=e.content.reduce(((e,i)=>e+("string"==typeof i?0:this.getTokenRelevance(i,t))),0):"string"!=typeof e.content&&(i+=this.getTokenRelevance(e.content,t))),i}isLanguageSpecificToken(e,t){return(L[t]||[]).some((t=>e.content.toString().includes(t)))}determineMarkupLanguage(e){return/<\/?[a-z][\s\S]*>/i.test(e)?"html":/<\?xml/i.test(e)?"xml":/<svg/i.test(e)?"svg":/<math/i.test(e)?"mathml":"markup"}checkOverflow(){setTimeout((()=>{requestAnimationFrame((()=>{var e;const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".code-snippet-wrapper"),i=null==t?void 0:t.querySelector("pre");if(i&&t){const e=i.scrollHeight,o=this.codeExpanded?this._expandedHeight||t.clientHeight:null!==this.maxHeight?this.maxHeight:t.clientHeight;this.hasOverflow=e>o,this._codeFitsContainerOnLoad=e<=(this.maxHeight||t.clientHeight)}}))}),100)}removeLeadingWhitespace(e){if(!e)return"";const t=e.split("\n"),i=t.reduce(((e,t)=>{const i=t.match(/^[ \t]*/),o=i?i[0].length:0;return t.trim().length?Math.min(e,o):e}),1/0);return t.map((e=>e.slice(i))).join("\n").trim()}formatExampleCode(e){return{code:e}}copyCode(e){const t=this._copyState.text;navigator.clipboard.writeText(this.codeSnippet).then((()=>{this._copyState={copied:!0,text:t.length>1?"Copied!":""},this.requestUpdate(),this.dispatchEvent(new CustomEvent("on-copy",{detail:{origEvent:e,fullSnippet:this.formatExampleCode(this.codeSnippet)}})),setTimeout((()=>{this._copyState={copied:!1,text:t},this.requestUpdate()}),5e3)})).catch((e=>console.error("Failed to copy code:",e)))}getContainerStyle(){return this.codeExpanded?this._expandedHeight?`max-height: ${this._expandedHeight}px`:"":null!==this.maxHeight?`max-height: ${this.maxHeight}px`:""}expandCodeView(){var e;if(this.codeExpanded=!this.codeExpanded,this.codeExpanded){const t=null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector("pre");this._expandedHeight=(null==t?void 0:t.scrollHeight)||null}else this._expandedHeight=null;this.requestUpdate(),setTimeout((()=>this.checkOverflow()),0)}handleKeypress(e){const t=e.currentTarget,i=t.scrollHeight>t.clientHeight,o=t.scrollWidth>t.clientWidth;"ArrowDown"===e.key||"ArrowUp"===e.key?i&&(t.scrollTop+="ArrowDown"===e.key?40:-40,e.preventDefault()):"ArrowRight"!==e.key&&"ArrowLeft"!==e.key||o&&(t.scrollLeft+="ArrowRight"===e.key?40:-40,e.preventDefault())}constructor(){super(...arguments),s.set(this,i(this,ke,"default")),w.set(this,(i(this,ve),i(this,be,""))),S.set(this,(i(this,ye),i(this,we,!1))),z.set(this,(i(this,xe),i(this,fe,1))),T.set(this,(i(this,_e),i(this,Se,null))),C.set(this,(i(this,Le),i(this,ze,!1))),H.set(this,(i(this,Te),i(this,Ce,""))),O.set(this,(i(this,He),i(this,Oe,!1))),E.set(this,(i(this,Ee),i(this,Ne,!1))),N.set(this,(i(this,je),i(this,Be,""))),j.set(this,(i(this,Me),i(this,$e,""))),B.set(this,(i(this,Ve),i(this,We,""))),M.set(this,(i(this,Ae),i(this,qe,_))),$.set(this,(i(this,Re),i(this,De,_))),V.set(this,(i(this,Fe),i(this,Ue,!1))),W.set(this,(i(this,Pe),i(this,Ke,!1))),A.set(this,(i(this,Ie),i(this,Je,!1))),q.set(this,(i(this,Xe),i(this,Ge,{copied:!1,text:""}))),R.set(this,(i(this,Qe),i(this,Ye,""))),D.set(this,(i(this,Ze),i(this,et,!0))),F.set(this,(i(this,tt),i(this,it,null))),i(this,ot)}},s=new WeakMap,w=new WeakMap,S=new WeakMap,z=new WeakMap,T=new WeakMap,C=new WeakMap,H=new WeakMap,O=new WeakMap,E=new WeakMap,N=new WeakMap,j=new WeakMap,B=new WeakMap,M=new WeakMap,$=new WeakMap,V=new WeakMap,W=new WeakMap,A=new WeakMap,q=new WeakMap,R=new WeakMap,D=new WeakMap,F=new WeakMap,e(P,"BlockCodeView"),(()=>{var e;const i="function"==typeof Symbol&&Symbol.metadata?Object.create(null!==(e=me[Symbol.metadata])&&void 0!==e?e:null):void 0;K=[h({type:String})],I=[h({type:String})],J=[h({type:Boolean})],X=[h({type:Number})],G=[h({type:Number})],Q=[h({type:Boolean,reflect:!0})],Y=[h({type:String})],Z=[h({type:Boolean})],ee=[h({type:Boolean})],te=[h({type:String})],ie=[h({type:String})],oe=[h({type:String})],ae=[h({type:Object})],ne=[p()],se=[p()],re=[p()],le=[p()],ce=[p()],de=[p()],he=[p()],pe=[p()],t(P,null,K,{kind:"accessor",name:"darkTheme",static:!1,private:!1,access:{has:e=>"darkTheme"in e,get:e=>e.darkTheme,set:(e,t)=>{e.darkTheme=t}},metadata:i},ke,ve),t(P,null,I,{kind:"accessor",name:"language",static:!1,private:!1,access:{has:e=>"language"in e,get:e=>e.language,set:(e,t)=>{e.language=t}},metadata:i},be,ye),t(P,null,J,{kind:"accessor",name:"lineNumbers",static:!1,private:!1,access:{has:e=>"lineNumbers"in e,get:e=>e.lineNumbers,set:(e,t)=>{e.lineNumbers=t}},metadata:i},we,xe),t(P,null,X,{kind:"accessor",name:"startLineNumber",static:!1,private:!1,access:{has:e=>"startLineNumber"in e,get:e=>e.startLineNumber,set:(e,t)=>{e.startLineNumber=t}},metadata:i},fe,_e),t(P,null,G,{kind:"accessor",name:"maxHeight",static:!1,private:!1,access:{has:e=>"maxHeight"in e,get:e=>e.maxHeight,set:(e,t)=>{e.maxHeight=t}},metadata:i},Se,Le),t(P,null,Q,{kind:"accessor",name:"flush",static:!1,private:!1,access:{has:e=>"flush"in e,get:e=>e.flush,set:(e,t)=>{e.flush=t}},metadata:i},ze,Te),t(P,null,Y,{kind:"accessor",name:"codeViewLabel",static:!1,private:!1,access:{has:e=>"codeViewLabel"in e,get:e=>e.codeViewLabel,set:(e,t)=>{e.codeViewLabel=t}},metadata:i},Ce,He),t(P,null,Z,{kind:"accessor",name:"copyOptionVisible",static:!1,private:!1,access:{has:e=>"copyOptionVisible"in e,get:e=>e.copyOptionVisible,set:(e,t)=>{e.copyOptionVisible=t}},metadata:i},Oe,Ee),t(P,null,ee,{kind:"accessor",name:"codeViewExpandable",static:!1,private:!1,access:{has:e=>"codeViewExpandable"in e,get:e=>e.codeViewExpandable,set:(e,t)=>{e.codeViewExpandable=t}},metadata:i},Ne,je),t(P,null,te,{kind:"accessor",name:"copyButtonText",static:!1,private:!1,access:{has:e=>"copyButtonText"in e,get:e=>e.copyButtonText,set:(e,t)=>{e.copyButtonText=t}},metadata:i},Be,Me),t(P,null,ie,{kind:"accessor",name:"copyButtonDescriptionAttr",static:!1,private:!1,access:{has:e=>"copyButtonDescriptionAttr"in e,get:e=>e.copyButtonDescriptionAttr,set:(e,t)=>{e.copyButtonDescriptionAttr=t}},metadata:i},$e,Ve),t(P,null,oe,{kind:"accessor",name:"codeSnippet",static:!1,private:!1,access:{has:e=>"codeSnippet"in e,get:e=>e.codeSnippet,set:(e,t)=>{e.codeSnippet=t}},metadata:i},We,Ae),t(P,null,ae,{kind:"accessor",name:"textStrings",static:!1,private:!1,access:{has:e=>"textStrings"in e,get:e=>e.textStrings,set:(e,t)=>{e.textStrings=t}},metadata:i},qe,Re),t(P,null,ne,{kind:"accessor",name:"_textStrings",static:!1,private:!1,access:{has:e=>"_textStrings"in e,get:e=>e._textStrings,set:(e,t)=>{e._textStrings=t}},metadata:i},De,Fe),t(P,null,se,{kind:"accessor",name:"_isSingleLine",static:!1,private:!1,access:{has:e=>"_isSingleLine"in e,get:e=>e._isSingleLine,set:(e,t)=>{e._isSingleLine=t}},metadata:i},Ue,Pe),t(P,null,re,{kind:"accessor",name:"hasOverflow",static:!1,private:!1,access:{has:e=>"hasOverflow"in e,get:e=>e.hasOverflow,set:(e,t)=>{e.hasOverflow=t}},metadata:i},Ke,Ie),t(P,null,le,{kind:"accessor",name:"codeExpanded",static:!1,private:!1,access:{has:e=>"codeExpanded"in e,get:e=>e.codeExpanded,set:(e,t)=>{e.codeExpanded=t}},metadata:i},Je,Xe),t(P,null,ce,{kind:"accessor",name:"_copyState",static:!1,private:!1,access:{has:e=>"_copyState"in e,get:e=>e._copyState,set:(e,t)=>{e._copyState=t}},metadata:i},Ge,Qe),t(P,null,de,{kind:"accessor",name:"_effectiveLanguage",static:!1,private:!1,access:{has:e=>"_effectiveLanguage"in e,get:e=>e._effectiveLanguage,set:(e,t)=>{e._effectiveLanguage=t}},metadata:i},Ye,Ze),t(P,null,he,{kind:"accessor",name:"_codeFitsContainerOnLoad",static:!1,private:!1,access:{has:e=>"_codeFitsContainerOnLoad"in e,get:e=>e._codeFitsContainerOnLoad,set:(e,t)=>{e._codeFitsContainerOnLoad=t}},metadata:i},et,tt),t(P,null,pe,{kind:"accessor",name:"_expandedHeight",static:!1,private:!1,access:{has:e=>"_expandedHeight"in e,get:e=>e._expandedHeight,set:(e,t)=>{e._expandedHeight=t}},metadata:i},it,ot),t(null,U={value:P},ge,{kind:"class",name:P.name,metadata:i},null,ue),P=U.value,i&&Object.defineProperty(P,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:i})})(),P.styles=[l(x),l(f)],i(P,ue),P})();export{z as BlockCodeView};
685
751
  //# sourceMappingURL=blockCodeView.js.map