@internetarchive/ia-topnav 1.1.30-alpha.1 → 1.1.30-userlist1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/package.json +3 -3
- package/src/data/menus.js +5 -0
- package/src/ia-topnav.js +1 -1
- package/src/primary-nav.js +2 -16
- package/.storybook/.babelrc +0 -15
- package/.storybook/addons.js +0 -7
- package/.storybook/config.js +0 -11
- package/.storybook/webpack.config.js +0 -5
- package/stories/topnav-element.stories.js +0 -7
package/README.md
CHANGED
|
@@ -12,7 +12,10 @@ yarn add @internetarchive/ia-topnav
|
|
|
12
12
|
|
|
13
13
|
@see [www/index.html](www/index.html) for the simplest example with all the defaults
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
* Demo app is in another directory: `/www/index.html`
|
|
16
|
+
* `npm|yarn start` - runs local server in Demo directory which is in `/www` folder
|
|
17
|
+
* you can also just use your preferred server
|
|
18
|
+
* open demo: `http://localhost:8000/www/index.html`
|
|
16
19
|
|
|
17
20
|
It shows a dynamic change of the logged in user name -- and how it will re-paint the menus.
|
|
18
21
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@internetarchive/ia-topnav",
|
|
3
|
-
"version": "1.1.30-
|
|
3
|
+
"version": "1.1.30-userlist1",
|
|
4
4
|
"description": "Top nav for Internet Archive",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"access": "public"
|
|
12
12
|
},
|
|
13
13
|
"scripts": {
|
|
14
|
-
"start": "
|
|
14
|
+
"start": "cd ../../www/ && web-dev-server --app-index ./index.html --node-resolve --watch --open",
|
|
15
15
|
"lint:eslint": "eslint --ext .js . --ignore-path .gitignore",
|
|
16
16
|
"format:eslint": "eslint --ext .js . --fix --ignore-path .gitignore",
|
|
17
17
|
"lint:prettier": "prettier \"**/*.js\" --check --ignore-path .gitignore",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"@open-wc/prettier-config": "^1.1.0",
|
|
31
31
|
"@open-wc/testing": "^3.1.6",
|
|
32
32
|
"@storybook/react": "^6.5.12",
|
|
33
|
+
"@web/dev-server": "^0.3.6",
|
|
33
34
|
"@web/test-runner": "^0.14.0",
|
|
34
35
|
"@web/test-runner-puppeteer": "^0.10.5",
|
|
35
|
-
"es-dev-server": "^2.1.0",
|
|
36
36
|
"eslint": "^8.24.0",
|
|
37
37
|
"eslint-plugin-lit": "^1.6.1",
|
|
38
38
|
"gulp": "^4.0.2",
|
package/src/data/menus.js
CHANGED
|
@@ -540,6 +540,11 @@ export function buildTopNavMenus(userid = '___USERID___', localLinks = true, way
|
|
|
540
540
|
title: 'My favorites',
|
|
541
541
|
analyticsEvent: 'UserFavorites',
|
|
542
542
|
},
|
|
543
|
+
{
|
|
544
|
+
url: `${prefix}/details/@me?tab=lists`,
|
|
545
|
+
title: 'My lists',
|
|
546
|
+
analyticsEvent: 'UserLists',
|
|
547
|
+
},
|
|
543
548
|
{
|
|
544
549
|
url: `${prefix}/details/@${userid}/web-archive`,
|
|
545
550
|
title: 'My web archives',
|
package/src/ia-topnav.js
CHANGED
|
@@ -89,7 +89,7 @@ export default class IATopNav extends LitElement {
|
|
|
89
89
|
menuSetup() {
|
|
90
90
|
this.localLinks = this.getAttribute('localLinks') !== 'false' && this.getAttribute('localLinks') !== false;
|
|
91
91
|
this.username = this.getAttribute('username')
|
|
92
|
-
this.screenName = this.
|
|
92
|
+
this.screenName = this.username; // set screenName when username changes to display
|
|
93
93
|
this.waybackPagesArchived = this.getAttribute('waybackPagesArchived') ?? ''
|
|
94
94
|
|
|
95
95
|
// ensure we update other components that use `baseHost`
|
package/src/primary-nav.js
CHANGED
|
@@ -79,23 +79,9 @@ class PrimaryNav extends TrackedElement {
|
|
|
79
79
|
);
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
get isRTL() {
|
|
83
|
-
const ltrChars = 'A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02B8\u0300-\u0590\u0800-\u1FFF'+'\u2C00-\uFB1C\uFDFE-\uFE6F\uFEFD-\uFFFF';
|
|
84
|
-
const rtlChars = '\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC';
|
|
85
|
-
const rtlCheck = new RegExp('^[^'+ltrChars+']*['+rtlChars+']');
|
|
86
|
-
|
|
87
|
-
return rtlCheck.test(this.screenName);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
82
|
get truncatedScreenName() {
|
|
91
|
-
if (this.screenName &&
|
|
92
|
-
|
|
93
|
-
const truncated = [...this.screenName].slice(0, 9).join('');
|
|
94
|
-
if (this.isRTL) {
|
|
95
|
-
return `…${truncated}`;
|
|
96
|
-
} else {
|
|
97
|
-
return `${truncated}…`;
|
|
98
|
-
}
|
|
83
|
+
if (this.screenName && this.screenName.length > 10) {
|
|
84
|
+
return `${this.screenName.substr(0, 9)}…`;
|
|
99
85
|
}
|
|
100
86
|
return this.screenName;
|
|
101
87
|
}
|
package/.storybook/.babelrc
DELETED
package/.storybook/addons.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import '@storybook/addon-a11y/register';
|
|
2
|
-
import '@storybook/addon-actions/register';
|
|
3
|
-
import '@storybook/addon-knobs/register';
|
|
4
|
-
import '@storybook/addon-notes/register';
|
|
5
|
-
import '@storybook/addon-links/register';
|
|
6
|
-
import '@storybook/addon-storysource/register';
|
|
7
|
-
import '@storybook/addon-viewport/register';
|
package/.storybook/config.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { configure, addDecorator } from '@storybook/polymer';
|
|
2
|
-
import { withA11y } from '@storybook/addon-a11y';
|
|
3
|
-
import '@storybook/addon-console';
|
|
4
|
-
|
|
5
|
-
const req = require.context('../stories', true, /\.stories\.js$/);
|
|
6
|
-
function loadStories() {
|
|
7
|
-
req.keys().forEach(filename => req(filename));
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
addDecorator(withA11y);
|
|
11
|
-
configure(loadStories, module);
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { storiesOf, withKnobs, withClassPropertiesKnobs } from '@open-wc/demoing-storybook';
|
|
2
|
-
|
|
3
|
-
import IAMobileTopNav from '../index';
|
|
4
|
-
|
|
5
|
-
storiesOf('IAMobileTopNav', module)
|
|
6
|
-
.addDecorator(withKnobs)
|
|
7
|
-
.add('Mobile top nav options', () => withClassPropertiesKnobs(IAMobileTopNav));
|