@blockquote-web-components/blockquote-base-meta 1.0.2 → 1.0.5
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.js +66 -0
- package/README.md +18 -35
- package/package.json +7 -7
- package/src/BlockquoteBaseMeta.js +1 -18
package/README.js
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+

|
|
3
|
+
|
|
4
|
+
`BlockquoteBaseMeta` is based on Polymer's `iron-meta`, and it is a generic class that you can use
|
|
5
|
+
for sharing information across the DOM tree.
|
|
6
|
+
It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) pattern such that any instance
|
|
7
|
+
of it has access to the shared information. You can use `BlockquoteBaseMeta` to share whatever you
|
|
8
|
+
want.
|
|
9
|
+
The `BlockquoteBaseMeta` instances contain your actual data. The only requirement is that you
|
|
10
|
+
create them before you try to access them.
|
|
11
|
+
|
|
12
|
+
`BlockquoteBaseMeta` uses [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).
|
|
13
|
+
|
|
14
|
+
Map is a collection of keyed data items, just like an Object.
|
|
15
|
+
But the main difference is that Map allows keys of any type.
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
```js
|
|
20
|
+
import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
21
|
+
|
|
22
|
+
const myDefault = new BlockquoteBaseMeta({
|
|
23
|
+
key: 'basic',
|
|
24
|
+
value: 'foo/bar',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
console.log(myDefault.value); // foo/bar
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Keys string - Object
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
34
|
+
|
|
35
|
+
const myDefault = new BlockquoteBaseMeta({
|
|
36
|
+
type: 'one',
|
|
37
|
+
key: 'basic',
|
|
38
|
+
value: 'foo/bar',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
console.log(myDefault.objectList); // {basic: 'foo/bar'}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Keys any type - Map
|
|
45
|
+
|
|
46
|
+
```js
|
|
47
|
+
import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
48
|
+
|
|
49
|
+
const keyInfo = { id: 'dsfaskj0' };
|
|
50
|
+
const myDefault = new BlockquoteBaseMeta({
|
|
51
|
+
type: 'two',
|
|
52
|
+
key: keyInfo,
|
|
53
|
+
value: 'foo/bar',
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
console.log(myDefault.mapList); // {{ id: 'dsfaskj0' }: 'foo/bar'}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
# ## Exports
|
|
60
|
+
|
|
61
|
+
- BlockquoteBaseMeta
|
|
62
|
+
|
|
63
|
+
@tagname blockquote-base-meta
|
|
64
|
+
@element blockquote-base-meta
|
|
65
|
+
*/
|
|
66
|
+
export class ReadmElement extends HTMLElement {}
|
package/README.md
CHANGED
|
@@ -20,10 +20,10 @@ But the main difference is that Map allows keys of any type.
|
|
|
20
20
|
```js
|
|
21
21
|
import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
22
22
|
|
|
23
|
-
const myDefault = new BlockquoteBaseMeta({
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
23
|
+
const myDefault = new BlockquoteBaseMeta({
|
|
24
|
+
key: 'basic',
|
|
25
|
+
value: 'foo/bar',
|
|
26
|
+
});
|
|
27
27
|
|
|
28
28
|
console.log(myDefault.value); // foo/bar
|
|
29
29
|
```
|
|
@@ -33,13 +33,13 @@ console.log(myDefault.value); // foo/bar
|
|
|
33
33
|
```js
|
|
34
34
|
import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
35
35
|
|
|
36
|
-
const myDefault = new BlockquoteBaseMeta({
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
});
|
|
36
|
+
const myDefault = new BlockquoteBaseMeta({
|
|
37
|
+
type: 'one',
|
|
38
|
+
key: 'basic',
|
|
39
|
+
value: 'foo/bar',
|
|
40
|
+
});
|
|
41
41
|
|
|
42
|
-
console.log(myDefault.objectList); // {basic: 'foo/bar'}
|
|
42
|
+
console.log(myDefault.objectList); // {basic: 'foo/bar'}
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
## Keys any type - Map
|
|
@@ -47,33 +47,16 @@ console.log(myDefault.objectList); // {basic: 'foo/bar'}
|
|
|
47
47
|
```js
|
|
48
48
|
import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
49
49
|
|
|
50
|
-
const keyInfo = { id: 'dsfaskj0' };
|
|
51
|
-
const myDefault = new BlockquoteBaseMeta({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
});
|
|
50
|
+
const keyInfo = { id: 'dsfaskj0' };
|
|
51
|
+
const myDefault = new BlockquoteBaseMeta({
|
|
52
|
+
type: 'two',
|
|
53
|
+
key: keyInfo,
|
|
54
|
+
value: 'foo/bar',
|
|
55
|
+
});
|
|
56
56
|
|
|
57
57
|
console.log(myDefault.mapList); // {{ id: 'dsfaskj0' }: 'foo/bar'}
|
|
58
58
|
```
|
|
59
59
|
|
|
60
|
-
##
|
|
60
|
+
# ## Exports
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
| ------------ | --------- | ------------------------------------------------------------- |
|
|
64
|
-
| `key` | | Key for Meta |
|
|
65
|
-
| `list` | readonly | Returns a list (Array) of the values for that instance `type` |
|
|
66
|
-
| `mapList` | readonly | Returns a list (Map) for that instance `type` |
|
|
67
|
-
| `objectList` | readonly | Returns a list (Object) for that instance `type` |
|
|
68
|
-
| `type` | | Type of Meta |
|
|
69
|
-
| `value` | | Returns value of instance key and type |
|
|
70
|
-
|
|
71
|
-
## Methods
|
|
72
|
-
|
|
73
|
-
| Method | Type | Description |
|
|
74
|
-
| ------- | ------------- | -------------------------------------------------------------- |
|
|
75
|
-
| `byKey` | `(key: *): *` | Returns the value of the provided key for that instance `type` |
|
|
76
|
-
|
|
77
|
-
## Exports
|
|
78
|
-
|
|
79
|
-
- BlockquoteBaseMeta
|
|
62
|
+
- BlockquoteBaseMeta
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockquote-web-components/blockquote-base-meta",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Webcomponent blockquote-base-meta following open-wc recommendations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lit",
|
|
@@ -19,17 +19,17 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"analyze": "cem analyze --litelement --globs \"{src,define}/**/*.{js,ts}\" \"index.js\"",
|
|
22
|
-
"analyze:doc": "npm run analyze && npx web-component-analyzer \"{src,define}/**/*.{js,ts}\" \"index.js\" --outFile README.md",
|
|
22
|
+
"analyze:doc": "npm run analyze && npx web-component-analyzer \"{src,define}/**/*.{js,ts}\" \"index.js\" \"README.js\" --outFile README.md",
|
|
23
23
|
"build": "echo \"This is not a TypeScript project, so no need to build.\"",
|
|
24
24
|
"dev:vite": "vite build",
|
|
25
25
|
"format": "npm run format:eslint && npm run format:prettier && npm run format:stylelint",
|
|
26
26
|
"format:eslint": "eslint \"**/*.{js,ts,html}\" --fix --ignore-path .eslintignore",
|
|
27
|
-
"format:prettier": "prettier \"**/*.{js,ts,json,html
|
|
27
|
+
"format:prettier": "prettier \"**/*.{js,ts,json,html}\" --write --ignore-path .eslintignore",
|
|
28
28
|
"format:stylelint": "stylelint \"**/*.{scss,css}\" --fix --allow-empty-input --ignore-path .eslintignore",
|
|
29
29
|
"postinstall": "npm run sort:package",
|
|
30
30
|
"lint": "npm run lint:eslint && npm run lint:prettier && npm run lint:stylelint",
|
|
31
31
|
"lint:eslint": "eslint \"**/*.{js,ts,html}\" --ignore-path .eslintignore",
|
|
32
|
-
"lint:prettier": "prettier \"**/*.{js,ts,json,html
|
|
32
|
+
"lint:prettier": "prettier \"**/*.{js,ts,json,html}\" --check --ignore-path .eslintignore",
|
|
33
33
|
"lint:stylelint": "stylelint \"**/*.{scss,css}\" --allow-empty-input --ignore-path .eslintignore",
|
|
34
34
|
"preview:vite": "vite preview",
|
|
35
35
|
"sass:watch": "sass-style-template",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"**/*.{js,ts,html}": [
|
|
51
51
|
"npm run format:eslint"
|
|
52
52
|
],
|
|
53
|
-
"**/*.{js,ts,json,html
|
|
53
|
+
"**/*.{js,ts,json,html}": [
|
|
54
54
|
"npm run format:prettier"
|
|
55
55
|
],
|
|
56
56
|
"**/*.{scss,css}": [
|
|
@@ -122,11 +122,11 @@
|
|
|
122
122
|
"lit": "^2.0.0"
|
|
123
123
|
},
|
|
124
124
|
"devDependencies": {
|
|
125
|
-
"@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.
|
|
125
|
+
"@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.2.1"
|
|
126
126
|
},
|
|
127
127
|
"publishConfig": {
|
|
128
128
|
"access": "public"
|
|
129
129
|
},
|
|
130
130
|
"customElements": "custom-elements.json",
|
|
131
|
-
"gitHead": "
|
|
131
|
+
"gitHead": "f0d88eaef7c6b48711470dd2ff5c7c3eb554e0ec"
|
|
132
132
|
}
|
|
@@ -82,24 +82,7 @@ import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-m
|
|
|
82
82
|
console.log(myDefault.mapList); // {{ id: 'dsfaskj0' }: 'foo/bar'}
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
##
|
|
86
|
-
|
|
87
|
-
| Property | Modifiers | Description |
|
|
88
|
-
|--------------|-----------|--------------------------------------------------|
|
|
89
|
-
| `key` | | Key for Meta |
|
|
90
|
-
| `list` | readonly | Returns a list of the values for that instance `type` |
|
|
91
|
-
| `mapList` | readonly | Returns a Map list for that instance `type` |
|
|
92
|
-
| `objectList` | readonly | Returns a Object list for that instance `type` |
|
|
93
|
-
| `type` | | Type of Meta |
|
|
94
|
-
| `value` | | Returns value of instance key and type |
|
|
95
|
-
|
|
96
|
-
## Methods
|
|
97
|
-
|
|
98
|
-
| Method | Type | Description |
|
|
99
|
-
|---------|---------------|--------------------------------------------------|
|
|
100
|
-
| `byKey` | `(key: *): *` | Returns the value of the provided key for that instance `type` |
|
|
101
|
-
|
|
102
|
-
## Exports
|
|
85
|
+
# ## Exports
|
|
103
86
|
|
|
104
87
|
- BlockquoteBaseMeta
|
|
105
88
|
|