Skip to content

Commit a088396

Browse files
committed
fix(docs): version common css and js files
1 parent 50546f5 commit a088396

File tree

7 files changed

+764
-24
lines changed

7 files changed

+764
-24
lines changed

static/usage/common.css

-24
This file was deleted.

static/usage/v6/common.css

+255
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
@font-face {
2+
font-family: "Roboto";
3+
src: url("../fonts/Roboto-Regular.ttf") format("truetype");
4+
}
5+
6+
@font-face {
7+
font-family: "Roboto";
8+
src: url("../fonts/Roboto-Medium.ttf") format("truetype");
9+
font-weight: 450 500;
10+
}
11+
12+
:root {
13+
/** primary **/
14+
--ion-color-primary: #3880ff;
15+
--ion-color-primary-rgb: 56, 128, 255;
16+
--ion-color-primary-contrast: #ffffff;
17+
--ion-color-primary-contrast-rgb: 255, 255, 255;
18+
--ion-color-primary-shade: #3171e0;
19+
--ion-color-primary-tint: #4c8dff;
20+
21+
/** secondary **/
22+
--ion-color-secondary: #3dc2ff;
23+
--ion-color-secondary-rgb: 61, 194, 255;
24+
--ion-color-secondary-contrast: #ffffff;
25+
--ion-color-secondary-contrast-rgb: 255, 255, 255;
26+
--ion-color-secondary-shade: #36abe0;
27+
--ion-color-secondary-tint: #50c8ff;
28+
29+
/** tertiary **/
30+
--ion-color-tertiary: #5260ff;
31+
--ion-color-tertiary-rgb: 82, 96, 255;
32+
--ion-color-tertiary-contrast: #ffffff;
33+
--ion-color-tertiary-contrast-rgb: 255, 255, 255;
34+
--ion-color-tertiary-shade: #4854e0;
35+
--ion-color-tertiary-tint: #6370ff;
36+
37+
/** success **/
38+
--ion-color-success: #2dd36f;
39+
--ion-color-success-rgb: 45, 211, 111;
40+
--ion-color-success-contrast: #ffffff;
41+
--ion-color-success-contrast-rgb: 255, 255, 255;
42+
--ion-color-success-shade: #28ba62;
43+
--ion-color-success-tint: #42d77d;
44+
45+
/** warning **/
46+
--ion-color-warning: #ffc409;
47+
--ion-color-warning-rgb: 255, 196, 9;
48+
--ion-color-warning-contrast: #000000;
49+
--ion-color-warning-contrast-rgb: 0, 0, 0;
50+
--ion-color-warning-shade: #e0ac08;
51+
--ion-color-warning-tint: #ffca22;
52+
53+
/** danger **/
54+
--ion-color-danger: #eb445a;
55+
--ion-color-danger-rgb: 235, 68, 90;
56+
--ion-color-danger-contrast: #ffffff;
57+
--ion-color-danger-contrast-rgb: 255, 255, 255;
58+
--ion-color-danger-shade: #cf3c4f;
59+
--ion-color-danger-tint: #ed576b;
60+
61+
/** dark **/
62+
--ion-color-dark: #222428;
63+
--ion-color-dark-rgb: 34, 36, 40;
64+
--ion-color-dark-contrast: #ffffff;
65+
--ion-color-dark-contrast-rgb: 255, 255, 255;
66+
--ion-color-dark-shade: #1e2023;
67+
--ion-color-dark-tint: #383a3e;
68+
69+
/** medium **/
70+
--ion-color-medium: #92949c;
71+
--ion-color-medium-rgb: 146, 148, 156;
72+
--ion-color-medium-contrast: #ffffff;
73+
--ion-color-medium-contrast-rgb: 255, 255, 255;
74+
--ion-color-medium-shade: #808289;
75+
--ion-color-medium-tint: #9d9fa6;
76+
77+
/** light **/
78+
--ion-color-light: #f4f5f8;
79+
--ion-color-light-rgb: 244, 245, 248;
80+
--ion-color-light-contrast: #000000;
81+
--ion-color-light-contrast-rgb: 0, 0, 0;
82+
--ion-color-light-shade: #d7d8da;
83+
--ion-color-light-tint: #f5f6f9;
84+
}
85+
86+
/*
87+
* Dark Colors
88+
* -------------------------------------------
89+
*/
90+
91+
body.dark {
92+
--ion-color-primary: #428cff;
93+
--ion-color-primary-rgb: 66,140,255;
94+
--ion-color-primary-contrast: #ffffff;
95+
--ion-color-primary-contrast-rgb: 255,255,255;
96+
--ion-color-primary-shade: #3a7be0;
97+
--ion-color-primary-tint: #5598ff;
98+
99+
--ion-color-secondary: #50c8ff;
100+
--ion-color-secondary-rgb: 80,200,255;
101+
--ion-color-secondary-contrast: #ffffff;
102+
--ion-color-secondary-contrast-rgb: 255,255,255;
103+
--ion-color-secondary-shade: #46b0e0;
104+
--ion-color-secondary-tint: #62ceff;
105+
106+
--ion-color-tertiary: #6a64ff;
107+
--ion-color-tertiary-rgb: 106,100,255;
108+
--ion-color-tertiary-contrast: #ffffff;
109+
--ion-color-tertiary-contrast-rgb: 255,255,255;
110+
--ion-color-tertiary-shade: #5d58e0;
111+
--ion-color-tertiary-tint: #7974ff;
112+
113+
--ion-color-success: #2fdf75;
114+
--ion-color-success-rgb: 47,223,117;
115+
--ion-color-success-contrast: #000000;
116+
--ion-color-success-contrast-rgb: 0,0,0;
117+
--ion-color-success-shade: #29c467;
118+
--ion-color-success-tint: #44e283;
119+
120+
--ion-color-warning: #ffd534;
121+
--ion-color-warning-rgb: 255,213,52;
122+
--ion-color-warning-contrast: #000000;
123+
--ion-color-warning-contrast-rgb: 0,0,0;
124+
--ion-color-warning-shade: #e0bb2e;
125+
--ion-color-warning-tint: #ffd948;
126+
127+
--ion-color-danger: #ff4961;
128+
--ion-color-danger-rgb: 255,73,97;
129+
--ion-color-danger-contrast: #ffffff;
130+
--ion-color-danger-contrast-rgb: 255,255,255;
131+
--ion-color-danger-shade: #e04055;
132+
--ion-color-danger-tint: #ff5b71;
133+
134+
--ion-color-dark: #f4f5f8;
135+
--ion-color-dark-rgb: 244,245,248;
136+
--ion-color-dark-contrast: #000000;
137+
--ion-color-dark-contrast-rgb: 0,0,0;
138+
--ion-color-dark-shade: #d7d8da;
139+
--ion-color-dark-tint: #f5f6f9;
140+
141+
--ion-color-medium: #989aa2;
142+
--ion-color-medium-rgb: 152,154,162;
143+
--ion-color-medium-contrast: #000000;
144+
--ion-color-medium-contrast-rgb: 0,0,0;
145+
--ion-color-medium-shade: #86888f;
146+
--ion-color-medium-tint: #a2a4ab;
147+
148+
--ion-color-light: #222428;
149+
--ion-color-light-rgb: 34,36,40;
150+
--ion-color-light-contrast: #ffffff;
151+
--ion-color-light-contrast-rgb: 255,255,255;
152+
--ion-color-light-shade: #1e2023;
153+
--ion-color-light-tint: #383a3e;
154+
}
155+
156+
/*
157+
* iOS Dark Theme
158+
* -------------------------------------------
159+
*/
160+
161+
.ios body.dark {
162+
--ion-background-color: #03060b;
163+
--ion-background-color-rgb: 0,0,0;
164+
165+
--ion-text-color: #ffffff;
166+
--ion-text-color-rgb: 255,255,255;
167+
168+
--ion-color-step-50: #0d0d0d;
169+
--ion-color-step-100: #1a1a1a;
170+
--ion-color-step-150: #262626;
171+
--ion-color-step-200: #333333;
172+
--ion-color-step-250: #404040;
173+
--ion-color-step-300: #4d4d4d;
174+
--ion-color-step-350: #595959;
175+
--ion-color-step-400: #666666;
176+
--ion-color-step-450: #737373;
177+
--ion-color-step-500: #808080;
178+
--ion-color-step-550: #8c8c8c;
179+
--ion-color-step-600: #999999;
180+
--ion-color-step-650: #a6a6a6;
181+
--ion-color-step-700: #b3b3b3;
182+
--ion-color-step-750: #bfbfbf;
183+
--ion-color-step-800: #cccccc;
184+
--ion-color-step-850: #d9d9d9;
185+
--ion-color-step-900: #e6e6e6;
186+
--ion-color-step-950: #f2f2f2;
187+
188+
--ion-item-background: #000000;
189+
190+
--ion-card-background: #1c1c1d;
191+
}
192+
193+
.ios body.dark ion-modal {
194+
--ion-background-color: var(--ion-color-step-100);
195+
--ion-toolbar-background: var(--ion-color-step-150);
196+
--ion-toolbar-border-color: var(--ion-color-step-250);
197+
}
198+
199+
200+
/*
201+
* Material Design Dark Theme
202+
* -------------------------------------------
203+
*/
204+
205+
.md body.dark {
206+
--ion-background-color: #03060b;
207+
--ion-background-color-rgb: 18,18,18;
208+
209+
--ion-text-color: #ffffff;
210+
--ion-text-color-rgb: 255,255,255;
211+
212+
--ion-border-color: #222222;
213+
214+
--ion-color-step-50: #1e1e1e;
215+
--ion-color-step-100: #2a2a2a;
216+
--ion-color-step-150: #363636;
217+
--ion-color-step-200: #414141;
218+
--ion-color-step-250: #4d4d4d;
219+
--ion-color-step-300: #595959;
220+
--ion-color-step-350: #656565;
221+
--ion-color-step-400: #717171;
222+
--ion-color-step-450: #7d7d7d;
223+
--ion-color-step-500: #898989;
224+
--ion-color-step-550: #949494;
225+
--ion-color-step-600: #a0a0a0;
226+
--ion-color-step-650: #acacac;
227+
--ion-color-step-700: #b8b8b8;
228+
--ion-color-step-750: #c4c4c4;
229+
--ion-color-step-800: #d0d0d0;
230+
--ion-color-step-850: #dbdbdb;
231+
--ion-color-step-900: #e7e7e7;
232+
--ion-color-step-950: #f3f3f3;
233+
234+
--ion-item-background: #1e1e1e;
235+
236+
--ion-toolbar-background: #1f1f1f;
237+
238+
--ion-tab-bar-background: #1f1f1f;
239+
240+
--ion-card-background: #1e1e1e;
241+
}
242+
243+
.container {
244+
display: flex;
245+
246+
align-items: center;
247+
justify-content: center;
248+
249+
height: 100%;
250+
}
251+
252+
:root {
253+
--ion-safe-area-top: 20px;
254+
--ion-safe-area-bottom: 22px;
255+
}

