@kubex/zinc 0.0.1
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/.idea/.name +1 -0
- package/.idea/fusion.iml +9 -0
- package/.idea/modules.xml +8 -0
- package/.idea/php.xml +4 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/watcherTasks.xml +25 -0
- package/components/Blank/demo/demo.html +11 -0
- package/components/Blank/dist/zn-blank.js +39 -0
- package/components/Blank/go/component.go +18 -0
- package/components/Blank/go/go.mod +3 -0
- package/components/Blank/package.json +33 -0
- package/components/Blank/php/composer.json +25 -0
- package/components/Blank/php/src/Blank.php +15 -0
- package/components/Blank/rollup.config.js +32 -0
- package/components/Blank/scss/Styles.scss +6 -0
- package/components/Blank/ts/Component.ts +15 -0
- package/components/Blank/tsconfig.json +7 -0
- package/components/Icon/demo/demo.html +90 -0
- package/components/Icon/dist/zn-icon.js +55 -0
- package/components/Icon/go/component.go +56 -0
- package/components/Icon/go/go.mod +3 -0
- package/components/Icon/package.json +33 -0
- package/components/Icon/php/composer.json +26 -0
- package/components/Icon/php/src/Icon.php +38 -0
- package/components/Icon/php/src/Library.php +17 -0
- package/components/Icon/php/src/Size.php +42 -0
- package/components/Icon/roadmap.md +7 -0
- package/components/Icon/rollup.config.js +32 -0
- package/components/Icon/scss/Styles.scss +65 -0
- package/components/Icon/ts/Component.ts +108 -0
- package/components/Icon/ts/md5.ts +215 -0
- package/components/Icon/tsconfig.json +7 -0
- package/components/MaxWidth/demo/demo.html +11 -0
- package/components/MaxWidth/dist/zn-max-width.js +51 -0
- package/components/MaxWidth/go/component.go +24 -0
- package/components/MaxWidth/go/go.mod +3 -0
- package/components/MaxWidth/package.json +33 -0
- package/components/MaxWidth/php/composer.json +25 -0
- package/components/MaxWidth/php/src/MaxWidth.php +32 -0
- package/components/MaxWidth/rollup.config.js +32 -0
- package/components/MaxWidth/scss/Styles.scss +13 -0
- package/components/MaxWidth/ts/Component.ts +27 -0
- package/components/MaxWidth/tsconfig.json +7 -0
- package/components/roadmap.md +4 -0
- package/layout/components/Columns/demo/demo.html +16 -0
- package/layout/components/Columns/scss/Styles.scss +0 -0
- package/layout/components/Columns/ts/Component.ts +59 -0
- package/layout/demo/index.html +24 -0
- package/layout/dist/zn-layout.js +87 -0
- package/layout/package.json +38 -0
- package/layout/rollup.config.js +38 -0
- package/layout/scss/layout.scss +24 -0
- package/layout/tailwind.config.js +23 -0
- package/layout/ts/import.ts +2 -0
- package/layout/tsconfig.json +7 -0
- package/package.json +20 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
namespace Kubex\Zinc\Components\Icon;
|
|
3
|
+
|
|
4
|
+
use Packaged\SafeHtml\ISafeHtmlProducer;
|
|
5
|
+
use Packaged\SafeHtml\SafeHtml;
|
|
6
|
+
|
|
7
|
+
class Icon implements ISafeHtmlProducer
|
|
8
|
+
{
|
|
9
|
+
protected $_src;
|
|
10
|
+
protected $_library;
|
|
11
|
+
protected $_size;
|
|
12
|
+
|
|
13
|
+
public function __construct(string $src, Library $library = null)
|
|
14
|
+
{
|
|
15
|
+
$this->_src = $src;
|
|
16
|
+
$this->_library = $library ?? Library::MaterialIconsOutlined();
|
|
17
|
+
$this->_size = Size::Size24();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public function setSize(Size $size): self
|
|
21
|
+
{
|
|
22
|
+
$this->_size = $size;
|
|
23
|
+
return $this;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public function size(): Size
|
|
27
|
+
{
|
|
28
|
+
return $this->_size;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public function produceSafeHTML(): SafeHtml
|
|
32
|
+
{
|
|
33
|
+
return new SafeHtml(
|
|
34
|
+
sprintf('<fusion-icon src="%s" library="%s" size="%d"></fusion-icon>', $this->_src, $this->_library, $this->_size)
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
namespace Kubex\Zinc\Components\Icon;
|
|
3
|
+
|
|
4
|
+
use Packaged\Enum\AbstractEnum;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @method static Library MaterialIconsOutlined()
|
|
8
|
+
*/
|
|
9
|
+
class Library extends AbstractEnum
|
|
10
|
+
{
|
|
11
|
+
public const Material = "material";
|
|
12
|
+
public const MaterialOutlined = "material-outlined";
|
|
13
|
+
public const MaterialRound = "material-round";
|
|
14
|
+
public const MaterialSharp = "material-sharp";
|
|
15
|
+
public const MaterialTwoTone = "material-two-tone";
|
|
16
|
+
public const Gravatar = "gravatar";
|
|
17
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
namespace Kubex\Zinc\Components\Icon;
|
|
3
|
+
|
|
4
|
+
use Packaged\Enum\AbstractEnum;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @method static Size Size16()
|
|
8
|
+
* @method static Size Size24()
|
|
9
|
+
* @method static Size Size32()
|
|
10
|
+
* @method static Size Size40()
|
|
11
|
+
* @method static Size Size48()
|
|
12
|
+
* @method static Size Size56()
|
|
13
|
+
* @method static Size Size64()
|
|
14
|
+
* @method static Size Size80()
|
|
15
|
+
* @method static Size Size96()
|
|
16
|
+
* @method static Size Size120()
|
|
17
|
+
* @method static Size Size144()
|
|
18
|
+
* @method static Size Size160()
|
|
19
|
+
* @method static Size Size200()
|
|
20
|
+
* @method static Size Size240()
|
|
21
|
+
* @method static Size Size280()
|
|
22
|
+
* @method static Size Size320()
|
|
23
|
+
*/
|
|
24
|
+
class Size extends AbstractEnum
|
|
25
|
+
{
|
|
26
|
+
public const Size16 = 16;
|
|
27
|
+
public const Size24 = 24;
|
|
28
|
+
public const Size32 = 32;
|
|
29
|
+
public const Size40 = 40;
|
|
30
|
+
public const Size48 = 48;
|
|
31
|
+
public const Size56 = 56;
|
|
32
|
+
public const Size64 = 64;
|
|
33
|
+
public const Size80 = 80;
|
|
34
|
+
public const Size96 = 96;
|
|
35
|
+
public const Size120 = 120;
|
|
36
|
+
public const Size144 = 144;
|
|
37
|
+
public const Size160 = 160;
|
|
38
|
+
public const Size200 = 200;
|
|
39
|
+
public const Size240 = 240;
|
|
40
|
+
public const Size280 = 280;
|
|
41
|
+
public const Size320 = 320;
|
|
42
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import resolve from '@rollup/plugin-node-resolve';
|
|
2
|
+
import typescript from '@rollup/plugin-typescript';
|
|
3
|
+
import {terser} from 'rollup-plugin-terser';
|
|
4
|
+
import commonjs from '@rollup/plugin-commonjs';
|
|
5
|
+
import postcss from 'rollup-plugin-postcss';
|
|
6
|
+
import AtImport from 'postcss-import';
|
|
7
|
+
|
|
8
|
+
const component = {
|
|
9
|
+
input: 'ts/Component.ts',
|
|
10
|
+
output: {
|
|
11
|
+
dir: 'dist',
|
|
12
|
+
format: 'iife',
|
|
13
|
+
entryFileNames: 'zn-icon.js',
|
|
14
|
+
sourcemap: false,
|
|
15
|
+
},
|
|
16
|
+
plugins: [
|
|
17
|
+
resolve({browser: true, preferBuiltins: false}),
|
|
18
|
+
typescript(),
|
|
19
|
+
commonjs(),
|
|
20
|
+
postcss(
|
|
21
|
+
{
|
|
22
|
+
plugins: [AtImport()],
|
|
23
|
+
inject: false,
|
|
24
|
+
extract: false,
|
|
25
|
+
minimize: true,
|
|
26
|
+
sourceMap: false,
|
|
27
|
+
}),
|
|
28
|
+
terser(),
|
|
29
|
+
],
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default [component];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--icon-size: 24;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
user-select: none;
|
|
7
|
+
font-family: sans-serif;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
margin: 0;
|
|
11
|
+
padding: 0;
|
|
12
|
+
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: center;
|
|
16
|
+
text-align: center;
|
|
17
|
+
|
|
18
|
+
width: var(--icon-size);
|
|
19
|
+
height: var(--icon-size);
|
|
20
|
+
|
|
21
|
+
&, i {
|
|
22
|
+
font-size: var(--icon-size);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host([round]) {
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
img {
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.mi {
|
|
36
|
+
font-family: 'Material Icons';
|
|
37
|
+
font-size: inherit;
|
|
38
|
+
font-weight: normal;
|
|
39
|
+
font-style: normal;
|
|
40
|
+
line-height: 1;
|
|
41
|
+
letter-spacing: normal;
|
|
42
|
+
text-transform: none;
|
|
43
|
+
display: inline-block;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
word-wrap: normal;
|
|
46
|
+
direction: ltr;
|
|
47
|
+
-webkit-font-feature-settings: 'liga';
|
|
48
|
+
-webkit-font-smoothing: antialiased;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.mi--outlined {
|
|
52
|
+
font-family: 'Material Icons Outlined';
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.mi--round {
|
|
56
|
+
font-family: 'Material Icons Round';
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.mi--sharp {
|
|
60
|
+
font-family: 'Material Icons Sharp';
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.mi--two-tone {
|
|
64
|
+
font-family: 'Material Icons Two Tone';
|
|
65
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import {html, LitElement, render, unsafeCSS} from 'lit';
|
|
2
|
+
import {customElement, property} from 'lit/decorators.js';
|
|
3
|
+
// @ts-ignore
|
|
4
|
+
import styles from '../scss/Styles.scss';
|
|
5
|
+
import {md5} from './md5'
|
|
6
|
+
|
|
7
|
+
const Library = {
|
|
8
|
+
None: "",
|
|
9
|
+
Material: "material",
|
|
10
|
+
MaterialOutlined: "material-outlined",
|
|
11
|
+
MaterialRound: "material-round",
|
|
12
|
+
MaterialSharp: "material-sharp",
|
|
13
|
+
MaterialTwoTone: "material-two-tone",
|
|
14
|
+
Gravatar: "gravatar",
|
|
15
|
+
Libravatar: "libravatar"
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@customElement('zn-icon')
|
|
19
|
+
export class ZincIcon extends LitElement {
|
|
20
|
+
static styles = unsafeCSS(styles);
|
|
21
|
+
|
|
22
|
+
gravatarOptions = ""
|
|
23
|
+
|
|
24
|
+
@property({reflect: true})
|
|
25
|
+
src = ""
|
|
26
|
+
|
|
27
|
+
@property({reflect: true})
|
|
28
|
+
size = 24
|
|
29
|
+
|
|
30
|
+
@property({reflect: true})
|
|
31
|
+
library = Library.None
|
|
32
|
+
|
|
33
|
+
@property()
|
|
34
|
+
round = false
|
|
35
|
+
|
|
36
|
+
connectedCallback() {
|
|
37
|
+
super.connectedCallback();
|
|
38
|
+
|
|
39
|
+
//Register the material design icon packs
|
|
40
|
+
render(html`
|
|
41
|
+
<link
|
|
42
|
+
href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Round|Material+Icons+Sharp|Material+Icons+Two+Tone"
|
|
43
|
+
rel="stylesheet">`, document.head);
|
|
44
|
+
|
|
45
|
+
if (this.src.includes('@')) {
|
|
46
|
+
if (this.library == "") {
|
|
47
|
+
const split = this.src.split('@')
|
|
48
|
+
if (split[1].includes('.')) {
|
|
49
|
+
this.library = Library.Gravatar
|
|
50
|
+
} else {
|
|
51
|
+
this.library = split[1]
|
|
52
|
+
this.src = split[0]
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (this.library == Library.Gravatar || this.library == Library.Libravatar) {
|
|
57
|
+
this.ravatarOptions()
|
|
58
|
+
this.src = md5(this.src)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
this.ravatarOptions()
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
ravatarOptions() {
|
|
65
|
+
if ((this.library == Library.Gravatar || this.library == Library.Libravatar) && this.src.includes('#')) {
|
|
66
|
+
const split = this.src.split('#')
|
|
67
|
+
this.gravatarOptions = "&d=" + split[1]
|
|
68
|
+
this.src = split[0]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
attributeChangedCallback(name: string, _old: string | null, value: string | null) {
|
|
73
|
+
super.attributeChangedCallback(name, _old, value);
|
|
74
|
+
if (name == "size") {
|
|
75
|
+
this.size = Number(value) - Number(value) % 8;
|
|
76
|
+
this.style.setProperty('--icon-size', this.size + "px")
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
render() {
|
|
81
|
+
switch (this.library) {
|
|
82
|
+
case Library.Material:
|
|
83
|
+
return html`<i class="mi mi">${this.src}</i>`;
|
|
84
|
+
case Library.MaterialOutlined:
|
|
85
|
+
return html`<i class="mi mi--outlined">${this.src}</i>`;
|
|
86
|
+
case Library.MaterialRound:
|
|
87
|
+
return html`<i class="mi mi--round">${this.src}</i>`;
|
|
88
|
+
case Library.MaterialSharp:
|
|
89
|
+
return html`<i class="mi mi--sharp">${this.src}</i>`;
|
|
90
|
+
case Library.MaterialTwoTone:
|
|
91
|
+
return html`<i class="mi mi--two-tone">${this.src}</i>`;
|
|
92
|
+
case Library.Gravatar:
|
|
93
|
+
return html`<img
|
|
94
|
+
src="https://www.gravatar.com/avatar/${this.src}?s=${this.size}${this.gravatarOptions}"/>`;
|
|
95
|
+
case Library.Libravatar:
|
|
96
|
+
return html`<img
|
|
97
|
+
src="https://seccdn.libravatar.org/avatar/${this.src}?s=${this.size}${this.gravatarOptions}"/>`;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (this.src != "") {
|
|
101
|
+
return html`
|
|
102
|
+
<img src="${this.src}" class="${this.library}/">`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return html`
|
|
106
|
+
<slot></slot>`;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
export function md5(string) {
|
|
2
|
+
|
|
3
|
+
function RotateLeft(lValue, iShiftBits) {
|
|
4
|
+
return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function AddUnsigned(lX, lY) {
|
|
8
|
+
var lX4, lY4, lX8, lY8, lResult;
|
|
9
|
+
lX8 = (lX & 0x80000000);
|
|
10
|
+
lY8 = (lY & 0x80000000);
|
|
11
|
+
lX4 = (lX & 0x40000000);
|
|
12
|
+
lY4 = (lY & 0x40000000);
|
|
13
|
+
lResult = (lX & 0x3FFFFFFF) + (lY & 0x3FFFFFFF);
|
|
14
|
+
if (lX4 & lY4) {
|
|
15
|
+
return (lResult ^ 0x80000000 ^ lX8 ^ lY8);
|
|
16
|
+
}
|
|
17
|
+
if (lX4 | lY4) {
|
|
18
|
+
if (lResult & 0x40000000) {
|
|
19
|
+
return (lResult ^ 0xC0000000 ^ lX8 ^ lY8);
|
|
20
|
+
} else {
|
|
21
|
+
return (lResult ^ 0x40000000 ^ lX8 ^ lY8);
|
|
22
|
+
}
|
|
23
|
+
} else {
|
|
24
|
+
return (lResult ^ lX8 ^ lY8);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function F(x, y, z) {
|
|
29
|
+
return (x & y) | ((~x) & z);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function G(x, y, z) {
|
|
33
|
+
return (x & z) | (y & (~z));
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function H(x, y, z) {
|
|
37
|
+
return (x ^ y ^ z);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function I(x, y, z) {
|
|
41
|
+
return (y ^ (x | (~z)));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function FF(a, b, c, d, x, s, ac) {
|
|
45
|
+
a = AddUnsigned(a, AddUnsigned(AddUnsigned(F(b, c, d), x), ac));
|
|
46
|
+
return AddUnsigned(RotateLeft(a, s), b);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
function GG(a, b, c, d, x, s, ac) {
|
|
50
|
+
a = AddUnsigned(a, AddUnsigned(AddUnsigned(G(b, c, d), x), ac));
|
|
51
|
+
return AddUnsigned(RotateLeft(a, s), b);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
function HH(a, b, c, d, x, s, ac) {
|
|
55
|
+
a = AddUnsigned(a, AddUnsigned(AddUnsigned(H(b, c, d), x), ac));
|
|
56
|
+
return AddUnsigned(RotateLeft(a, s), b);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function II(a, b, c, d, x, s, ac) {
|
|
60
|
+
a = AddUnsigned(a, AddUnsigned(AddUnsigned(I(b, c, d), x), ac));
|
|
61
|
+
return AddUnsigned(RotateLeft(a, s), b);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
function ConvertToWordArray(string) {
|
|
65
|
+
var lWordCount;
|
|
66
|
+
var lMessageLength = string.length;
|
|
67
|
+
var lNumberOfWords_temp1 = lMessageLength + 8;
|
|
68
|
+
var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
|
|
69
|
+
var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
|
|
70
|
+
var lWordArray = Array(lNumberOfWords - 1);
|
|
71
|
+
var lBytePosition = 0;
|
|
72
|
+
var lByteCount = 0;
|
|
73
|
+
while (lByteCount < lMessageLength) {
|
|
74
|
+
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
|
75
|
+
lBytePosition = (lByteCount % 4) * 8;
|
|
76
|
+
lWordArray[lWordCount] = (lWordArray[lWordCount] | (string.charCodeAt(lByteCount) << lBytePosition));
|
|
77
|
+
lByteCount++;
|
|
78
|
+
}
|
|
79
|
+
lWordCount = (lByteCount - (lByteCount % 4)) / 4;
|
|
80
|
+
lBytePosition = (lByteCount % 4) * 8;
|
|
81
|
+
lWordArray[lWordCount] = lWordArray[lWordCount] | (0x80 << lBytePosition);
|
|
82
|
+
lWordArray[lNumberOfWords - 2] = lMessageLength << 3;
|
|
83
|
+
lWordArray[lNumberOfWords - 1] = lMessageLength >>> 29;
|
|
84
|
+
return lWordArray;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
function WordToHex(lValue) {
|
|
88
|
+
var WordToHexValue = "", WordToHexValue_temp = "", lByte, lCount;
|
|
89
|
+
for (lCount = 0; lCount <= 3; lCount++) {
|
|
90
|
+
lByte = (lValue >>> (lCount * 8)) & 255;
|
|
91
|
+
WordToHexValue_temp = "0" + lByte.toString(16);
|
|
92
|
+
WordToHexValue = WordToHexValue + WordToHexValue_temp.substr(WordToHexValue_temp.length - 2, 2);
|
|
93
|
+
}
|
|
94
|
+
return WordToHexValue;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
function Utf8Encode(string) {
|
|
98
|
+
string = string.replace(/\r\n/g, "\n");
|
|
99
|
+
var utftext = "";
|
|
100
|
+
|
|
101
|
+
for (var n = 0; n < string.length; n++) {
|
|
102
|
+
|
|
103
|
+
var c = string.charCodeAt(n);
|
|
104
|
+
|
|
105
|
+
if (c < 128) {
|
|
106
|
+
utftext += String.fromCharCode(c);
|
|
107
|
+
} else if ((c > 127) && (c < 2048)) {
|
|
108
|
+
utftext += String.fromCharCode((c >> 6) | 192);
|
|
109
|
+
utftext += String.fromCharCode((c & 63) | 128);
|
|
110
|
+
} else {
|
|
111
|
+
utftext += String.fromCharCode((c >> 12) | 224);
|
|
112
|
+
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
|
|
113
|
+
utftext += String.fromCharCode((c & 63) | 128);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return utftext;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
var x = Array();
|
|
122
|
+
var k, AA, BB, CC, DD, a, b, c, d;
|
|
123
|
+
var S11 = 7, S12 = 12, S13 = 17, S14 = 22;
|
|
124
|
+
var S21 = 5, S22 = 9, S23 = 14, S24 = 20;
|
|
125
|
+
var S31 = 4, S32 = 11, S33 = 16, S34 = 23;
|
|
126
|
+
var S41 = 6, S42 = 10, S43 = 15, S44 = 21;
|
|
127
|
+
|
|
128
|
+
string = Utf8Encode(string);
|
|
129
|
+
|
|
130
|
+
x = ConvertToWordArray(string);
|
|
131
|
+
|
|
132
|
+
a = 0x67452301;
|
|
133
|
+
b = 0xEFCDAB89;
|
|
134
|
+
c = 0x98BADCFE;
|
|
135
|
+
d = 0x10325476;
|
|
136
|
+
|
|
137
|
+
for (k = 0; k < x.length; k += 16) {
|
|
138
|
+
AA = a;
|
|
139
|
+
BB = b;
|
|
140
|
+
CC = c;
|
|
141
|
+
DD = d;
|
|
142
|
+
a = FF(a, b, c, d, x[k + 0], S11, 0xD76AA478);
|
|
143
|
+
d = FF(d, a, b, c, x[k + 1], S12, 0xE8C7B756);
|
|
144
|
+
c = FF(c, d, a, b, x[k + 2], S13, 0x242070DB);
|
|
145
|
+
b = FF(b, c, d, a, x[k + 3], S14, 0xC1BDCEEE);
|
|
146
|
+
a = FF(a, b, c, d, x[k + 4], S11, 0xF57C0FAF);
|
|
147
|
+
d = FF(d, a, b, c, x[k + 5], S12, 0x4787C62A);
|
|
148
|
+
c = FF(c, d, a, b, x[k + 6], S13, 0xA8304613);
|
|
149
|
+
b = FF(b, c, d, a, x[k + 7], S14, 0xFD469501);
|
|
150
|
+
a = FF(a, b, c, d, x[k + 8], S11, 0x698098D8);
|
|
151
|
+
d = FF(d, a, b, c, x[k + 9], S12, 0x8B44F7AF);
|
|
152
|
+
c = FF(c, d, a, b, x[k + 10], S13, 0xFFFF5BB1);
|
|
153
|
+
b = FF(b, c, d, a, x[k + 11], S14, 0x895CD7BE);
|
|
154
|
+
a = FF(a, b, c, d, x[k + 12], S11, 0x6B901122);
|
|
155
|
+
d = FF(d, a, b, c, x[k + 13], S12, 0xFD987193);
|
|
156
|
+
c = FF(c, d, a, b, x[k + 14], S13, 0xA679438E);
|
|
157
|
+
b = FF(b, c, d, a, x[k + 15], S14, 0x49B40821);
|
|
158
|
+
a = GG(a, b, c, d, x[k + 1], S21, 0xF61E2562);
|
|
159
|
+
d = GG(d, a, b, c, x[k + 6], S22, 0xC040B340);
|
|
160
|
+
c = GG(c, d, a, b, x[k + 11], S23, 0x265E5A51);
|
|
161
|
+
b = GG(b, c, d, a, x[k + 0], S24, 0xE9B6C7AA);
|
|
162
|
+
a = GG(a, b, c, d, x[k + 5], S21, 0xD62F105D);
|
|
163
|
+
d = GG(d, a, b, c, x[k + 10], S22, 0x2441453);
|
|
164
|
+
c = GG(c, d, a, b, x[k + 15], S23, 0xD8A1E681);
|
|
165
|
+
b = GG(b, c, d, a, x[k + 4], S24, 0xE7D3FBC8);
|
|
166
|
+
a = GG(a, b, c, d, x[k + 9], S21, 0x21E1CDE6);
|
|
167
|
+
d = GG(d, a, b, c, x[k + 14], S22, 0xC33707D6);
|
|
168
|
+
c = GG(c, d, a, b, x[k + 3], S23, 0xF4D50D87);
|
|
169
|
+
b = GG(b, c, d, a, x[k + 8], S24, 0x455A14ED);
|
|
170
|
+
a = GG(a, b, c, d, x[k + 13], S21, 0xA9E3E905);
|
|
171
|
+
d = GG(d, a, b, c, x[k + 2], S22, 0xFCEFA3F8);
|
|
172
|
+
c = GG(c, d, a, b, x[k + 7], S23, 0x676F02D9);
|
|
173
|
+
b = GG(b, c, d, a, x[k + 12], S24, 0x8D2A4C8A);
|
|
174
|
+
a = HH(a, b, c, d, x[k + 5], S31, 0xFFFA3942);
|
|
175
|
+
d = HH(d, a, b, c, x[k + 8], S32, 0x8771F681);
|
|
176
|
+
c = HH(c, d, a, b, x[k + 11], S33, 0x6D9D6122);
|
|
177
|
+
b = HH(b, c, d, a, x[k + 14], S34, 0xFDE5380C);
|
|
178
|
+
a = HH(a, b, c, d, x[k + 1], S31, 0xA4BEEA44);
|
|
179
|
+
d = HH(d, a, b, c, x[k + 4], S32, 0x4BDECFA9);
|
|
180
|
+
c = HH(c, d, a, b, x[k + 7], S33, 0xF6BB4B60);
|
|
181
|
+
b = HH(b, c, d, a, x[k + 10], S34, 0xBEBFBC70);
|
|
182
|
+
a = HH(a, b, c, d, x[k + 13], S31, 0x289B7EC6);
|
|
183
|
+
d = HH(d, a, b, c, x[k + 0], S32, 0xEAA127FA);
|
|
184
|
+
c = HH(c, d, a, b, x[k + 3], S33, 0xD4EF3085);
|
|
185
|
+
b = HH(b, c, d, a, x[k + 6], S34, 0x4881D05);
|
|
186
|
+
a = HH(a, b, c, d, x[k + 9], S31, 0xD9D4D039);
|
|
187
|
+
d = HH(d, a, b, c, x[k + 12], S32, 0xE6DB99E5);
|
|
188
|
+
c = HH(c, d, a, b, x[k + 15], S33, 0x1FA27CF8);
|
|
189
|
+
b = HH(b, c, d, a, x[k + 2], S34, 0xC4AC5665);
|
|
190
|
+
a = II(a, b, c, d, x[k + 0], S41, 0xF4292244);
|
|
191
|
+
d = II(d, a, b, c, x[k + 7], S42, 0x432AFF97);
|
|
192
|
+
c = II(c, d, a, b, x[k + 14], S43, 0xAB9423A7);
|
|
193
|
+
b = II(b, c, d, a, x[k + 5], S44, 0xFC93A039);
|
|
194
|
+
a = II(a, b, c, d, x[k + 12], S41, 0x655B59C3);
|
|
195
|
+
d = II(d, a, b, c, x[k + 3], S42, 0x8F0CCC92);
|
|
196
|
+
c = II(c, d, a, b, x[k + 10], S43, 0xFFEFF47D);
|
|
197
|
+
b = II(b, c, d, a, x[k + 1], S44, 0x85845DD1);
|
|
198
|
+
a = II(a, b, c, d, x[k + 8], S41, 0x6FA87E4F);
|
|
199
|
+
d = II(d, a, b, c, x[k + 15], S42, 0xFE2CE6E0);
|
|
200
|
+
c = II(c, d, a, b, x[k + 6], S43, 0xA3014314);
|
|
201
|
+
b = II(b, c, d, a, x[k + 13], S44, 0x4E0811A1);
|
|
202
|
+
a = II(a, b, c, d, x[k + 4], S41, 0xF7537E82);
|
|
203
|
+
d = II(d, a, b, c, x[k + 11], S42, 0xBD3AF235);
|
|
204
|
+
c = II(c, d, a, b, x[k + 2], S43, 0x2AD7D2BB);
|
|
205
|
+
b = II(b, c, d, a, x[k + 9], S44, 0xEB86D391);
|
|
206
|
+
a = AddUnsigned(a, AA);
|
|
207
|
+
b = AddUnsigned(b, BB);
|
|
208
|
+
c = AddUnsigned(c, CC);
|
|
209
|
+
d = AddUnsigned(d, DD);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
var temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d);
|
|
213
|
+
|
|
214
|
+
return temp.toLowerCase();
|
|
215
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>Zinc-Max-Width Demo</title>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<zn-max-width>Contained Content</zn-max-width>
|
|
9
|
+
<script src="../dist/zn-max-width.js" type="text/javascript"></script>
|
|
10
|
+
</body>
|
|
11
|
+
</html>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
!function(t){"use strict";
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */function e(t,e,i,s){var n,o=arguments.length,r=o<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var l=t.length-1;l>=0;l--)(n=t[l])&&(r=(o<3?n(r):o>3?n(e,i,r):n(e,i))||r);return o>3&&r&&Object.defineProperty(e,i,r),r
|
|
16
|
+
/**
|
|
17
|
+
* @license
|
|
18
|
+
* Copyright 2019 Google LLC
|
|
19
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
20
|
+
*/}const i=window.ShadowRoot&&(void 0===window.ShadyCSS||window.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),n=new Map;class o{constructor(t,e){if(this._$cssResult$=!0,e!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t}get styleSheet(){let t=n.get(this.cssText);return i&&void 0===t&&(n.set(this.cssText,t=new CSSStyleSheet),t.replaceSync(this.cssText)),t}toString(){return this.cssText}}const r=t=>new o("string"==typeof t?t:t+"",s),l=i?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const i of t.cssRules)e+=i.cssText;return r(e)})(t):t
|
|
21
|
+
/**
|
|
22
|
+
* @license
|
|
23
|
+
* Copyright 2017 Google LLC
|
|
24
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
+
*/;var h;const a=window.reactiveElementPolyfillSupport,d={toAttribute(t,e){switch(e){case Boolean:t=t?"":null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let i=t;switch(e){case Boolean:i=null!==t;break;case Number:i=null===t?null:Number(t);break;case Object:case Array:try{i=JSON.parse(t)}catch(t){i=null}}return i}},c=(t,e)=>e!==t&&(e==e||t==t),u={attribute:!0,type:String,converter:d,reflect:!1,hasChanged:c};class p extends HTMLElement{constructor(){super(),this._$Et=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Ei=null,this.o()}static addInitializer(t){var e;null!==(e=this.l)&&void 0!==e||(this.l=[]),this.l.push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach(((e,i)=>{const s=this._$Eh(i,e);void 0!==s&&(this._$Eu.set(s,i),t.push(s))})),t}static createProperty(t,e=u){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){const i="symbol"==typeof t?Symbol():"__"+t,s=this.getPropertyDescriptor(t,i,e);void 0!==s&&Object.defineProperty(this.prototype,t,s)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(s){const n=this[t];this[e]=s,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||u}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),this.elementProperties=new Map(t.elementProperties),this._$Eu=new Map,this.hasOwnProperty("properties")){const t=this.properties,e=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(const i of e)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const i=new Set(t.flat(1/0).reverse());for(const t of i)e.unshift(l(t))}else void 0!==t&&e.push(l(t));return e}static _$Eh(t,e){const i=e.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof t?t.toLowerCase():void 0}o(){var t;this._$Ev=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Ep(),this.requestUpdate(),null===(t=this.constructor.l)||void 0===t||t.forEach((t=>t(this)))}addController(t){var e,i;(null!==(e=this._$Em)&&void 0!==e?e:this._$Em=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&(null===(i=t.hostConnected)||void 0===i||i.call(t))}removeController(t){var e;null===(e=this._$Em)||void 0===e||e.splice(this._$Em.indexOf(t)>>>0,1)}_$Ep(){this.constructor.elementProperties.forEach(((t,e)=>{this.hasOwnProperty(e)&&(this._$Et.set(e,this[e]),delete this[e])}))}createRenderRoot(){var t;const e=null!==(t=this.shadowRoot)&&void 0!==t?t:this.attachShadow(this.constructor.shadowRootOptions);return((t,e)=>{i?t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((e=>{const i=document.createElement("style"),s=window.litNonce;void 0!==s&&i.setAttribute("nonce",s),i.textContent=e.cssText,t.appendChild(i)}))})(e,this.constructor.elementStyles),e}connectedCallback(){var t;void 0===this.renderRoot&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),null===(t=this._$Em)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostConnected)||void 0===e?void 0:e.call(t)}))}enableUpdating(t){}disconnectedCallback(){var t;null===(t=this._$Em)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostDisconnected)||void 0===e?void 0:e.call(t)}))}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$Eg(t,e,i=u){var s,n;const o=this.constructor._$Eh(t,i);if(void 0!==o&&!0===i.reflect){const r=(null!==(n=null===(s=i.converter)||void 0===s?void 0:s.toAttribute)&&void 0!==n?n:d.toAttribute)(e,i.type);this._$Ei=t,null==r?this.removeAttribute(o):this.setAttribute(o,r),this._$Ei=null}}_$AK(t,e){var i,s,n;const o=this.constructor,r=o._$Eu.get(t);if(void 0!==r&&this._$Ei!==r){const t=o.getPropertyOptions(r),l=t.converter,h=null!==(n=null!==(s=null===(i=l)||void 0===i?void 0:i.fromAttribute)&&void 0!==s?s:"function"==typeof l?l:null)&&void 0!==n?n:d.fromAttribute;this._$Ei=r,this[r]=h(e,t.type),this._$Ei=null}}requestUpdate(t,e,i){let s=!0;void 0!==t&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||c)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),!0===i.reflect&&this._$Ei!==t&&(void 0===this._$ES&&(this._$ES=new Map),this._$ES.set(t,i))):s=!1),!this.isUpdatePending&&s&&(this._$Ev=this._$EC())}async _$EC(){this.isUpdatePending=!0;try{await this._$Ev}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Et&&(this._$Et.forEach(((t,e)=>this[e]=t)),this._$Et=void 0);let e=!1;const i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),null===(t=this._$Em)||void 0===t||t.forEach((t=>{var e;return null===(e=t.hostUpdate)||void 0===e?void 0:e.call(t)})),this.update(i)):this._$EU()}catch(t){throw e=!1,this._$EU(),t}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;null===(e=this._$Em)||void 0===e||e.forEach((t=>{var e;return null===(e=t.hostUpdated)||void 0===e?void 0:e.call(t)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Ev}shouldUpdate(t){return!0}update(t){void 0!==this._$ES&&(this._$ES.forEach(((t,e)=>this._$Eg(e,this[e],t))),this._$ES=void 0),this._$EU()}updated(t){}firstUpdated(t){}}
|
|
26
|
+
/**
|
|
27
|
+
* @license
|
|
28
|
+
* Copyright 2017 Google LLC
|
|
29
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
30
|
+
*/
|
|
31
|
+
var v;p.finalized=!0,p.elementProperties=new Map,p.elementStyles=[],p.shadowRootOptions={mode:"open"},null==a||a({ReactiveElement:p}),(null!==(h=globalThis.reactiveElementVersions)&&void 0!==h?h:globalThis.reactiveElementVersions=[]).push("1.0.1");const $=globalThis.trustedTypes,_=$?$.createPolicy("lit-html",{createHTML:t=>t}):void 0,f=`lit$${(Math.random()+"").slice(9)}$`,A="?"+f,m=`<${A}>`,y=document,g=(t="")=>y.createComment(t),E=t=>null===t||"object"!=typeof t&&"function"!=typeof t,b=Array.isArray,S=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,w=/-->/g,C=/>/g,x=/>|[ \n\r](?:([^\s"'>=/]+)([ \n\r]*=[ \n\r]*(?:[^ \n\r"'`<>=]|("|')|))|$)/g,P=/'/g,U=/"/g,H=/^(?:script|style|textarea)$/i,T=(t=>(e,...i)=>({_$litType$:t,strings:e,values:i}))(1),M=Symbol.for("lit-noChange"),N=Symbol.for("lit-nothing"),O=new WeakMap,R=y.createTreeWalker(y,129,null,!1),k=(t,e)=>{const i=t.length-1,s=[];let n,o=2===e?"<svg>":"",r=S;for(let e=0;e<i;e++){const i=t[e];let l,h,a=-1,d=0;for(;d<i.length&&(r.lastIndex=d,h=r.exec(i),null!==h);)d=r.lastIndex,r===S?"!--"===h[1]?r=w:void 0!==h[1]?r=C:void 0!==h[2]?(H.test(h[2])&&(n=RegExp("</"+h[2],"g")),r=x):void 0!==h[3]&&(r=x):r===x?">"===h[0]?(r=null!=n?n:S,a=-1):void 0===h[1]?a=-2:(a=r.lastIndex-h[2].length,l=h[1],r=void 0===h[3]?x:'"'===h[3]?U:P):r===U||r===P?r=x:r===w||r===C?r=S:(r=x,n=void 0);const c=r===x&&t[e+1].startsWith("/>")?" ":"";o+=r===S?i+m:a>=0?(s.push(l),i.slice(0,a)+"$lit$"+i.slice(a)+f+c):i+f+(-2===a?(s.push(void 0),e):c)}const l=o+(t[i]||"<?>")+(2===e?"</svg>":"");return[void 0!==_?_.createHTML(l):l,s]};class z{constructor({strings:t,_$litType$:e},i){let s;this.parts=[];let n=0,o=0;const r=t.length-1,l=this.parts,[h,a]=k(t,e);if(this.el=z.createElement(h,i),R.currentNode=this.el.content,2===e){const t=this.el.content,e=t.firstChild;e.remove(),t.append(...e.childNodes)}for(;null!==(s=R.nextNode())&&l.length<r;){if(1===s.nodeType){if(s.hasAttributes()){const t=[];for(const e of s.getAttributeNames())if(e.endsWith("$lit$")||e.startsWith(f)){const i=a[o++];if(t.push(e),void 0!==i){const t=s.getAttribute(i.toLowerCase()+"$lit$").split(f),e=/([.?@])?(.*)/.exec(i);l.push({type:1,index:n,name:e[2],strings:t,ctor:"."===e[1]?I:"?"===e[1]?W:"@"===e[1]?Z:D})}else l.push({type:6,index:n})}for(const e of t)s.removeAttribute(e)}if(H.test(s.tagName)){const t=s.textContent.split(f),e=t.length-1;if(e>0){s.textContent=$?$.emptyScript:"";for(let i=0;i<e;i++)s.append(t[i],g()),R.nextNode(),l.push({type:2,index:++n});s.append(t[e],g())}}}else if(8===s.nodeType)if(s.data===A)l.push({type:2,index:n});else{let t=-1;for(;-1!==(t=s.data.indexOf(f,t+1));)l.push({type:7,index:n}),t+=f.length-1}n++}}static createElement(t,e){const i=y.createElement("template");return i.innerHTML=t,i}}function L(t,e,i=t,s){var n,o,r,l;if(e===M)return e;let h=void 0!==s?null===(n=i._$Cl)||void 0===n?void 0:n[s]:i._$Cu;const a=E(e)?void 0:e._$litDirective$;return(null==h?void 0:h.constructor)!==a&&(null===(o=null==h?void 0:h._$AO)||void 0===o||o.call(h,!1),void 0===a?h=void 0:(h=new a(t),h._$AT(t,i,s)),void 0!==s?(null!==(r=(l=i)._$Cl)&&void 0!==r?r:l._$Cl=[])[s]=h:i._$Cu=h),void 0!==h&&(e=L(t,h._$AS(t,e.values),h,s)),e}class j{constructor(t,e){this.v=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}p(t){var e;const{el:{content:i},parts:s}=this._$AD,n=(null!==(e=null==t?void 0:t.creationScope)&&void 0!==e?e:y).importNode(i,!0);R.currentNode=n;let o=R.nextNode(),r=0,l=0,h=s[0];for(;void 0!==h;){if(r===h.index){let e;2===h.type?e=new B(o,o.nextSibling,this,t):1===h.type?e=new h.ctor(o,h.name,h.strings,this,t):6===h.type&&(e=new V(o,this,t)),this.v.push(e),h=s[++l]}r!==(null==h?void 0:h.index)&&(o=R.nextNode(),r++)}return n}m(t){let e=0;for(const i of this.v)void 0!==i&&(void 0!==i.strings?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}}class B{constructor(t,e,i,s){var n;this.type=2,this._$AH=N,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=s,this._$Cg=null===(n=null==s?void 0:s.isConnected)||void 0===n||n}get _$AU(){var t,e;return null!==(e=null===(t=this._$AM)||void 0===t?void 0:t._$AU)&&void 0!==e?e:this._$Cg}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=L(this,t,e),E(t)?t===N||null==t||""===t?(this._$AH!==N&&this._$AR(),this._$AH=N):t!==this._$AH&&t!==M&&this.$(t):void 0!==t._$litType$?this.T(t):void 0!==t.nodeType?this.S(t):(t=>{var e;return b(t)||"function"==typeof(null===(e=t)||void 0===e?void 0:e[Symbol.iterator])})(t)?this.M(t):this.$(t)}A(t,e=this._$AB){return this._$AA.parentNode.insertBefore(t,e)}S(t){this._$AH!==t&&(this._$AR(),this._$AH=this.A(t))}$(t){this._$AH!==N&&E(this._$AH)?this._$AA.nextSibling.data=t:this.S(y.createTextNode(t)),this._$AH=t}T(t){var e;const{values:i,_$litType$:s}=t,n="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=z.createElement(s.h,this.options)),s);if((null===(e=this._$AH)||void 0===e?void 0:e._$AD)===n)this._$AH.m(i);else{const t=new j(n,this),e=t.p(this.options);t.m(i),this.S(e),this._$AH=t}}_$AC(t){let e=O.get(t.strings);return void 0===e&&O.set(t.strings,e=new z(t)),e}M(t){b(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let i,s=0;for(const n of t)s===e.length?e.push(i=new B(this.A(g()),this.A(g()),this,this.options)):i=e[s],i._$AI(n),s++;s<e.length&&(this._$AR(i&&i._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){var i;for(null===(i=this._$AP)||void 0===i||i.call(this,!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){var e;void 0===this._$AM&&(this._$Cg=t,null===(e=this._$AP)||void 0===e||e.call(this,t))}}class D{constructor(t,e,i,s,n){this.type=1,this._$AH=N,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=N}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,s){const n=this.strings;let o=!1;if(void 0===n)t=L(this,t,e,0),o=!E(t)||t!==this._$AH&&t!==M,o&&(this._$AH=t);else{const s=t;let r,l;for(t=n[0],r=0;r<n.length-1;r++)l=L(this,s[i+r],e,r),l===M&&(l=this._$AH[r]),o||(o=!E(l)||l!==this._$AH[r]),l===N?t=N:t!==N&&(t+=(null!=l?l:"")+n[r+1]),this._$AH[r]=l}o&&!s&&this.k(t)}k(t){t===N?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,null!=t?t:"")}}class I extends D{constructor(){super(...arguments),this.type=3}k(t){this.element[this.name]=t===N?void 0:t}}class W extends D{constructor(){super(...arguments),this.type=4}k(t){t&&t!==N?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name)}}class Z extends D{constructor(t,e,i,s,n){super(t,e,i,s,n),this.type=5}_$AI(t,e=this){var i;if((t=null!==(i=L(this,t,e,0))&&void 0!==i?i:N)===M)return;const s=this._$AH,n=t===N&&s!==N||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==N&&(s===N||n);n&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;"function"==typeof this._$AH?this._$AH.call(null!==(i=null===(e=this.options)||void 0===e?void 0:e.host)&&void 0!==i?i:this.element,t):this._$AH.handleEvent(t)}}class V{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){L(this,t)}}const q=window.litHtmlPolyfillSupport;
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2017 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
36
|
+
*/
|
|
37
|
+
var K,J;null==q||q(z,B),(null!==(v=globalThis.litHtmlVersions)&&void 0!==v?v:globalThis.litHtmlVersions=[]).push("2.0.1");class F extends p{constructor(){super(...arguments),this.renderOptions={host:this},this._$Dt=void 0}createRenderRoot(){var t,e;const i=super.createRenderRoot();return null!==(t=(e=this.renderOptions).renderBefore)&&void 0!==t||(e.renderBefore=i.firstChild),i}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Dt=((t,e,i)=>{var s,n;const o=null!==(s=null==i?void 0:i.renderBefore)&&void 0!==s?s:e;let r=o._$litPart$;if(void 0===r){const t=null!==(n=null==i?void 0:i.renderBefore)&&void 0!==n?n:null;o._$litPart$=r=new B(e.insertBefore(g(),t),t,void 0,null!=i?i:{})}return r._$AI(t),r})(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._$Dt)||void 0===t||t.setConnected(!1)}render(){return M}}F.finalized=!0,F._$litElement$=!0,null===(K=globalThis.litElementHydrateSupport)||void 0===K||K.call(globalThis,{LitElement:F});const G=globalThis.litElementPolyfillSupport;null==G||G({LitElement:F}),(null!==(J=globalThis.litElementVersions)&&void 0!==J?J:globalThis.litElementVersions=[]).push("3.0.1");
|
|
38
|
+
/**
|
|
39
|
+
* @license
|
|
40
|
+
* Copyright 2017 Google LLC
|
|
41
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
42
|
+
*/
|
|
43
|
+
const Q=(t,e)=>"method"===e.kind&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(i){i.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){"function"==typeof e.initializer&&(this[e.key]=e.initializer.call(this))},finisher(i){i.createProperty(e.key,t)}};
|
|
44
|
+
/**
|
|
45
|
+
* @license
|
|
46
|
+
* Copyright 2017 Google LLC
|
|
47
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
48
|
+
*/t.ZincMaxWidth=class extends F{constructor(){super(...arguments),this.width=1024}attributeChangedCallback(t,e,i){super.attributeChangedCallback(t,e,i),Number(i)<1&&(this.width=Number(e)),this.style.setProperty("--max-width",this.width+"px")}render(){return T`
|
|
49
|
+
<div class="container">
|
|
50
|
+
<slot></slot>
|
|
51
|
+
</div>`}},t.ZincMaxWidth.styles=r(":root{--max-width:1024}:host{display:flex;justify-content:center}.container{max-width:calc(var(--max-width));width:100%}"),e([function(t){return(e,i)=>void 0!==i?((t,e,i)=>{e.constructor.createProperty(i,t)})(t,e,i):Q(t,e)}({reflect:!0})],t.ZincMaxWidth.prototype,"width",void 0),t.ZincMaxWidth=e([(t=>e=>"function"==typeof e?((t,e)=>(window.customElements.define(t,e),e))(t,e):((t,e)=>{const{kind:i,elements:s}=e;return{kind:i,elements:s,finisher(e){window.customElements.define(t,e)}}})(t,e))("zn-max-width")],t.ZincMaxWidth),Object.defineProperty(t,"__esModule",{value:!0})}({});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
package MaxWidth
|
|
2
|
+
|
|
3
|
+
import (
|
|
4
|
+
"fmt"
|
|
5
|
+
"html/template"
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
type Instance struct {
|
|
9
|
+
size int32
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
func New() Instance {
|
|
13
|
+
return Instance{}
|
|
14
|
+
}
|
|
15
|
+
func Defined(size int32) Instance {
|
|
16
|
+
return Instance{size: size}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
func (i Instance) Size() int32 { return i.size }
|
|
20
|
+
func (i *Instance) SetSize(size int32) { i.size = size }
|
|
21
|
+
|
|
22
|
+
func (i Instance) Html() template.HTML {
|
|
23
|
+
return template.HTML(fmt.Sprintf(`<zn-max-width width="%d"></zn-max-width>`, i.size))
|
|
24
|
+
}
|