Skip to content

Commit a364b7d

Browse files
committed
bugfixes
Signed-off-by: Maximilian Inckmann <[email protected]>
1 parent d26dca6 commit a364b7d

34 files changed

+199
-220
lines changed

.prettierignore

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Ignore artifacts:
22
/src/index.html
3-
/www/
4-
/node_modules/
5-
/dist/
6-
/loader/
7-
/.storybook/
8-
/.stencil/
9-
/storybook-static/
3+
/**/www/
4+
/**/node_modules/
5+
/**/dist/
6+
/**/loader/
7+
/**/hydrate/
8+
/**/.storybook/
9+
/**/.stencil/
10+
/**/storybook-static/
11+

.prettierrc.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@
99
"singleQuote": true,
1010
"tabWidth": 2,
1111
"trailingComma": "all",
12-
"useTabs": false
12+
"useTabs": false,
13+
"plugins": [
14+
"prettier-plugin-tailwindcss"
15+
],
16+
"tailwindConfig": "./tailwind.config.ts"
1317
}

packages/stencil-library/eslint.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default [
88
{ files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] },
99
{ files: ['**/*.js'], languageOptions: { sourceType: 'commonjs' } },
1010
{ languageOptions: { globals: globals.browser } },
11-
{ ignores: ['node_modules/', 'dist/', 'www/', 'loader/', '.stencil/', '.storybook/', 'storybook-static'] },
11+
{ ignores: ['node_modules/', 'dist/', 'www/', 'loader/', '.stencil/', '.storybook/', 'storybook-static', 'hydrate/'] },
1212
...storybook.configs['flat/recommended'],
1313
eslintConfigPrettier,
1414
pluginJs.configs.recommended,

