Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐞 Bug: patchTheme funktioniert nicht in Verbindung mit setTagNameTransformer #6808

Open
Chrisdo82 opened this issue Sep 11, 2024 · 3 comments · Fixed by #7074
Open

🐞 Bug: patchTheme funktioniert nicht in Verbindung mit setTagNameTransformer #6808

Chrisdo82 opened this issue Sep 11, 2024 · 3 comments · Fixed by #7074
Assignees
Labels
bug Something isn't working desybri The task is assigned to the DESYBRI design system. needs reproduction Notsure theme:BMF BMF theme issue v2

Comments

@Chrisdo82
Copy link
Contributor

Chrisdo82 commented Sep 11, 2024

Link to the code that reproduces this issue:

https://stackblitz.com/edit/vitejs-vite-h3y11f

Can you categorise where the error occurs?

React

Which browser or operating system do you used to test KoliBri?

How to reproduce issue?

import { bootstrap, KoliBriDevHelper } from '@public-ui/components';
import { BMF } from '@public-ui/themes';
import kolibriThemePatch from './kolibri-theme-patch';
import { defineCustomElements } from '@public-ui/components/dist/loader';

import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import App from './App';
import { setTagNameTransformer } from '@public-ui/react';

function transformTagName(customSuffix?: string) {
  return (tagName: string) => `${tagName}-test`;
}

export function updateKoliBriTheme() {
  KoliBriDevHelper.patchTheme('bmf', kolibriThemePatch);
}

export async function initialize(config?: { customSuffix?: string }) {
  setTagNameTransformer(transformTagName(config?.customSuffix));
  await bootstrap(BMF, [], {
    transformTagName: transformTagName(config?.customSuffix),
  }).then(updateKoliBriTheme);

  // https://github.com/ionic-team/stencil/issues/2847
  defineCustomElements(window, {
    transformTagName: transformTagName(config?.customSuffix),
  } as never);
}

await initialize().then(() => {
  const htmlElement: HTMLElement | null =
    document.querySelector<HTMLDivElement>('div#app');
  if (htmlElement instanceof HTMLElement) {
    const root = createRoot(htmlElement);
    root.render(
      <StrictMode>
        <App />
      </StrictMode>
    );
  }
});

Wenn wir die Registrierung wie in der Dokumentation angegeben nutzen, dann funktioniert es. Allerdings benötigen wir den setTagNameTransformer und den nutzen wir so wie im Beispiel Repo von euch angegeben. In Verbindung damit, wird das Theme nicht gepatched.

Current vs. Expected:

Current: es ändert sich nichts.
Expected: Das Theme wird mit den gepatchten Styles aktualisiert.

Environment informations:

{
 "Operating System": {
 "platform": "darwin",
 "arch": "arm64",
 "version": "23.6.0"
 },
 "Binaries": {
 "node": "v20.15.0",
 "npm": "10.7.0",
 "pnpm": "8.12.1",
 "yarn": "N/A"
 },
 "Relevant Packages": {
 "@public-ui/components": "2.1.7",
 "@public-ui/react": "2.1.7",
 "@public-ui/themes": "2.1.7",
 "react": "^18.3.1",
 "react-dom": "^18.3.1",
 "typescript": "5.5.4"
 }
 } 
@Chrisdo82 Chrisdo82 added the bug Something isn't working label Sep 11, 2024
@Chrisdo82
Copy link
Contributor Author

da #6797 geschlossen wurde ohne dass ich darauf reagieren konnte, habe ich ein erneutes Ticket eröffnet.

@Chrisdo82 Chrisdo82 changed the title 🐞 Bug: patchTheme funktioniert nicht mehr 🐞 Bug: patchTheme funktioniert nicht in Verbindung mit setTagNameTransformer Sep 11, 2024
@deleonio deleonio added the desybri The task is assigned to the DESYBRI design system. label Sep 19, 2024
@deleonio deleonio self-assigned this Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
deleonio added a commit that referenced this issue Sep 19, 2024
@laske185
Copy link
Contributor

Umsetzung muss in adopted-style-sheets in der patch-theme-Methode geschehen. Dort muss auch der Tagname-Transformer mit übergeben werden.

@laske185 laske185 moved this from Backlog to 📄 Ready in KoliBri Board Nov 14, 2024
deleonio added a commit that referenced this issue Nov 15, 2024
deleonio added a commit that referenced this issue Nov 15, 2024
deleonio added a commit that referenced this issue Nov 15, 2024
@deleonio
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working desybri The task is assigned to the DESYBRI design system. needs reproduction Notsure theme:BMF BMF theme issue v2
Projects
Status: 📄 Ready
Development

Successfully merging a pull request may close this issue.

3 participants