@blockquote-web-components/blockquote-base-meta 1.0.21 → 1.0.23
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 +49 -12
- package/package.json +31 -19
- package/src/BlockquoteBaseMeta.js +59 -66
- package/README.js +0 -66
package/README.md
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
# blockquote-base-meta
|
|
2
|
-
|
|
3
1
|

|
|
4
2
|
|
|
5
|
-
`BlockquoteBaseMeta` is based on Polymer's `iron-meta`, and it is a generic class that you can use
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
of it has access to the shared information. You can use `BlockquoteBaseMeta` to share whatever you
|
|
9
|
-
want.
|
|
3
|
+
`BlockquoteBaseMeta` is based on Polymer's `iron-meta`, and it is a generic class that you can use for sharing information across the DOM tree.
|
|
4
|
+
It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) pattern such that any instance of it has access to the shared information.
|
|
5
|
+
You can use `BlockquoteBaseMeta` to share whatever you want.
|
|
10
6
|
The `BlockquoteBaseMeta` instances contain your actual data. The only requirement is that you
|
|
11
7
|
create them before you try to access them.
|
|
12
8
|
|
|
@@ -15,7 +11,7 @@ create them before you try to access them.
|
|
|
15
11
|
Map is a collection of keyed data items, just like an Object.
|
|
16
12
|
But the main difference is that Map allows keys of any type.
|
|
17
13
|
|
|
18
|
-
|
|
14
|
+
### Usage
|
|
19
15
|
|
|
20
16
|
```js
|
|
21
17
|
import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
@@ -28,7 +24,7 @@ import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-m
|
|
|
28
24
|
console.log(myDefault.value); // foo/bar
|
|
29
25
|
```
|
|
30
26
|
|
|
31
|
-
|
|
27
|
+
### Keys string - Object
|
|
32
28
|
|
|
33
29
|
```js
|
|
34
30
|
import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
@@ -42,7 +38,7 @@ import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-m
|
|
|
42
38
|
console.log(myDefault.objectList); // {basic: 'foo/bar'}
|
|
43
39
|
```
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
### Keys any type - Map
|
|
46
42
|
|
|
47
43
|
```js
|
|
48
44
|
import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
@@ -57,6 +53,47 @@ import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-m
|
|
|
57
53
|
console.log(myDefault.mapList); // {{ id: 'dsfaskj0' }: 'foo/bar'}
|
|
58
54
|
```
|
|
59
55
|
|
|
60
|
-
# ## Exports
|
|
61
56
|
|
|
62
|
-
|
|
57
|
+
### `src/BlockquoteBaseMeta.js`:
|
|
58
|
+
|
|
59
|
+
#### class: `BlockquoteBaseMeta`
|
|
60
|
+
|
|
61
|
+
##### Static Fields
|
|
62
|
+
|
|
63
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
64
|
+
| ------- | ------- | ---- | ------- | ----------- | -------------- |
|
|
65
|
+
| `types` | | | | | |
|
|
66
|
+
| `uuid` | | | | | |
|
|
67
|
+
|
|
68
|
+
##### Fields
|
|
69
|
+
|
|
70
|
+
| Name | Privacy | Type | Default | Description | Inherited From |
|
|
71
|
+
| ------------ | ------- | ---- | ------- | --------------------------------------------------------------- | -------------- |
|
|
72
|
+
| `value` | | | | Sets value to instance type and key | |
|
|
73
|
+
| `list` | | | | Returns a list (Array) of the values for that instance \`type\` | |
|
|
74
|
+
| `mapList` | | | | Returns a list (Map) for that instance \`type\` | |
|
|
75
|
+
| `objectList` | | | | Returns a list (Object) for that instance \`type\` | |
|
|
76
|
+
| `type` | | | | Type of Meta | |
|
|
77
|
+
| `key` | | | | Key for Meta | |
|
|
78
|
+
|
|
79
|
+
##### Methods
|
|
80
|
+
|
|
81
|
+
| Name | Privacy | Description | Parameters | Return | Inherited From |
|
|
82
|
+
| ------- | ------- | ---------------------------------------------------------------- | ---------- | ------ | -------------- |
|
|
83
|
+
| `byKey` | | Returns the value of the provided key for that instance \`type\` | `key: *` | `*` | |
|
|
84
|
+
|
|
85
|
+
<hr/>
|
|
86
|
+
|
|
87
|
+
#### Exports
|
|
88
|
+
|
|
89
|
+
| Kind | Name | Declaration | Module | Package |
|
|
90
|
+
| ---- | -------------------- | ------------------ | ------------------------- | ------- |
|
|
91
|
+
| `js` | `BlockquoteBaseMeta` | BlockquoteBaseMeta | src/BlockquoteBaseMeta.js | |
|
|
92
|
+
|
|
93
|
+
### `index.js`:
|
|
94
|
+
|
|
95
|
+
#### Exports
|
|
96
|
+
|
|
97
|
+
| Kind | Name | Declaration | Module | Package |
|
|
98
|
+
| ---- | -------------------- | ------------------ | --------------------------- | ------- |
|
|
99
|
+
| `js` | `BlockquoteBaseMeta` | BlockquoteBaseMeta | ./src/BlockquoteBaseMeta.js | |
|
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.23",
|
|
4
4
|
"description": "Webcomponent blockquote-base-meta following open-wc recommendations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lit",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
],
|
|
35
35
|
"scripts": {
|
|
36
36
|
"analyze": "cem analyze --litelement --globs \"{src,define}/**/*.{js,ts}\" \"index.js\"",
|
|
37
|
-
"analyze:doc": "npm run analyze && npx web-component-analyzer \"{src,define}/**/*.{js,ts}\" \"index.js\" \"README.js\" --outFile README.md",
|
|
38
37
|
"build": "echo \"This is not a TypeScript project, so no need to build.\"",
|
|
39
38
|
"dev:vite": "vite build",
|
|
40
39
|
"format": "npm run format:eslint && npm run format:prettier && npm run format:stylelint",
|
|
@@ -74,6 +73,7 @@
|
|
|
74
73
|
{
|
|
75
74
|
"files": "*.{scss,css}",
|
|
76
75
|
"options": {
|
|
76
|
+
"printWidth": 280,
|
|
77
77
|
"singleQuote": false
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -83,20 +83,29 @@
|
|
|
83
83
|
"parserOptions": {
|
|
84
84
|
"ecmaVersion": "latest"
|
|
85
85
|
},
|
|
86
|
-
"plugins": [
|
|
87
|
-
"log-filenames"
|
|
88
|
-
],
|
|
89
86
|
"extends": [
|
|
90
|
-
"
|
|
91
|
-
"
|
|
87
|
+
"@open-wc",
|
|
88
|
+
"prettier"
|
|
92
89
|
],
|
|
93
90
|
"rules": {
|
|
94
|
-
"arrow-parens": "off",
|
|
95
91
|
"class-methods-use-this": "off",
|
|
96
|
-
"
|
|
97
|
-
|
|
92
|
+
"indent": [
|
|
93
|
+
"error",
|
|
94
|
+
2,
|
|
95
|
+
{
|
|
96
|
+
"SwitchCase": 1,
|
|
97
|
+
"ignoredNodes": [
|
|
98
|
+
"PropertyDefinition",
|
|
99
|
+
"TemplateLiteral > *"
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
"no-unused-expressions": [
|
|
98
104
|
"error",
|
|
99
|
-
|
|
105
|
+
{
|
|
106
|
+
"allowShortCircuit": true,
|
|
107
|
+
"allowTernary": true
|
|
108
|
+
}
|
|
100
109
|
],
|
|
101
110
|
"import/extensions": [
|
|
102
111
|
"error",
|
|
@@ -110,32 +119,35 @@
|
|
|
110
119
|
{
|
|
111
120
|
"devDependencies": [
|
|
112
121
|
"**/test/**/*.{js,ts}",
|
|
113
|
-
"**/*.config.{js,mjs,cjs}",
|
|
114
|
-
"**/*.conf.{js,mjs,cjs}"
|
|
122
|
+
"**/*.config.{js,ts,mjs,cjs}",
|
|
123
|
+
"**/*.conf.{js,ts,mjs,cjs}"
|
|
115
124
|
]
|
|
116
125
|
}
|
|
117
126
|
],
|
|
118
127
|
"import/no-unresolved": "off",
|
|
119
|
-
"import/prefer-default-export": "off"
|
|
128
|
+
"import/prefer-default-export": "off",
|
|
129
|
+
"lit/no-native-attributes": "off"
|
|
120
130
|
}
|
|
121
131
|
},
|
|
122
132
|
"stylelint": {
|
|
123
133
|
"extends": "stylelint-config-standard-scss",
|
|
124
134
|
"rules": {
|
|
125
135
|
"custom-property-pattern": null,
|
|
126
|
-
"
|
|
136
|
+
"no-duplicate-selectors": null,
|
|
137
|
+
"color-function-notation": null,
|
|
138
|
+
"alpha-value-notation": null
|
|
127
139
|
}
|
|
128
140
|
},
|
|
129
141
|
"dependencies": {
|
|
130
|
-
"lit": "^2.
|
|
142
|
+
"lit": "^2.8.0"
|
|
131
143
|
},
|
|
132
144
|
"devDependencies": {
|
|
133
|
-
"@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.
|
|
134
|
-
"@blockquote-web-components/blockquote-base-embedded-webview": "^1.5.
|
|
145
|
+
"@blockquote-web-components/blockquote-base-common-dev-dependencies": "^1.5.0",
|
|
146
|
+
"@blockquote-web-components/blockquote-base-embedded-webview": "^1.5.3"
|
|
135
147
|
},
|
|
136
148
|
"publishConfig": {
|
|
137
149
|
"access": "public"
|
|
138
150
|
},
|
|
139
151
|
"customElements": "custom-elements.json",
|
|
140
|
-
"gitHead": "
|
|
152
|
+
"gitHead": "1d99c84686394229dadc9d1e19f446588a33c8b6"
|
|
141
153
|
}
|
|
@@ -27,75 +27,68 @@ window[BLOCKQUOTE] = blockquote;
|
|
|
27
27
|
// https://www.keithcirkel.co.uk/metaprogramming-in-es6-symbols/
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-

|
|
31
|
-
|
|
32
|
-
`BlockquoteBaseMeta` is based on Polymer's `iron-meta`, and it is a generic class that you can use
|
|
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
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
# ## Exports
|
|
88
|
-
|
|
89
|
-
- BlockquoteBaseMeta
|
|
90
|
-
|
|
91
|
-
*/
|
|
30
|
+
* 
|
|
31
|
+
*
|
|
32
|
+
* `BlockquoteBaseMeta` is based on Polymer's `iron-meta`, and it is a generic class that you can use for sharing information across the DOM tree.
|
|
33
|
+
* It uses [monostate pattern](http://c2.com/cgi/wiki?MonostatePattern) pattern such that any instance of it has access to the shared information.
|
|
34
|
+
* You can use `BlockquoteBaseMeta` to share whatever you want.
|
|
35
|
+
* The `BlockquoteBaseMeta` instances contain your actual data. The only requirement is that you
|
|
36
|
+
* create them before you try to access them.
|
|
37
|
+
*
|
|
38
|
+
* `BlockquoteBaseMeta` uses [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).
|
|
39
|
+
*
|
|
40
|
+
* Map is a collection of keyed data items, just like an Object.
|
|
41
|
+
* But the main difference is that Map allows keys of any type.
|
|
42
|
+
*
|
|
43
|
+
* ### Usage
|
|
44
|
+
*
|
|
45
|
+
* ```js
|
|
46
|
+
* import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
47
|
+
*
|
|
48
|
+
* const myDefault = new BlockquoteBaseMeta({
|
|
49
|
+
* key: 'basic',
|
|
50
|
+
* value: 'foo/bar',
|
|
51
|
+
* });
|
|
52
|
+
*
|
|
53
|
+
* console.log(myDefault.value); // foo/bar
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* ### Keys string - Object
|
|
57
|
+
*
|
|
58
|
+
* ```js
|
|
59
|
+
* import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
60
|
+
*
|
|
61
|
+
* const myDefault = new BlockquoteBaseMeta({
|
|
62
|
+
* type: 'one',
|
|
63
|
+
* key: 'basic',
|
|
64
|
+
* value: 'foo/bar',
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* console.log(myDefault.objectList); // {basic: 'foo/bar'}
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* ### Keys any type - Map
|
|
71
|
+
*
|
|
72
|
+
* ```js
|
|
73
|
+
* import { BlockquoteBaseMeta } from '@blockquote-web-components/blockquote-base-meta';
|
|
74
|
+
*
|
|
75
|
+
* const keyInfo = { id: 'dsfaskj0' };
|
|
76
|
+
* const myDefault = new BlockquoteBaseMeta({
|
|
77
|
+
* type: 'two',
|
|
78
|
+
* key: keyInfo,
|
|
79
|
+
* value: 'foo/bar',
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* console.log(myDefault.mapList); // {{ id: 'dsfaskj0' }: 'foo/bar'}
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
92
85
|
export class BlockquoteBaseMeta {
|
|
93
86
|
/**
|
|
94
87
|
* @param {{
|
|
95
|
-
* type
|
|
96
|
-
* key
|
|
97
|
-
* value
|
|
98
|
-
* }
|
|
88
|
+
* type?: *,
|
|
89
|
+
* key?: *,
|
|
90
|
+
* value?: *
|
|
91
|
+
* }} [options]
|
|
99
92
|
*/
|
|
100
93
|
constructor(options) {
|
|
101
94
|
/**
|
package/README.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
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 {}
|