packages/stencil-library/src/components.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,6 @@ export namespace Components {
193193
* @default true
194194
*/
195195
"showTopLevelCopy": boolean;
196-
/**
197-
* Updates the component sizing and styling based on the expanded state This method is now handled by the pid-collapsible component
198-
*/
199-
"updateComponentSizing": () => Promise<void>;
200196
/**
201197
* The value to parse, evaluate and render.
202198
* @type {string}

packages/stencil-library/src/components/color-highlight/color-highlight.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
12
import { Component, h, Host, Prop, State } from '@stencil/core';
23
import { HSLColor } from './HSLColor';
34

@@ -31,7 +32,7 @@ export class ColorHighlight {
3132
style={{
3233
color: 'hsl(' + this.color.hue + ',' + this.color.sat + '%,' + this.color.lum + '%)',
3334
}}
34-
class={`m-0 p-0 inline-block align-baseline font-mono font-bold leading-none`}
35+
class={`m-0 inline-block p-0 align-baseline font-mono leading-none font-bold`}
3536
>
3637
{this.text}
3738
</span>

packages/stencil-library/src/components/copy-button/copy-button.tsx

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
12
import { Component, h, Host, Prop, State } from '@stencil/core';
23

34
@Component({
@@ -40,7 +41,8 @@ export class CopyButton {
4041
await navigator.clipboard.writeText(this.value);
4142
this.showSuccess();
4243
return;
43-
} catch (err) {
44+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
45+
} catch (ignored) {
4446
// Fall through to execCommand fallback
4547
}
4648
}
@@ -83,13 +85,15 @@ export class CopyButton {
8385
}
8486
}
8587
}
86-
} catch (err) {
88+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
89+
} catch (ignored) {
8790
// Error handling is silent to not disrupt user experience
8891
} finally {
8992
document.body.removeChild(textArea);
9093
}
9194
}, 200); // Increased timeout for better reliability
9295
} catch (err) {
96+
console.error('Failed to copy text: ', err);
9397
// Error handling is silent to not disrupt user experience
9498
}
9599
};
@@ -131,12 +135,7 @@ export class CopyButton {
131135
)}
132136

133137
<button
134-
class={`${this.copied ? 'bg-green-200' : 'bg-white hover:bg-blue-200'}
135-
border border-slate-500 text-slate-800 font-medium font-mono
136-
rounded-md px-2 py-0.5 hover:text-slate-900 flex-none max-h-min
137-
items-center z-30 relative
138-
focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1
139-
transition-colors duration-200`}
138+
class={`${this.copied ? 'bg-green-200' : 'bg-white hover:bg-blue-200'} relative z-30 max-h-min flex-none items-center rounded-md border border-slate-500 px-2 py-0.5 font-mono font-medium text-slate-800 transition-colors duration-200 hover:text-slate-900 focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 focus:outline-none`}
140139
onClick={e => this.copyValue(e)}
141140
aria-label={ariaLabel}
142141
title={ariaLabel}

packages/stencil-library/src/components/json-viewer/json-viewer.tsx

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
12
import { Component, h, Method, Prop, State, Watch } from '@stencil/core';
23

34
/**
@@ -306,24 +307,24 @@ export class JsonViewer {
306307
<div class="ml-4">
307308
<details class="mb-1" open={expandedState} onToggle={toggleExpand} id={nodeId}>
308309
<summary
309-
class={`list-none relative pl-5 cursor-pointer font-mono flex items-center py-1 rounded group ${
310+
class={`group relative flex cursor-pointer list-none items-center rounded py-1 pl-5 font-mono ${
310311
this.theme === 'dark' ? 'hover:bg-gray-700' : 'hover:bg-gray-50'
311-
} focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1`}
312+
} focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 focus:outline-none`}
312313
onKeyDown={handleKeyDown}
313314
tabIndex={0}
314315
role="button"
315316
aria-expanded={expandedState ? 'true' : 'false'}
316317
aria-controls={`${nodeId}-content`}
317318
aria-label={`${key}: ${nodeType} with ${itemText}, ${expandedState ? 'click to collapse' : 'click to expand'}`}
318319
>
319-
<div class="flex items-center w-full">
320-
<span class={`font-medium mr-2 ${this.theme === 'dark' ? 'text-blue-400' : 'text-blue-600'}`}>{key}: </span>
320+
<div class="flex w-full items-center">
321+
<span class={`mr-2 font-medium ${this.theme === 'dark' ? 'text-blue-400' : 'text-blue-600'}`}>{key}: </span>
321322
<span class={`flex items-center gap-1 ${this.theme === 'dark' ? 'text-gray-400' : 'text-gray-500'}`}>
322323
<span>{isArray ? '[' : '{'}</span>
323324
<span>{itemText}</span>
324325
<span>{isArray ? ']' : '}'}</span>
325326
<span
326-
class={`text-xs ml-2 opacity-0 transition-opacity duration-200 group-hover:opacity-100 ${this.theme === 'dark' ? 'text-blue-400' : 'text-blue-500'}`}
327+
class={`ml-2 text-xs opacity-0 transition-opacity duration-200 group-hover:opacity-100 ${this.theme === 'dark' ? 'text-blue-400' : 'text-blue-500'}`}
327328
aria-hidden="true"
328329
>
329330
{expandedState ? 'Click to collapse' : 'Click to expand'}
@@ -396,7 +397,7 @@ export class JsonViewer {
396397
// Show error if JSON is invalid
397398
if (this.error) {
398399
return (
399-
<div class="p-4 text-red-500 text-center" role="alert" aria-live="assertive">
400+
<div class="p-4 text-center text-red-500" role="alert" aria-live="assertive">
400401
<p>Invalid JSON: {this.error}</p>
401402
<slot></slot>
402403
</div>
@@ -406,7 +407,7 @@ export class JsonViewer {
406407
// Show message if no data
407408
if (!this.parsedData) {
408409
return (
409-
<div class="p-4 text-gray-500 text-center" role="status" aria-live="polite">
410+
<div class="p-4 text-center text-gray-500" role="status" aria-live="polite">
410411
<p>No data provided</p>
411412
<slot></slot>
412413
</div>
@@ -423,13 +424,13 @@ export class JsonViewer {
423424

424425
return (
425426
<div
426-
class={`rounded-lg overflow-hidden shadow border ${this.theme === 'dark' ? 'bg-gray-800 text-gray-50 border-gray-600' : 'bg-white text-gray-800 border-gray-200'}`}
427+
class={`overflow-hidden rounded-lg border shadow ${this.theme === 'dark' ? 'border-gray-600 bg-gray-800 text-gray-50' : 'border-gray-200 bg-white text-gray-800'}`}
427428
role="region"
428429
aria-labelledby={`${viewerId}-title`}
429430
>
430-
<div class={`flex justify-between items-center p-3 border-b ${this.theme === 'dark' ? 'border-gray-600' : 'border-gray-200'}`}>
431+
<div class={`flex items-center justify-between border-b p-3 ${this.theme === 'dark' ? 'border-gray-600' : 'border-gray-200'}`}>
431432
<div class="flex items-center gap-2">
432-
<span id={`${viewerId}-title`} class={`font-medium text-sm ${this.theme === 'dark' ? 'text-gray-200' : 'text-gray-800'}`}>
433+
<span id={`${viewerId}-title`} class={`text-sm font-medium ${this.theme === 'dark' ? 'text-gray-200' : 'text-gray-800'}`}>
433434
JSON Viewer
434435
</span>
435436
<span class={`text-xs ${this.theme === 'dark' ? 'text-gray-400' : 'text-gray-500'}`} aria-live="polite">
@@ -439,11 +440,11 @@ export class JsonViewer {
439440

440441
<button
441442
onClick={this.toggleView}
442-
class={`flex items-center gap-1 py-1.5 px-3 rounded-md text-xs font-medium cursor-pointer transition-all duration-200 ${
443+
class={`flex cursor-pointer items-center gap-1 rounded-md px-3 py-1.5 text-xs font-medium transition-all duration-200 ${
443444
this.theme === 'dark'
444-
? 'bg-gray-900 border border-gray-600 text-gray-50 hover:bg-gray-700 hover:border-blue-600'
445-
: 'bg-gray-100 border border-gray-200 text-gray-800 hover:bg-gray-50 hover:border-blue-400'
446-
} focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1`}
445+
? 'border border-gray-600 bg-gray-900 text-gray-50 hover:border-blue-600 hover:bg-gray-700'
446+
: 'border border-gray-200 bg-gray-100 text-gray-800 hover:border-blue-400 hover:bg-gray-50'
447+
} focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 focus:outline-none`}
447448
aria-controls={contentId}
448449
aria-label={`Switch to ${this.currentViewMode === 'tree' ? 'code' : 'tree'} view`}
449450
type="button"
@@ -462,15 +463,15 @@ export class JsonViewer {
462463
{/* Overlay copy button */}
463464
<button
464465
onClick={this.copyToClipboard}
465-
class={`absolute top-2 right-2 z-10 rounded-md transition-all duration-200 p-1 ${
466+
class={`absolute top-2 right-2 z-10 rounded-md p-1 transition-all duration-200 ${
466467
this.copied
467468
? this.theme === 'dark'
468469
? 'bg-green-600 text-white'
469470
: 'bg-green-100 text-green-800'
470471
: this.theme === 'dark'
471-
? 'bg-gray-700 hover:bg-gray-600 text-gray-300 hover:text-white'
472-
: 'bg-gray-100 hover:bg-gray-200 text-gray-600 hover:text-gray-800'
473-
} opacity-75 hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-1`}
472+
? 'bg-gray-700 text-gray-300 hover:bg-gray-600 hover:text-white'
473+
: 'bg-gray-100 text-gray-600 hover:bg-gray-200 hover:text-gray-800'
474+
} opacity-75 hover:opacity-100 focus:ring-2 focus:ring-blue-500 focus:ring-offset-1 focus:outline-none`}
474475
title={this.copied ? 'Copied!' : 'Copy JSON to clipboard'}
475476
aria-label={this.copied ? 'JSON copied to clipboard' : 'Copy JSON to clipboard'}
476477
type="button"
@@ -488,7 +489,7 @@ export class JsonViewer {
488489
stroke-width="2"
489490
stroke-linecap="round"
490491
stroke-linejoin="round"
491-
class="w-4 h-4"
492+
class="h-4 w-4"
492493
aria-hidden="true"
493494
>
494495
<title>Check mark</title>
@@ -503,7 +504,7 @@ export class JsonViewer {
503504
stroke-width="2"
504505
stroke-linecap="round"
505506
stroke-linejoin="round"
506-
class="w-4 h-4"
507+
class="h-4 w-4"
507508
aria-hidden="true"
508509
>
509510
<title>Copy icon</title>
@@ -524,26 +525,26 @@ export class JsonViewer {
524525

525526
{/* Code View */}
526527
{this.currentViewMode === 'code' && (
527-
<div class={`font-mono text-sm pr-12 ${this.theme === 'dark' ? '' : 'bg-gray-50'}`}>
528+
<div class={`pr-12 font-mono text-sm ${this.theme === 'dark' ? '' : 'bg-gray-50'}`}>
528529
{this.showLineNumbers ? (
529530
<div class="flex">
530531
<div
531-
class={`py-4 px-2 text-right border-r select-none ${this.theme === 'dark' ? 'border-gray-600 text-gray-400 bg-gray-900' : 'border-gray-200 text-gray-500 bg-gray-100'}`}
532+
class={`border-r px-2 py-4 text-right select-none ${this.theme === 'dark' ? 'border-gray-600 bg-gray-900 text-gray-400' : 'border-gray-200 bg-gray-100 text-gray-500'}`}
532533
>
533534
{formattedJson.split('\n').map((_, i) => (
534535
<div class="min-h-5" key={`line-${i}`}>
535536
{i + 1}
536537
</div>
537538
))}
538539
</div>
539-
<pre class={`p-4 whitespace-pre-wrap flex-grow overflow-x-auto ${this.theme === 'dark' ? 'text-gray-200' : 'text-gray-800'}`}>
540+
<pre class={`flex-grow overflow-x-auto p-4 whitespace-pre-wrap ${this.theme === 'dark' ? 'text-gray-200' : 'text-gray-800'}`}>
540541
{formattedJson.split('\n').map((line, i) => (
541542
<div class="min-h-5" key={`code-${i}`} innerHTML={this.formatCodeLine(line)} />
542543
))}
543544
</pre>
544545
</div>
545546
) : (
546-
<pre class="p-4 whitespace-pre-wrap flex-grow overflow-x-auto">
547+
<pre class="flex-grow overflow-x-auto p-4 whitespace-pre-wrap">
547548
{formattedJson.split('\n').map((line, i) => (
548549
<div class="min-h-5" key={`code-${i}`} innerHTML={this.formatCodeLine(line)} />
549550
))}

packages/stencil-library/src/components/locale-vizualization/locale-visualization.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
12
import { Component, h, Host, Prop } from '@stencil/core';
23

34
@Component({

packages/stencil-library/src/components/pid-actions/pid-actions.stories.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,15 @@ const createStory = (actions: FoldableAction[]) => {
5151
const pidActions = document.createElement('pid-actions');
5252

5353
// Create plain object array from FoldableAction instances
54-
const actionObjects = actions.map(action => ({
54+
// Set the actions property manually
55+
// @ts-expect-error - Property assignment is expected to work at runtime
56+
pidActions.actions = actions.map(action => ({
5557
priority: action.priority,
5658
title: action.title,
5759
link: action.link,
5860
style: action.style,
5961
}));
6062

61-
// Set the actions property manually
62-
// @ts-expect-error - Property assignment is expected to work at runtime
63-
pidActions.actions = actionObjects;
64-
6563
// Append to container
6664
container.appendChild(pidActions);
6765

@@ -180,17 +178,15 @@ export const ManyActions: Story = {
180178
];
181179

182180
// Create plain object array from FoldableAction instances
183-
const actionObjects = actions.map(action => ({
181+
// Set the actions property manually
182+
// @ts-expect-error - Property assignment is expected to work at runtime
183+
pidActions.actions = actions.map(action => ({
184184
priority: action.priority,
185185
title: action.title,
186186
link: action.link,
187187
style: action.style,
188188
}));
189189

190-
// Set the actions property manually
191-
// @ts-expect-error - Property assignment is expected to work at runtime
192-
pidActions.actions = actionObjects;
193-
194190
// Append to container
195191
container.appendChild(pidActions);
196192

packages/stencil-library/src/components/pid-actions/pid-actions.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
12
import { Component, h, Prop } from '@stencil/core';
23
import { FoldableAction } from '../../utils/FoldableAction';
34

@@ -27,7 +28,7 @@ export class PidActions {
2728
return (
2829
<div
2930
id={containerId}
30-
class="actions-container sticky bottom-0 left-0 right-0 bg-white border-t border-gray-200 p-1 z-20 mt-auto w-full"
31+
class="actions-container sticky right-0 bottom-0 left-0 z-20 mt-auto w-full border-t border-gray-200 bg-white p-1"
3132
role="toolbar"
3233
aria-label="Available actions"
3334
>
@@ -36,12 +37,12 @@ export class PidActions {
3637
The following links open related resources in new tabs
3738
</span>
3839

39-
<div class="flex justify-between gap-1 flex-wrap" aria-describedby={`${containerId}-desc`}>
40+
<div class="flex flex-wrap justify-between gap-1" aria-describedby={`${containerId}-desc`}>
4041
{this.actions.map((action, index) => {
4142
// Use Tailwind classes directly instead of concatenating strings
4243
const baseClasses = 'p-1 font-semibold text-sm rounded border transition-colors duration-200';
4344
const focusClasses = 'focus:outline-none focus:ring-2 focus:ring-offset-1 focus:ring-blue-500';
44-
let styleClasses = '';
45+
let styleClasses: string;
4546

4647
switch (action.style) {
4748
case 'primary':

0 commit comments

Comments
 (0)