Skip to content

Commit

Permalink
Update kumascript macros with latest (#1698)
Browse files Browse the repository at this point in the history
* add missing macro AddonSidebarMain

* update macros

* Update kumascript/macros/CSSAnimatedProperties.ejs

Co-authored-by: Peter Bengtsson <[email protected]>

* fix ks unit tests and prettier formatting

Co-authored-by: Peter Bengtsson <[email protected]>
  • Loading branch information
escattone and Peter Bengtsson authored Nov 11, 2020
1 parent 57d16ce commit d9cd44c
Show file tree
Hide file tree
Showing 10 changed files with 641 additions and 353 deletions.
351 changes: 66 additions & 285 deletions kumascript/macros/AddonSidebar.ejs

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions kumascript/macros/AddonSidebarMain.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<%
var currentSection = $0;
var locale = env.locale;
var slug = env.slug;
var baseURL = '/' + locale + '/docs/Mozilla/Add-ons/';
function currentPageIsUnder(root) {
rootSlug = 'Mozilla/Add-ons/' + root;
if (slug && slug.indexOf(rootSlug) != -1) {
return 'open';
}
return '';
}
var text = mdn.localStringMap({
'en-US': {
'WebExtensions': 'Browser extensions',
'Themes': 'Themes',
'Community_and_Support': 'Community and Support',
'Channels': 'Channels',
'Blog': 'Add-ons blog',
'Forums': 'Add-on forums',
'#Contact_us': 'Contact us'
},
'fr': {
'WebExtensions': 'WebExtensions',
'Themes': 'Thèmes',
'Community_and_Support': 'Communauté et Support',
'Channels': 'Canaux de discussions',
'Blog': 'Blog extensions',
'Forums': 'Forum extensions',
'#Contact_us': 'Nous contacter'
},
'ja': {
'WebExtensions': 'ブラウザー拡張機能',
'Themes': 'テーマ',
'Community_and_Support': 'コミュニティとサポート',
'Channels': 'チャンネル',
'Blog': 'ブログ',
'Forums': 'フォーラム',
'#Contact_us': 'コンタクト'
},
'ko': {
'WebExtensions': '브라우저 확장 기능',
'Themes': '테마',
'Community_and_Support': '커뮤니티와 지원',
'Channels': '채널',
'Blog': '부가 기능 블로그',
'Forums': '부가 기능 포럼',
'#Contact_us': '연락하기'
},
'zh-CN': {
'WebExtensions': '浏览器扩展程序',
'Themes': '主题',
'Channels': '渠道',
'Blog': 'Add-ons博客',
'Forums': 'Add-ons论坛',
'Chat': 'Add-ons chat',
'Contact_us': '联系我们'
}
});
%>

<section class="Quick_links" id="Quick_Links">
<ol>
<li><a href="<%=baseURL%>WebExtensions"><strong><%=text['WebExtensions']%></strong></a></li>
<li><a href="<%=baseURL%>Themes"><strong><%=text['Themes']%></strong></a></li>
<li><a href="https://discourse.mozilla.org/c/add-ons"><strong><%=text['Community_and_Support']%></strong></a></li>
<li class="toggle">
<details>
<summary><%=text['Channels']%></summary>
<ol>
<li><a href="https://blog.mozilla.org/addons"><%=text['Blog']%></a></li>
<li><a href="https://discourse.mozilla.org/c/add-ons"><%=text['Forums']%></a></li>
<li><a href="https://stackoverflow.com/questions/tagged/firefox-addon">Stack Overflow</a></li>
<li><a href="<%=baseURL%>#Contact_us"><%=text['#Contact_us']%></a></li>
</ol>
</details>
</li>
</ol>
</section>
2 changes: 1 addition & 1 deletion kumascript/macros/CSSAnimatedProperties.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var animatedProps = [];
// the animatedProps array.
for (var property in data.properties) {
if (data.properties.hasOwnProperty(property)) {
if (data.properties[property].animationType !== "discrete") {
if (!["discrete", "notAnimatable"].includes(data.properties[property].animationType)) {
animatedProps.push(property);
}
}
Expand Down
9 changes: 0 additions & 9 deletions kumascript/macros/CSSInfo.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -286,10 +286,6 @@ if (name === "preview-wiki-content") {
}
properties = properties.concat({
name: "media",
label: localize(localStrings, "media")
},
{
name: "computed",
label: await template("Xref_csscomputed")
});
Expand All @@ -301,11 +297,6 @@ if (name === "preview-wiki-content") {
});
}
properties = properties.concat({
name: "order",
label: localize(localStrings, "canonicalOrder")
});
if (cssInfo.stacking) {
properties = properties.concat({
name: "stacking",
Expand Down
116 changes: 107 additions & 9 deletions kumascript/macros/GroupData.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@
"properties": ["Navigator.battery"],
"events": []
},
"Barcode Detector API": {
"overview": ["Barcode Detector API"],
"guides": [],
"interfaces": ["BarcodeDetector"],
"methods": [
"BarcodeDetector.detect()",
"BarcodeDetector.getSupportedFormats()"
],
"properties": [],
"events": []
},
"Beacon": {
"overview": ["Beacon API"],
"guides": ["/docs/Web/API/Beacon_API/Using_the_Beacon_API"],
Expand Down Expand Up @@ -92,7 +103,8 @@
"events": []
},
"Clipboard API": {
"interfaces": ["Clipboard", "ClipboardEvent"],
"overview": ["Clipboard API"],
"interfaces": ["Clipboard", "ClipboardEvent", "ClipboardItem"],
"dictionaries": ["ClipboardPermissionDescriptor"],
"methods": [],
"properties": ["Navigator.clipboard"],
Expand All @@ -103,6 +115,16 @@
"Element: paste"
]
},
"Content Index API": {
"overview": ["Content Index API"],
"interfaces": ["ContentIndex", "ContentIndexEvent"],
"methods": [],
"properties": [
"ServiceWorkerRegistration.index",
"ServiceWorkerGlobalScope.oncontentdelete"
],
"events": ["ServiceWorkerGlobalScope: contentdelete"]
},
"Console API": {
"overview": ["Console API"],
"interfaces": ["Console"],
Expand Down Expand Up @@ -830,8 +852,16 @@
"overview": ["Media Session API"],
"interfaces": ["MediaMetadata", "MediaSession"],
"methods": [],
"properties": [],
"events": []
"properties": ["navigator.mediaSession"],
"events": [],
"dictionaries": [
"MediaImage",
"MediaMetadataInit",
"MediaPositionState",
"MediaSessionActionDetails"
],
"types": ["MediaSessionAction", "MediaSessionPlaybackState"],
"callbacks": ["MediaSessionActionHandler"]
},
"Media Source Extensions": {
"overview": ["Media Source Extensions API"],
Expand Down Expand Up @@ -966,6 +996,16 @@
"properties": ["Window.performance"],
"events": []
},
"Periodic Background Sync": {
"overview": ["Web Periodic Background Synchronization API"],
"interfaces": ["PeriodicSyncEvent", "PeriodicSyncManager"],
"methods": [],
"properties": [
"ServiceWorkerRegistration.periodicSync",
"ServiceWorkerGlobalScope.onperiodicsync"
],
"events": ["ServiceWorkerGlobalScope: periodicsync"]
},
"Permissions API": {
"overview": ["Permissions API"],
"guides": ["/docs/Web/API/Permissions_API/Using_the_Permissions_API"],
Expand All @@ -974,6 +1014,29 @@
"properties": ["Navigator.permissions", "WorkerNavigator.permissions"],
"events": []
},
"Picture-in-Picture API": {
"overview": ["Picture-in-Picture API"],
"guides": ["/docs/Web/API/Picture-in-Picture_API/Guide"],
"interfaces": ["PictureInPictureWindow"],
"methods": [
"HTMLVideoElement.requestPictureInPicture()",
"Document.exitPictureInPicture()"
],
"properties": [
"HTMLVideoElement.autoPictureInPicture",
"HTMLVideoElement.disablePictureInPicture",
"HTMLVideoElement.onenterpictureinpicture",
"HTMLVideoElement.onleavepictureinpicture",
"Document.pictureInPictureEnabled",
"DocumentOrShadowRoot.pictureInPictureElement",
"PictureInPictureWindow.onresize"
],
"events": [
"HTMLVideoElement: enterpictureinpicture",
"HTMLVideoElement: leavepictureinpicture",
"PictureInPictureWindow: resize"
]
},
"Pointer Events": {
"overview": ["Pointer events"],
"guides": [
Expand Down Expand Up @@ -1088,6 +1151,7 @@
"events": []
},
"Screen Capture API": {
"overview": ["Screen Capture API"],
"guides": ["/docs/Web/API/Screen_Capture_API/Using_Screen_Capture"],
"interfaces": [],
"dictionaries": [],
Expand All @@ -1113,6 +1177,13 @@
"properties": ["Screen.orientation"],
"events": []
},
"Screen Wake Lock API": {
"overview": ["Screen Wake Lock API"],
"interfaces": ["WakeLock", "WakeLockSentinel"],
"methods": [],
"properties": ["Navigator.wakelock"],
"events": []
},
"Selection API": {
"interfaces": ["Selection"],
"properties": [
Expand Down Expand Up @@ -1407,6 +1478,13 @@
"properties": [],
"events": []
},
"Visual Viewport": {
"overview": ["Visual Viewport API"],
"interfaces": ["VisualViewport"],
"methods": [],
"properties": ["Window.visualViewport"],
"events": ["VisualViewport: resize", "VisualViewport: scroll"]
},
"Web Animations": {
"overview": ["Web Animations API"],
"guides": [
Expand Down Expand Up @@ -1692,7 +1770,6 @@
"RTCDTMFSender",
"RTCDTMFToneChangeEvent",
"RTCStatsReport",
"RTCStatsEvent",
"RTCErrorEvent"
],
"dictionaries": [
Expand Down Expand Up @@ -1792,7 +1869,31 @@
],
"methods": ["MediaDevices.getUserMedia()"],
"properties": ["Navigator.mediaDevices"],
"events": [],
"events": [
"RTCDataChannel: bufferedamountlow",
"RTCDataChannel: close",
"RTCDataChannel: closing",
"RTCPeerConnection: connectionstatechange",
"RTCPeerConnection: datachannel",
"RTCDataChannel: error",
"RTCIceTransport: error",
"RTCDtlsTransport: error",
"RTCSctpTransport: error",
"RTCIceTransport: gatheringstatechange",
"RTCPeerConnection: icecandidate",
"RTCPeerConnection: icecandidateerror",
"RTCPeerConnection: iceconnectionstatechange",
"RTCPeerConnection: icegatheringstatechange",
"RTCDataChannel: message",
"RTCPeerConnection: negotiationneeded",
"RTCDataChannel: open",
"RTCIceTransport: selectedcandidatepairchange",
"RTCPeerConnection: signalingstatechange",
"RTCIceTransport: statechange",
"RTCDtlsTransport: statechange",
"RTCDTMFSender: tonechange",
"RTCPeerConnection: track"
],
"callbacks": [
"RTCPeerConnectionErrorCallback",
"RTCSessionDescriptionCallback"
Expand Down Expand Up @@ -1833,10 +1934,7 @@
},
"Web Storage API": {
"overview": ["Web Storage API"],
"guides": [
"/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API",
"/docs/Web/API/Web_Storage_API/Local_storage"
],
"guides": ["/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API"],
"interfaces": ["Storage", "StorageEvent"],
"methods": [],
"properties": ["Window.sessionStorage", "Window.localStorage"],
Expand Down
2 changes: 1 addition & 1 deletion kumascript/macros/JSRef.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var inheritance = ["Object", "Function"];
var inheritanceData = {
"Math": ["Object"],
"Function": ["Object"],
"Object": ["Function"],
"Object": [],
"JSON": ["Object"],
"Intl": ["Object"],
"arguments": [],
Expand Down
9 changes: 8 additions & 1 deletion kumascript/macros/JsSidebar.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var text = mdn.localStringMap({
'Intermediate': 'Intermediate',
'Introducing_objects': 'Introducing JavaScript objects',
'Client-side_APIs': 'Client-side web APIs',
'Frameworks': 'Client-side JavaScript frameworks',
'Re-introduction': 'A re-introduction to JavaScript',
'Data_structures': 'JavaScript data structures',
'Equality': 'Equality comparisons and sameness',
Expand Down Expand Up @@ -92,6 +93,7 @@ var text = mdn.localStringMap({
'Intermediate': 'Средние',
'Introducing_objects': 'Introducing JavaScript objects',
'Client-side_APIs': 'Client-side web APIs',
'Frameworks': 'Client-side JavaScript frameworks',
'Re-introduction': 'Повторное введение в JavaScript',
'Data_structures': 'Структуры данных JavaScript',
'Equality': 'Проверки на равенство и когда их использовать',
Expand Down Expand Up @@ -146,6 +148,7 @@ var text = mdn.localStringMap({
'Intermediate': 'Intermédiaire',
'Introducing_objects': 'Introducing JavaScript objects',
'Client-side_APIs': 'Client-side web APIs',
'Frameworks': 'Client-side JavaScript frameworks',
'Re-introduction': 'Réintroduction à JavaScript',
'Data_structures': 'Structures de données en JavaScript',
'Equality': 'Différents tests d\'égalité',
Expand Down Expand Up @@ -200,6 +203,7 @@ var text = mdn.localStringMap({
'Intermediate': '中级教程',
'Introducing_objects': 'Introducing JavaScript objects',
'Client-side_APIs': 'Client-side web APIs',
'Frameworks': 'Client-side JavaScript frameworks',
'Re-introduction': '深入 JavaScript',
'Data_structures': 'JavaScript 数据结构',
'Equality': '如何正确判断相等性',
Expand Down Expand Up @@ -254,6 +258,7 @@ var text = mdn.localStringMap({
'Intermediate': 'Fortgeschritten',
'Introducing_objects': 'Introducing JavaScript objects',
'Client-side_APIs': 'Client-side web APIs',
'Frameworks': 'Client-side JavaScript frameworks',
'Re-introduction': 'Eine Wiedereinführung in JavaScript',
'Data_structures': 'JavaScript Datenstrukturen',
'Equality': 'Vergleiche auf Gleichheit',
Expand Down Expand Up @@ -308,6 +313,7 @@ var text = mdn.localStringMap({
'Intermediate': '中級編',
'Introducing_objects': 'Introducing JavaScript objects',
'Client-side_APIs': 'Client-side web APIs',
'Frameworks': 'Client-side JavaScript frameworks',
'Re-introduction': 'JavaScript 「再」入門',
'Data_structures': 'JavaScript のデータ構造',
'Equality': '等値比較と同一性',
Expand Down Expand Up @@ -362,6 +368,7 @@ var text = mdn.localStringMap({
'Intermediate': 'Intermediário',
'Introducing_objects': 'Introdução a objetos JavaScript',
'Client-side_APIs': 'APIs Web para aplicações Cliente',
'Frameworks': 'Client-side JavaScript frameworks',
'Re-introduction': 'Uma reintrodução a JavaScript',
'Data_structures': 'Estruturas de dados de JavaScript',
'Equality': 'Comparadores de igualdade e semelhança',
Expand Down Expand Up @@ -433,7 +440,7 @@ var text = mdn.localStringMap({
<details <%=state('Intermediate')%>>
<summary><%=text['Intermediate']%></summary>
<ol>
<li><a href="/<%=locale%>/docs/Learn/JavaScript/Objects"><%=text['Introducing_objects']%></a></li>
<li><a href="/<%=locale%>/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks"><%=text['Frameworks']%></a></li>
<li><a href="/<%=locale%>/docs/Learn/JavaScript/Client-side_web_APIs"><%=text['Client-side_APIs']%></a></li>
<li><a href="/<%=locale%>/docs/Web/JavaScript/A_re-introduction_to_JavaScript"><%=text['Re-introduction']%></a></li>
<li><a href="/<%=locale%>/docs/Web/JavaScript/Data_structures"><%=text['Data_structures']%></a></li>
Expand Down
Loading

0 comments on commit d9cd44c

Please sign in to comment.