super-copyright 0.1.0
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/LICENSE +9 -0
- package/README.md +90 -0
- package/dist/super-copyright.min.js +1 -0
- package/package.json +31 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 jarry3369
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# super-copyright
|
|
2
|
+
|
|
3
|
+
lightweight Web Component for automatic copyright notices.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/super-copyright)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
### CDN
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/super-copyright@latest/dist/super-copyright.min.js"></script>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
For production, pin to a specific version:
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<script src="https://cdn.jsdelivr.net/npm/super-copyright@0.1.0/dist/super-copyright.min.js"></script>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### NPM
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install super-copyright
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import 'super-copyright'
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```html
|
|
35
|
+
<super-copyright holder="Acme Corp" />
|
|
36
|
+
<!-- Output: © 2025 Acme Corp. -->
|
|
37
|
+
|
|
38
|
+
<super-copyright since="1930" holder="Acme Corp" statement="all" />
|
|
39
|
+
<!-- Output: © 1930-2025 Acme Corp. All rights reserved. -->
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Attributes
|
|
43
|
+
|
|
44
|
+
| Attribute | Type | Default | Description |
|
|
45
|
+
| ----------- | ------ | --------- | ---------------------------------------- |
|
|
46
|
+
| `holder` | string | `""` | Copyright holder name |
|
|
47
|
+
| `since` | number | - | Start year (auto-range if < current year)|
|
|
48
|
+
| `notation` | string | `"symbol"`| `symbol` (©), `ascii` ((c)), `text`, `none` |
|
|
49
|
+
| `separator` | string | `"-"` | Year range separator |
|
|
50
|
+
| `statement` | string | `"none"` | `all`, `some`, `none` (rights reserved) |
|
|
51
|
+
|
|
52
|
+
## Examples
|
|
53
|
+
|
|
54
|
+
### Basic
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<super-copyright holder="John Doe" />
|
|
58
|
+
<!-- © 2025 John Doe. -->
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### With Year Range
|
|
62
|
+
|
|
63
|
+
```html
|
|
64
|
+
<super-copyright since="2020" holder="Acme Corp" />
|
|
65
|
+
<!-- © 2020-2025 Acme Corp. -->
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Full Options
|
|
69
|
+
|
|
70
|
+
```html
|
|
71
|
+
<super-copyright
|
|
72
|
+
since="1930"
|
|
73
|
+
holder="Acme Corp"
|
|
74
|
+
notation="ascii"
|
|
75
|
+
separator="~"
|
|
76
|
+
statement="all"
|
|
77
|
+
/>
|
|
78
|
+
<!-- (c) 1930~2025 Acme Corp. All rights reserved. -->
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Creative Commons Style
|
|
82
|
+
|
|
83
|
+
```html
|
|
84
|
+
<super-copyright holder="Totally Legit Business Co." statement="some" />
|
|
85
|
+
<!-- © 2025 Totally Legit Business Co. Some rights reserved. -->
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT © jarry3369
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class SuperCopyright extends HTMLElement{connectedCallback(){this.#t()}static get observedAttributes(){return["since","holder","notation","separator","statement"]}attributeChangedCallback(t,e,r){e!==r&&this.isConnected&&this.#t()}#t(){const t=this.#e();this.textContent=this.#r(t)}#e(){const t=(new Date).getFullYear(),e=this.getAttribute("since"),r=e?Number(e):null,n=this.#n(this.getAttribute("notation")),i=this.#i(this.getAttribute("statement"));return{year:t,since:r,holder:this.getAttribute("holder")??"",notation:n,separator:this.getAttribute("separator")??"-",statement:i}}#n(t){return"none"===t?"none":"ascii"===t?"ascii":"text"===t?"text":"symbol"}#i(t){return"all"===t?"all":"some"===t?"some":"none"}#r(t){const{year:e,since:r,holder:n,notation:i,separator:s,statement:a}=t,o=this.#s(i),l=this.#a(r,e,s),h=this.#o(a),u=[o,l,n].filter(Boolean);return u.length>0&&(u[u.length-1]+="."),h&&u.push(h),u.join(" ").trim()}#s(t){return"symbol"===t?"©":"ascii"===t?"(c)":"text"===t?"copyright":""}#o(t){return"all"===t?"All rights reserved.":"some"===t?"Some rights reserved.":""}#a(t,e,r){return!t||t>=e?String(e):`${t}${r}${e}`}}customElements.define("super-copyright",SuperCopyright);
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "super-copyright",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Lightweight Web Component for automatic copyright notices",
|
|
5
|
+
"main": "dist/super-copyright.min.js",
|
|
6
|
+
"files": [
|
|
7
|
+
"dist"
|
|
8
|
+
],
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "terser src/index.js -c -m -o dist/super-copyright.min.js",
|
|
11
|
+
"prepublishOnly": "npm run build",
|
|
12
|
+
"release": "npm version patch && git push --follow-tags",
|
|
13
|
+
"release:minor": "npm version minor && git push --follow-tags",
|
|
14
|
+
"release:major": "npm version major && git push --follow-tags"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"copyright",
|
|
18
|
+
"web-component",
|
|
19
|
+
"custom-element",
|
|
20
|
+
"footer"
|
|
21
|
+
],
|
|
22
|
+
"author": "jarry3369",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/jarry3369/super-copyright"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"terser": "^5.44.1"
|
|
30
|
+
}
|
|
31
|
+
}
|