static/usage/v6/common.js

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/**
2+
* Wait for the initial HTML document to be
3+
* loaded and parsed before adding the message
4+
* listener. Otherwise, it is possible that the message
5+
* listener will fire before the body is ready.
6+
*/
7+
window.addEventListener('DOMContentLoaded', () => {
8+
/**
9+
* The parent Playground component will
10+
* dispatch messages whenever the theme on
11+
* the Ionic Docs website has changed so that
12+
* the demos loaded in iframes can match the
13+
* docs website theme.
14+
*/
15+
window.addEventListener('message', (ev) => {
16+
const { data } = ev;
17+
18+
if (data.darkMode) {
19+
document.body.classList.add('dark');
20+
} else {
21+
document.body.classList.remove('dark');
22+
}
23+
});
24+
25+
/**
26+
* Monkey-patch the console methods so we can dispatch
27+
* events when they're called, allowing the data to be
28+
* captured by the playground's console UI.
29+
*/
30+
const _log = console.log,
31+
_warn = console.warn,
32+
_error = console.error;
33+
34+
const dispatchConsoleEvent = (type, arguments) => {
35+
window.dispatchEvent(
36+
new CustomEvent('console', {
37+
detail: {
38+
type,
39+
message: Object.values(arguments).join(' '),
40+
},
41+
})
42+
);
43+
};
44+
45+
console.log = function () {
46+
dispatchConsoleEvent('log', arguments);
47+
return _log.apply(console, arguments);
48+
};
49+
50+
console.warn = function () {
51+
dispatchConsoleEvent('warning', arguments);
52+
return _warn.apply(console, arguments);
53+
};
54+
55+
console.error = function () {
56+
dispatchConsoleEvent('error', arguments);
57+
return _error.apply(console, arguments);
58+
};
59+
60+
/**
61+
* The Playground needs to wait for the message listener
62+
* to be created before sending any messages, otherwise
63+
* they will be lost. Once the listener is done, fire
64+
* the demoReady event. In the event that the Playground's
65+
* useEffect hook fires before the message listener is created,
66+
* the Playground component will wait for the demoReady event
67+
* before proceeding.
68+
*
69+
* We also set window.demoReady in the event that the
70+
* useEffect hook fires after the message listener is
71+
* already created so that it does not wait on an event
72+
* that was already fired.
73+
*/
74+
const ev = new CustomEvent('demoReady');
75+
window.dispatchEvent(ev);
76+
77+
window.demoReady = true;
78+
});

0 commit comments

Comments
 (0)