-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(playground): better handle multiple files for Javascript #3119
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
71629c9
fix(playground): better handle multiple files for Javascript
mapsandapps d49c70a
Simplify index.htmls
mapsandapps fce1686
Fix indentation
mapsandapps 2d5897c
Refactor for simplicity
mapsandapps 450378a
Refactor for simplicity
mapsandapps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
179 changes: 84 additions & 95 deletions
179
static/usage/v6/modal/styling/animations/javascript/index_html.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,95 @@ | ||
```html | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="https://cdn.skypack.dev/@ionic/core/css/core.css" /> | ||
<link rel="stylesheet" type="text/css" href="https://cdn.skypack.dev/@ionic/core/css/ionic.bundle.css" /> | ||
</head> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>App</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding"> | ||
<ion-button id="open-modal" expand="block">Open Modal</ion-button> | ||
|
||
<body> | ||
<ion-app> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>App</ion-title> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content class="ion-padding"> | ||
<ion-button id="open-modal" expand="block">Open Modal</ion-button> | ||
<ion-modal trigger="open-modal"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Modal</ion-title> | ||
<ion-buttons slot="end"> | ||
<ion-button onclick="modal.dismiss()">Close</ion-button> | ||
</ion-buttons> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content> | ||
<ion-list> | ||
<ion-item> | ||
<ion-avatar slot="start"> | ||
<ion-img src="https://i.pravatar.cc/300?u=b" /> | ||
</ion-avatar> | ||
<ion-label> | ||
<h2>Connor Smith</h2> | ||
<p>Sales Rep</p> | ||
</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-avatar slot="start"> | ||
<ion-img src="https://i.pravatar.cc/300?u=a" /> | ||
</ion-avatar> | ||
<ion-label> | ||
<h2>Daniel Smith</h2> | ||
<p>Product Designer</p> | ||
</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-avatar slot="start"> | ||
<ion-img src="https://i.pravatar.cc/300?u=d" /> | ||
</ion-avatar> | ||
<ion-label> | ||
<h2>Greg Smith</h2> | ||
<p>Director of Operations</p> | ||
</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-avatar slot="start"> | ||
<ion-img src="https://i.pravatar.cc/300?u=e" /> | ||
</ion-avatar> | ||
<ion-label> | ||
<h2>Zoey Smith</h2> | ||
<p>CEO</p> | ||
</ion-label> | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> | ||
</ion-modal> | ||
</ion-content> | ||
|
||
<ion-modal trigger="open-modal"> | ||
<ion-header> | ||
<ion-toolbar> | ||
<ion-title>Modal</ion-title> | ||
<ion-buttons slot="end"> | ||
<ion-button onclick="modal.dismiss()">Close</ion-button> | ||
</ion-buttons> | ||
</ion-toolbar> | ||
</ion-header> | ||
<ion-content> | ||
<ion-list> | ||
<ion-item> | ||
<ion-avatar slot="start"> | ||
<ion-img src="https://i.pravatar.cc/300?u=b" /> | ||
</ion-avatar> | ||
<ion-label> | ||
<h2>Connor Smith</h2> | ||
<p>Sales Rep</p> | ||
</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-avatar slot="start"> | ||
<ion-img src="https://i.pravatar.cc/300?u=a" /> | ||
</ion-avatar> | ||
<ion-label> | ||
<h2>Daniel Smith</h2> | ||
<p>Product Designer</p> | ||
</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-avatar slot="start"> | ||
<ion-img src="https://i.pravatar.cc/300?u=d" /> | ||
</ion-avatar> | ||
<ion-label> | ||
<h2>Greg Smith</h2> | ||
<p>Director of Operations</p> | ||
</ion-label> | ||
</ion-item> | ||
<ion-item> | ||
<ion-avatar slot="start"> | ||
<ion-img src="https://i.pravatar.cc/300?u=e" /> | ||
</ion-avatar> | ||
<ion-label> | ||
<h2>Zoey Smith</h2> | ||
<p>CEO</p> | ||
</ion-label> | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> | ||
</ion-modal> | ||
</ion-content> | ||
</ion-app> | ||
<script> | ||
var modal = document.querySelector('ion-modal'); | ||
|
||
<script> | ||
var modal = document.querySelector('ion-modal'); | ||
const enterAnimation = (baseEl) => { | ||
const root = baseEl.shadowRoot; | ||
|
||
const enterAnimation = (baseEl) => { | ||
const root = baseEl.shadowRoot; | ||
const backdropAnimation = createAnimation() | ||
.addElement(root.querySelector('ion-backdrop')) | ||
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); | ||
|
||
const backdropAnimation = createAnimation() | ||
.addElement(root.querySelector('ion-backdrop')) | ||
.fromTo('opacity', '0.01', 'var(--backdrop-opacity)'); | ||
const wrapperAnimation = createAnimation() | ||
.addElement(root.querySelector('.modal-wrapper')) | ||
.keyframes([ | ||
{ offset: 0, opacity: '0', transform: 'scale(0)' }, | ||
{ offset: 1, opacity: '0.99', transform: 'scale(1)' }, | ||
]); | ||
|
||
const wrapperAnimation = createAnimation() | ||
.addElement(root.querySelector('.modal-wrapper')) | ||
.keyframes([ | ||
{ offset: 0, opacity: '0', transform: 'scale(0)' }, | ||
{ offset: 1, opacity: '0.99', transform: 'scale(1)' }, | ||
]); | ||
return createAnimation() | ||
.addElement(baseEl) | ||
.easing('ease-out') | ||
.duration(500) | ||
.addAnimation([backdropAnimation, wrapperAnimation]); | ||
}; | ||
|
||
return createAnimation() | ||
.addElement(baseEl) | ||
.easing('ease-out') | ||
.duration(500) | ||
.addAnimation([backdropAnimation, wrapperAnimation]); | ||
}; | ||
const leaveAnimation = (baseEl) => enterAnimation(baseEl).direction('reverse'); | ||
|
||
const leaveAnimation = (baseEl) => enterAnimation(baseEl).direction('reverse'); | ||
modal.enterAnimation = enterAnimation; | ||
modal.leaveAnimation = leaveAnimation; | ||
|
||
modal.enterAnimation = enterAnimation; | ||
modal.leaveAnimation = leaveAnimation; | ||
|
||
function dismiss() { | ||
modal.dismiss(); | ||
} | ||
</script> | ||
</body> | ||
</html> | ||
function dismiss() { | ||
modal.dismiss(); | ||
} | ||
</script> | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,45 @@ | ||
```html | ||
<html> | ||
<head> | ||
<link rel="stylesheet" type="text/css" href="https://cdn.skypack.dev/@ionic/core@7/css/core.css" /> | ||
<link rel="stylesheet" type="text/css" href="https://cdn.skypack.dev/@ionic/core@7/css/ionic.bundle.css" /> | ||
</head> | ||
<ion-list> | ||
<ion-item> | ||
<ion-input id="card" label="Card number" placeholder="0000 0000 0000 0000"></ion-input> | ||
</ion-item> | ||
<ion-item> | ||
<ion-input id="phone" label="US phone number" placeholder="+1 (xxx) xxx-xxxx"></ion-input> | ||
</ion-item> | ||
</ion-list> | ||
|
||
<body> | ||
<ion-app> | ||
<ion-content class="ion-padding"> | ||
<ion-list> | ||
<ion-item> | ||
<ion-input id="card" label="Card number" placeholder="0000 0000 0000 0000"></ion-input> | ||
</ion-item> | ||
<ion-item> | ||
<ion-input id="phone" label="US phone number" placeholder="+1 (xxx) xxx-xxxx"></ion-input> | ||
</ion-item> | ||
</ion-list> | ||
</ion-content> | ||
<script> | ||
async function initPhoneMask() { | ||
const ionInput = document.querySelector('#phone'); | ||
const nativeEl = await ionInput.getInputElement(); | ||
|
||
<script> | ||
async function initPhoneMask() { | ||
const ionInput = document.querySelector('#phone'); | ||
const nativeEl = await ionInput.getInputElement(); | ||
new window.Maskito(nativeEl, { | ||
mask: ['+', '1', ' ', '(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/], | ||
}); | ||
} | ||
|
||
new window.Maskito(nativeEl, { | ||
mask: ['+', '1', ' ', '(', /\d/, /\d/, /\d/, ')', ' ', /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/], | ||
}); | ||
} | ||
async function initCardMask() { | ||
const ionInput = document.querySelector('#card'); | ||
const nativeEl = await ionInput.getInputElement(); | ||
|
||
async function initCardMask() { | ||
const ionInput = document.querySelector('#card'); | ||
const nativeEl = await ionInput.getInputElement(); | ||
new window.Maskito(nativeEl, { | ||
mask: [ | ||
...Array(4).fill(/\d/), | ||
' ', | ||
...Array(4).fill(/\d/), | ||
' ', | ||
...Array(4).fill(/\d/), | ||
' ', | ||
...Array(4).fill(/\d/), | ||
' ', | ||
...Array(3).fill(/\d/), | ||
], | ||
}); | ||
} | ||
|
||
new window.Maskito(nativeEl, { | ||
mask: [ | ||
...Array(4).fill(/\d/), | ||
' ', | ||
...Array(4).fill(/\d/), | ||
' ', | ||
...Array(4).fill(/\d/), | ||
' ', | ||
...Array(4).fill(/\d/), | ||
' ', | ||
...Array(3).fill(/\d/), | ||
], | ||
}); | ||
} | ||
|
||
window.addEventListener('appload', () => { | ||
initCardMask(); | ||
initPhoneMask(); | ||
}); | ||
</script> | ||
</ion-app> | ||
</body> | ||
</html> | ||
window.addEventListener('appload', () => { | ||
initCardMask(); | ||
initPhoneMask(); | ||
}); | ||
</script> | ||
``` |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever re-assign
codeBlock
, if not this can be aconst
.