FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ionic/core/src/utils/theme.ts at css-variable-docs-test · ModusCreateOrg/ionic · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
ModusCreateOrg
/
ionic
Public
forked from
ionic-team/ionic-framework
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
1
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ionic
/
core
/
src
/
utils
/
theme.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
62 lines (54 loc) · 1.86 KB
Breadcrumbs
ionic
/
core
/
src
/
utils
/
theme.ts
Copy path
File metadata and controls
62 lines (54 loc) · 1.86 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import
{
CssClassMap
,
Mode
,
RouterDirection
}
from
'../interface'
;
export
function
hostContext
(
selector
:
string
,
el
:
HTMLElement
)
:
boolean
{
return
!
!
el
.
closest
(
selector
)
;
}
/**
* Create the mode and color classes for the component based on the classes passed in
*/
export
function
createColorClasses
(
color
:
string
|
undefined
)
:
CssClassMap
|
null
{
return
(
color
)
?
{
'ion-color'
:
true
,
[
`ion-color-
${
color
}
`
]
:
true
}
:
null
;
}
export
function
createThemedClasses
(
mode
:
Mode
|
undefined
,
name
:
string
)
:
CssClassMap
{
return
{
[
name
]
:
true
,
[
`
${
name
}
-
${
mode
}
`
]
:
!
!
mode
}
;
}
export
function
getClassList
(
classes
:
string
|
string
[
]
|
undefined
)
:
string
[
]
{
if
(
classes
)
{
const
array
=
Array
.
isArray
(
classes
)
?
classes
:
classes
.
split
(
' '
)
;
return
array
.
filter
(
c
=>
c
!=
null
)
.
map
(
c
=>
c
.
trim
(
)
)
.
filter
(
c
=>
c
!==
''
)
;
}
return
[
]
;
}
export
function
getClassMap
(
classes
:
string
|
string
[
]
|
undefined
)
:
CssClassMap
{
const
map
:
CssClassMap
=
{
}
;
getClassList
(
classes
)
.
forEach
(
c
=>
map
[
c
]
=
true
)
;
return
map
;
}
export
async
function
openURL
(
win
:
Window
,
url
:
string
|
undefined
,
ev
:
Event
,
direction
?:
RouterDirection
)
{
if
(
url
&&
url
[
0
]
!==
'#'
&&
url
.
indexOf
(
'://'
)
===
-
1
)
{
const
router
=
win
.
document
.
querySelector
(
'ion-router'
)
;
if
(
router
)
{
ev
&&
ev
.
preventDefault
(
)
;
await
router
.
componentOnReady
(
)
;
return
router
.
push
(
url
,
direction
)
;
}
}
return
Promise
.
resolve
(
)
;
}
export
function
getParentNode
(
node
:
Node
)
{
// this also checks for host elements of shadow root node
// if the parent node is a document fragment (shadow root)
// then use the "host" property on it
// otherwise use the parent node
// DOCUMENT_FRAGMENT_NODE nodeType === 11
const
parentNode
:
any
=
node
.
parentNode
;
return
(
parentNode
&&
parentNode
.
NODE_TYPE
===
11
?
parentNode
.
host
:
parentNode
)
;
}
Back
|
FazBrowse Home
|
New Git URL