SIGN IN SIGN UP

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

0 0 58 TypeScript
(function() {
if (window.location.search.indexOf('rtl=true') > -1) {
document.documentElement.setAttribute('dir', 'rtl');
}
2019-09-25 18:12:57 +02:00
if (window.location.search.indexOf('ionic:_testing=true') > -1) {
const style = document.createElement('style');
style.innerHTML = `
* {
caret-color: transparent !important;
}`;
document.head.appendChild(style);
}
refactor(dark): use palettes through url queries in test pages (#29238) Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> If a dev wants to view a test page in dark mode, they have to manually add the styles. This can lead to a slowdown. Plus they can't use Playwright's `goto` to test both light and dark. In order to test dark mode with Playwright, the dev would need to use `setContent` instead of `goto`. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> Dark mode can be added to any page by appending `palette=dark` to the URL. - The param will be used to add a link tag with the correct palette file. - Playwright will load the correct palette file when a dev uses `goto` and `{ themes: ['dark'] }` ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> I recommend using badge to try this out. It already has a `goto` in the basic tests.
2024-04-19 11:48:29 -07:00
/**
* The term `palette` is used to as a param to match the
* Ionic docs, plus here is already a `ionic:theme` query being
* used for `md`, `ios`, and `ionic` themes.
*/
const palette = window.location.search.match(/palette=([a-z]+)/);
if (palette && palette[1] !== 'light') {
const linkTag = document.createElement('link');
linkTag.setAttribute('rel', 'stylesheet');
linkTag.setAttribute('type', 'text/css');
linkTag.setAttribute('href', `/css/palettes/${palette[1]}.always.css`);
document.head.appendChild(linkTag);
}
fix(colors): change ionic colors scss imports for ionic dist (#29791) Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When consuming the Ionic Framework and using the Ionic Theme, the color attribute was still not working as the color css was not present. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Now the ion-color maps are correctly imported on the Ionic `dist` related folder and not the on the `md/ios` ones. - Changed the usage of `map.get` to `map-get` to avoid issues with the usage of `@use` and `@forward`. This seems to have no impact on the compilation and I believe its a better code convention, as map-gets are a native scss function that doesn't need to be imported. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> --------- Co-authored-by: ionitron <hi@ionicframework.com> Co-authored-by: Maria Hutt <maria@ionic.io>
2024-08-27 08:42:46 +01:00
/**
* The `ionic` theme uses a different stylesheet than the `iOS` and `md` themes.
* This is to ensure that the `ionic` theme is loaded when the `ionic:theme=ionic`
* or when the HTML tag has the `theme="ionic"` attribute. This is useful for
* the snapshot tests, where the `ionic` theme is not loaded by default.
*/
const themeQuery = window.location.search.match(/ionic:theme=([a-z]+)/);
const themeAttr = document.documentElement.getAttribute('theme');
if ((themeQuery && themeQuery[1] === 'ionic') || themeAttr === 'ionic') {
const ionicThemeLinkTag = document.querySelector('link[href*="css/ionic/bundle.ionic.css"]');
if (!ionicThemeLinkTag) {
const linkTag = document.createElement('link');
linkTag.setAttribute('rel', 'stylesheet');
linkTag.setAttribute('type', 'text/css');
linkTag.setAttribute('href', '/css/ionic/bundle.ionic.css');
document.head.appendChild(linkTag);
}
const defaultThemeLinkTag = document.querySelector('link[href*="css/ionic.bundle.css"]');
if (defaultThemeLinkTag) {
defaultThemeLinkTag.remove();
}
fix(colors): change ionic colors scss imports for ionic dist (#29791) Issue number: internal --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> When consuming the Ionic Framework and using the Ionic Theme, the color attribute was still not working as the color css was not present. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Now the ion-color maps are correctly imported on the Ionic `dist` related folder and not the on the `md/ios` ones. - Changed the usage of `map.get` to `map-get` to avoid issues with the usage of `@use` and `@forward`. This seems to have no impact on the compilation and I believe its a better code convention, as map-gets are a native scss function that doesn't need to be imported. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> --------- Co-authored-by: ionitron <hi@ionicframework.com> Co-authored-by: Maria Hutt <maria@ionic.io>
2024-08-27 08:42:46 +01:00
}
window.Ionic = window.Ionic || {};
window.Ionic.config = window.Ionic.config || {};
window.addEventListener('appload', () => {
window.testAppLoaded = true;
})
})();