@oslokommune/punkt-elements 11.12.3
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 +21 -0
- package/dist/converters-01e4a1b1.cjs +5 -0
- package/dist/converters-92631e0d.js +105 -0
- package/dist/directive-6900e150.cjs +23 -0
- package/dist/directive-720b7cc8.js +606 -0
- package/dist/index-34184de4.js +173 -0
- package/dist/index-51027300.cjs +13 -0
- package/dist/pkt-el-calendar.cjs +60 -0
- package/dist/pkt-el-calendar.js +1504 -0
- package/dist/pkt-el-component-template.cjs +29 -0
- package/dist/pkt-el-component-template.js +100 -0
- package/dist/pkt-el-element.cjs +1 -0
- package/dist/pkt-el-element.js +5 -0
- package/dist/pkt-el-icon.cjs +9 -0
- package/dist/pkt-el-icon.js +103 -0
- package/dist/pkt-el-index.cjs +1 -0
- package/dist/pkt-el-index.js +12 -0
- package/dist/property-0378afc0.js +47 -0
- package/dist/property-e170cbca.cjs +9 -0
- package/dist/src/components/calendar/index.d.ts +60 -0
- package/dist/src/components/component-template/index.d.ts +35 -0
- package/dist/src/components/element/index.d.ts +25 -0
- package/dist/src/components/icon/index.d.ts +30 -0
- package/dist/src/components/index.d.ts +3 -0
- package/dist/src/controllers/pkt-slot-controller.d.ts +12 -0
- package/dist/src/helpers/converters.d.ts +3 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/src/translations/no.json.d.ts +43 -0
- package/dist/vite.config.d.ts +2 -0
- package/package.json +61 -0
- package/src/components/calendar/index.ts +375 -0
- package/src/components/component-template/index.ts +113 -0
- package/src/components/element/index.ts +37 -0
- package/src/components/icon/index.ts +100 -0
- package/src/components/index.ts +3 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./directive-6900e150.cjs"),n=require("./property-e170cbca.cjs"),h=require("./index-51027300.cjs"),c=require("./converters-01e4a1b1.cjs");var d=Object.defineProperty,u=Object.getOwnPropertyDescriptor,r=(i,t,e,o)=>{for(var s=o>1?void 0:o?u(t,e):t,l=i.length-1,p;l>=0;l--)(p=i[l])&&(s=(o?p(t,e,s):p(s))||s);return o&&s&&d(t,e,s),s};exports.PktComponent=class extends h.PktElement{constructor(){super(...arguments),this.string="",this.strings=[],this.darkmode=!1,this._list=[]}connectedCallback(){this.strings.length&&this.strings.forEach(t=>{this._list.push(t.toUpperCase())}),super.connectedCallback()}render(){const t={"pkt-component":!0,"pkt-component--has-list":this.strings.length>0,"pkt-darkmode":this.darkmode};return a.x`
|
|
2
|
+
<div class="${c.e(t)}">
|
|
3
|
+
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
4
|
+
|
|
5
|
+
<h2 class="pkt-txt-22">Innhold fra attributter og funksjoner</h2>
|
|
6
|
+
<div>${this.renderList(this.strings)}</div>
|
|
7
|
+
<div>${this.renderList(this.doStuff(this._list))}</div>
|
|
8
|
+
|
|
9
|
+
<h2 class="pkt-txt-22">Slot</h2>
|
|
10
|
+
<div ${h.n(this.defaultSlot)}>defaultSlotRef</div>
|
|
11
|
+
<h2 class="pkt-txt-22">Named slot</h2>
|
|
12
|
+
<select
|
|
13
|
+
name="named-slot"
|
|
14
|
+
${h.n(this.namedSlot)}
|
|
15
|
+
@change=${e=>alert(e.target.value)}
|
|
16
|
+
>
|
|
17
|
+
namedSlotRef
|
|
18
|
+
</select>
|
|
19
|
+
|
|
20
|
+
<h2 class="pkt-txt-22">Knapp som emitter en event</h2>
|
|
21
|
+
<button type="button" @click=${()=>this.handleGreeting()}>
|
|
22
|
+
Si ${c.translations.example.hi}
|
|
23
|
+
</button>
|
|
24
|
+
</div>
|
|
25
|
+
`}renderList(t){return a.x`
|
|
26
|
+
<ul>
|
|
27
|
+
${t.map(e=>a.x`<li>${e}</li>`)}
|
|
28
|
+
</ul>
|
|
29
|
+
`}doStuff(t){return t.reverse()}handleGreeting(){this.dispatchEvent(new CustomEvent("pkt-greeting",{detail:"Hei på deg!",bubbles:!0,composed:!0}))}};r([n.n({type:String})],exports.PktComponent.prototype,"string",2);r([n.n({converter:c.csvToArray})],exports.PktComponent.prototype,"strings",2);r([n.n({type:Boolean})],exports.PktComponent.prototype,"darkmode",2);r([n.n({type:Array})],exports.PktComponent.prototype,"_list",2);exports.PktComponent=r([n.t("pkt-el-component")],exports.PktComponent);
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { x as h } from "./directive-720b7cc8.js";
|
|
2
|
+
import { n as o, t as c } from "./property-0378afc0.js";
|
|
3
|
+
import { P as m, n as d } from "./index-34184de4.js";
|
|
4
|
+
import { e as u, t as f, c as g } from "./converters-92631e0d.js";
|
|
5
|
+
var v = Object.defineProperty, k = Object.getOwnPropertyDescriptor, n = (t, e, l, i) => {
|
|
6
|
+
for (var s = i > 1 ? void 0 : i ? k(e, l) : e, a = t.length - 1, p; a >= 0; a--)
|
|
7
|
+
(p = t[a]) && (s = (i ? p(e, l, s) : p(s)) || s);
|
|
8
|
+
return i && s && v(e, l, s), s;
|
|
9
|
+
};
|
|
10
|
+
let r = class extends m {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments), this.string = "", this.strings = [], this.darkmode = !1, this._list = [];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Runs on mount, used to set up various values and whatever you need to run
|
|
16
|
+
*/
|
|
17
|
+
connectedCallback() {
|
|
18
|
+
this.strings.length && this.strings.forEach((t) => {
|
|
19
|
+
this._list.push(t.toUpperCase());
|
|
20
|
+
}), super.connectedCallback();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Render functions
|
|
24
|
+
*/
|
|
25
|
+
render() {
|
|
26
|
+
const t = {
|
|
27
|
+
"pkt-component": !0,
|
|
28
|
+
"pkt-component--has-list": this.strings.length > 0,
|
|
29
|
+
"pkt-darkmode": this.darkmode
|
|
30
|
+
};
|
|
31
|
+
return h`
|
|
32
|
+
<div class="${u(t)}">
|
|
33
|
+
<h1 class="pkt-txt-28">${this.string}</h1>
|
|
34
|
+
|
|
35
|
+
<h2 class="pkt-txt-22">Innhold fra attributter og funksjoner</h2>
|
|
36
|
+
<div>${this.renderList(this.strings)}</div>
|
|
37
|
+
<div>${this.renderList(this.doStuff(this._list))}</div>
|
|
38
|
+
|
|
39
|
+
<h2 class="pkt-txt-22">Slot</h2>
|
|
40
|
+
<div ${d(this.defaultSlot)}>defaultSlotRef</div>
|
|
41
|
+
<h2 class="pkt-txt-22">Named slot</h2>
|
|
42
|
+
<select
|
|
43
|
+
name="named-slot"
|
|
44
|
+
${d(this.namedSlot)}
|
|
45
|
+
@change=${(e) => alert(e.target.value)}
|
|
46
|
+
>
|
|
47
|
+
namedSlotRef
|
|
48
|
+
</select>
|
|
49
|
+
|
|
50
|
+
<h2 class="pkt-txt-22">Knapp som emitter en event</h2>
|
|
51
|
+
<button type="button" @click=${() => this.handleGreeting()}>
|
|
52
|
+
Si ${f.example.hi}
|
|
53
|
+
</button>
|
|
54
|
+
</div>
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
renderList(t) {
|
|
58
|
+
return h`
|
|
59
|
+
<ul>
|
|
60
|
+
${t.map((e) => h`<li>${e}</li>`)}
|
|
61
|
+
</ul>
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Add other functionality under here
|
|
66
|
+
*/
|
|
67
|
+
doStuff(t) {
|
|
68
|
+
return t.reverse();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Handlers for returning data from the component
|
|
72
|
+
*/
|
|
73
|
+
handleGreeting() {
|
|
74
|
+
this.dispatchEvent(
|
|
75
|
+
new CustomEvent("pkt-greeting", {
|
|
76
|
+
detail: "Hei på deg!",
|
|
77
|
+
bubbles: !0,
|
|
78
|
+
composed: !0
|
|
79
|
+
})
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
n([
|
|
84
|
+
o({ type: String })
|
|
85
|
+
], r.prototype, "string", 2);
|
|
86
|
+
n([
|
|
87
|
+
o({ converter: g })
|
|
88
|
+
], r.prototype, "strings", 2);
|
|
89
|
+
n([
|
|
90
|
+
o({ type: Boolean })
|
|
91
|
+
], r.prototype, "darkmode", 2);
|
|
92
|
+
n([
|
|
93
|
+
o({ type: Array })
|
|
94
|
+
], r.prototype, "_list", 2);
|
|
95
|
+
r = n([
|
|
96
|
+
c("pkt-el-component")
|
|
97
|
+
], r);
|
|
98
|
+
export {
|
|
99
|
+
r as PktComponent
|
|
100
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./directive-6900e150.cjs");const e=require("./index-51027300.cjs");exports.PktElement=e.PktElement;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./directive-6900e150.cjs"),c=require("./property-e170cbca.cjs");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/class f extends i.i{constructor(t){if(super(t),this.it=i.T,t.type!==i.t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===i.T||t==null)return this._t=void 0,this.it=t;if(t===i.w)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const s=[t];return s.raw=s,this._t={_$litType$:this.constructor.resultType,strings:s,values:[]}}}f.directiveName="unsafeHTML",f.resultType=1;/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/class v extends f{}v.directiveName="unsafeSVG",v.resultType=2;const h=i.e(v);var d=Object.defineProperty,w=Object.getOwnPropertyDescriptor,l=(e,t,s,r)=>{for(var n=r>1?void 0:r?w(t,s):t,a=e.length-1,u;a>=0;a--)(u=e[a])&&(n=(r?u(t,s,n):u(n))||n);return r&&n&&d(t,s,n),n};const y=e=>new Promise(t=>setTimeout(t,e)),o='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',p={},g=async(e,t)=>{let s=0;for(;p[t+e+".svg"]==="fetching"&&(s++,!(s>50));)await y(50);return localStorage.getItem(t+e+".svg")?Promise.resolve(localStorage.getItem(t+e+".svg")):typeof window.fetch=="function"?(p[t+e+".svg"]="fetching",Promise.resolve(fetch(t+e+".svg").then(r=>r.ok?r.text():(console.error("Missing icon: "+t+e+".svg"),o)).then(r=>(r!==o&&localStorage.setItem(t+e+".svg",r),p[t+e+".svg"]="fetched",r)))):Promise.resolve(o)};exports.PktIcon=class extends i.s{constructor(){super(...arguments),this.name="",this.path="https://punkt-cdn.oslo.kommune.no/latest/icons/",this.icon=h(o)}createRenderRoot(){return this}hotReplacedCallback(){this.requestUpdate()}async connectedCallback(){this.name&&this.path&&(this.icon=h(await g(this.name,this.path).then(t=>t))),super.connectedCallback()}async update(t){t.has("name")&&this.name&&this.path&&(this.icon=h(await g(this.name,this.path).then(s=>s))),super.update(t)}render(){return i.x`${this.icon}`}};l([c.n({type:String,reflect:!0})],exports.PktIcon.prototype,"name",2);l([c.n({type:String,reflect:!0})],exports.PktIcon.prototype,"path",2);l([c.n({type:SVGElement})],exports.PktIcon.prototype,"icon",2);exports.PktIcon=l([c.t("pkt-el-icon")],exports.PktIcon);
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { i as m, T as g, t as w, w as y, e as _, s as S, x as b } from "./directive-720b7cc8.js";
|
|
2
|
+
import { n as v, t as P } from "./property-0378afc0.js";
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright 2017 Google LLC
|
|
6
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
7
|
+
*/
|
|
8
|
+
class p extends m {
|
|
9
|
+
constructor(t) {
|
|
10
|
+
if (super(t), this.it = g, t.type !== w.CHILD)
|
|
11
|
+
throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
12
|
+
}
|
|
13
|
+
render(t) {
|
|
14
|
+
if (t === g || t == null)
|
|
15
|
+
return this._t = void 0, this.it = t;
|
|
16
|
+
if (t === y)
|
|
17
|
+
return t;
|
|
18
|
+
if (typeof t != "string")
|
|
19
|
+
throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
20
|
+
if (t === this.it)
|
|
21
|
+
return this._t;
|
|
22
|
+
this.it = t;
|
|
23
|
+
const r = [t];
|
|
24
|
+
return r.raw = r, this._t = { _$litType$: this.constructor.resultType, strings: r, values: [] };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
p.directiveName = "unsafeHTML", p.resultType = 1;
|
|
28
|
+
/**
|
|
29
|
+
* @license
|
|
30
|
+
* Copyright 2017 Google LLC
|
|
31
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
32
|
+
*/
|
|
33
|
+
class f extends p {
|
|
34
|
+
}
|
|
35
|
+
f.directiveName = "unsafeSVG", f.resultType = 2;
|
|
36
|
+
const h = _(f);
|
|
37
|
+
var T = Object.defineProperty, x = Object.getOwnPropertyDescriptor, c = (e, t, r, s) => {
|
|
38
|
+
for (var i = s > 1 ? void 0 : s ? x(t, r) : t, a = e.length - 1, l; a >= 0; a--)
|
|
39
|
+
(l = e[a]) && (i = (s ? l(t, r, i) : l(i)) || i);
|
|
40
|
+
return s && i && T(t, r, i), i;
|
|
41
|
+
};
|
|
42
|
+
const C = (e) => new Promise((t) => setTimeout(t, e)), o = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>', u = {}, d = async (e, t) => {
|
|
43
|
+
let r = 0;
|
|
44
|
+
for (; u[t + e + ".svg"] === "fetching" && (r++, !(r > 50)); )
|
|
45
|
+
await C(50);
|
|
46
|
+
return localStorage.getItem(t + e + ".svg") ? Promise.resolve(localStorage.getItem(t + e + ".svg")) : typeof window.fetch == "function" ? (u[t + e + ".svg"] = "fetching", Promise.resolve(
|
|
47
|
+
fetch(t + e + ".svg").then((s) => s.ok ? s.text() : (console.error("Missing icon: " + t + e + ".svg"), o)).then((s) => (s !== o && localStorage.setItem(t + e + ".svg", s), u[t + e + ".svg"] = "fetched", s))
|
|
48
|
+
)) : Promise.resolve(o);
|
|
49
|
+
};
|
|
50
|
+
let n = class extends S {
|
|
51
|
+
constructor() {
|
|
52
|
+
super(...arguments), this.name = "", this.path = "https://punkt-cdn.oslo.kommune.no/latest/icons/", this.icon = h(o);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Make sure the component renders in light DOM instead of shadow DOM
|
|
56
|
+
*/
|
|
57
|
+
createRenderRoot() {
|
|
58
|
+
return this;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Add support for Hot Module Reloading in dev mode
|
|
62
|
+
*/
|
|
63
|
+
hotReplacedCallback() {
|
|
64
|
+
this.requestUpdate();
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Runs on mount, used to set up various values and whatever you need to run
|
|
68
|
+
*/
|
|
69
|
+
async connectedCallback() {
|
|
70
|
+
this.name && this.path && (this.icon = h(
|
|
71
|
+
await d(this.name, this.path).then((e) => e)
|
|
72
|
+
)), super.connectedCallback();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Runs every time a property changes
|
|
76
|
+
*/
|
|
77
|
+
async update(e) {
|
|
78
|
+
e.has("name") && this.name && this.path && (this.icon = h(
|
|
79
|
+
await d(this.name, this.path).then((t) => t)
|
|
80
|
+
)), super.update(e);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Component functionality and render
|
|
84
|
+
*/
|
|
85
|
+
render() {
|
|
86
|
+
return b`${this.icon}`;
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
c([
|
|
90
|
+
v({ type: String, reflect: !0 })
|
|
91
|
+
], n.prototype, "name", 2);
|
|
92
|
+
c([
|
|
93
|
+
v({ type: String, reflect: !0 })
|
|
94
|
+
], n.prototype, "path", 2);
|
|
95
|
+
c([
|
|
96
|
+
v({ type: SVGElement })
|
|
97
|
+
], n.prototype, "icon", 2);
|
|
98
|
+
n = c([
|
|
99
|
+
P("pkt-el-icon")
|
|
100
|
+
], n);
|
|
101
|
+
export {
|
|
102
|
+
n as PktIcon
|
|
103
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./pkt-el-calendar.cjs"),r=require("./pkt-el-icon.cjs"),t=require("./pkt-el-component-template.cjs");require("./directive-6900e150.cjs");require("./property-e170cbca.cjs");require("./converters-01e4a1b1.cjs");require("./index-51027300.cjs");Object.defineProperty(exports,"PktCalendar",{enumerable:!0,get:()=>e.PktCalendar});Object.defineProperty(exports,"PktIcon",{enumerable:!0,get:()=>r.PktIcon});Object.defineProperty(exports,"PktComponent",{enumerable:!0,get:()=>t.PktComponent});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PktCalendar as i } from "./pkt-el-calendar.js";
|
|
2
|
+
import { PktIcon as f } from "./pkt-el-icon.js";
|
|
3
|
+
import { PktComponent as x } from "./pkt-el-component-template.js";
|
|
4
|
+
import "./directive-720b7cc8.js";
|
|
5
|
+
import "./property-0378afc0.js";
|
|
6
|
+
import "./converters-92631e0d.js";
|
|
7
|
+
import "./index-34184de4.js";
|
|
8
|
+
export {
|
|
9
|
+
i as PktCalendar,
|
|
10
|
+
x as PktComponent,
|
|
11
|
+
f as PktIcon
|
|
12
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { u as d, f as l } from "./directive-720b7cc8.js";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2017 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
const f = (e) => (r, t) => {
|
|
8
|
+
t !== void 0 ? t.addInitializer(() => {
|
|
9
|
+
customElements.define(e, r);
|
|
10
|
+
}) : customElements.define(e, r);
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* @license
|
|
14
|
+
* Copyright 2017 Google LLC
|
|
15
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
16
|
+
*/
|
|
17
|
+
const p = { attribute: !0, type: String, converter: d, reflect: !1, hasChanged: l }, u = (e = p, r, t) => {
|
|
18
|
+
const { kind: s, metadata: i } = t;
|
|
19
|
+
let o = globalThis.litPropertyMetadata.get(i);
|
|
20
|
+
if (o === void 0 && globalThis.litPropertyMetadata.set(i, o = /* @__PURE__ */ new Map()), o.set(t.name, e), s === "accessor") {
|
|
21
|
+
const { name: n } = t;
|
|
22
|
+
return { set(a) {
|
|
23
|
+
const c = r.get.call(this);
|
|
24
|
+
r.set.call(this, a), this.requestUpdate(n, c, e);
|
|
25
|
+
}, init(a) {
|
|
26
|
+
return a !== void 0 && this.P(n, void 0, e), a;
|
|
27
|
+
} };
|
|
28
|
+
}
|
|
29
|
+
if (s === "setter") {
|
|
30
|
+
const { name: n } = t;
|
|
31
|
+
return function(a) {
|
|
32
|
+
const c = this[n];
|
|
33
|
+
r.call(this, a), this.requestUpdate(n, c, e);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
throw Error("Unsupported decorator location: " + s);
|
|
37
|
+
};
|
|
38
|
+
function m(e) {
|
|
39
|
+
return (r, t) => typeof t == "object" ? u(e, r, t) : ((s, i, o) => {
|
|
40
|
+
const n = i.hasOwnProperty(o);
|
|
41
|
+
return i.constructor.createProperty(o, n ? { ...s, wrapped: !0 } : s), n ? Object.getOwnPropertyDescriptor(i, o) : void 0;
|
|
42
|
+
})(e, r, t);
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
m as n,
|
|
46
|
+
f as t
|
|
47
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";const d=require("./directive-6900e150.cjs");/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
+
*/const l=e=>(r,t)=>{t!==void 0?t.addInitializer(()=>{customElements.define(e,r)}):customElements.define(e,r)};/**
|
|
6
|
+
* @license
|
|
7
|
+
* Copyright 2017 Google LLC
|
|
8
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
+
*/const u={attribute:!0,type:String,converter:d.u,reflect:!1,hasChanged:d.f},p=(e=u,r,t)=>{const{kind:i,metadata:o}=t;let s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),s.set(t.name,e),i==="accessor"){const{name:n}=t;return{set(a){const c=r.get.call(this);r.set.call(this,a),this.requestUpdate(n,c,e)},init(a){return a!==void 0&&this.P(n,void 0,e),a}}}if(i==="setter"){const{name:n}=t;return function(a){const c=this[n];r.call(this,a),this.requestUpdate(n,c,e)}}throw Error("Unsupported decorator location: "+i)};function h(e){return(r,t)=>typeof t=="object"?p(e,r,t):((i,o,s)=>{const n=o.hasOwnProperty(s);return o.constructor.createProperty(s,n?{...i,wrapped:!0}:i),n?Object.getOwnPropertyDescriptor(o,s):void 0})(e,r,t)}exports.n=h;exports.t=l;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { PktElement } from '../element';
|
|
2
|
+
|
|
3
|
+
export declare class PktCalendar extends PktElement {
|
|
4
|
+
/**
|
|
5
|
+
* Element attributes
|
|
6
|
+
*/
|
|
7
|
+
date: Date;
|
|
8
|
+
selected: string[];
|
|
9
|
+
excludeweekdays: string[];
|
|
10
|
+
excludedates: Date[];
|
|
11
|
+
earliest: Date | null;
|
|
12
|
+
latest: Date | null;
|
|
13
|
+
weeknumbers: boolean;
|
|
14
|
+
withcontrols: boolean;
|
|
15
|
+
multiple: boolean;
|
|
16
|
+
range: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Strings
|
|
19
|
+
*/
|
|
20
|
+
dayStrings: string[];
|
|
21
|
+
monthStrings: string[];
|
|
22
|
+
weekString: string;
|
|
23
|
+
prevMonthString: string;
|
|
24
|
+
nextMonthString: string;
|
|
25
|
+
/**
|
|
26
|
+
* Private properties
|
|
27
|
+
*/
|
|
28
|
+
private _selected;
|
|
29
|
+
private year;
|
|
30
|
+
private month;
|
|
31
|
+
private week;
|
|
32
|
+
private rangeHovered;
|
|
33
|
+
/**
|
|
34
|
+
* Runs on mount, used to set up various values and whatever you need to run
|
|
35
|
+
*/
|
|
36
|
+
connectedCallback(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Component functionality and render
|
|
39
|
+
*/
|
|
40
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
41
|
+
private renderDayNames;
|
|
42
|
+
private renderMonthNav;
|
|
43
|
+
private renderCalendarBody;
|
|
44
|
+
private isExcluded;
|
|
45
|
+
private formatISODate;
|
|
46
|
+
isPrevMonthAllowed(): boolean;
|
|
47
|
+
private prevMonth;
|
|
48
|
+
isNextMonthAllowed(): boolean;
|
|
49
|
+
private nextMonth;
|
|
50
|
+
private changeMonth;
|
|
51
|
+
private isInRange;
|
|
52
|
+
private isRangeAllowed;
|
|
53
|
+
private emptySelected;
|
|
54
|
+
private addToSelected;
|
|
55
|
+
private removeFromSelected;
|
|
56
|
+
private toggleSelected;
|
|
57
|
+
private handleRangeSelect;
|
|
58
|
+
private handleRangeHover;
|
|
59
|
+
private handleDateSelect;
|
|
60
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { PktElement } from '../element';
|
|
2
|
+
|
|
3
|
+
export declare class PktComponent extends PktElement {
|
|
4
|
+
/**
|
|
5
|
+
* Element attributes => props
|
|
6
|
+
* Example:
|
|
7
|
+
* <pkt-el-component string="hei" strings="hei,og,hallo" darkmode>
|
|
8
|
+
* Hei!
|
|
9
|
+
* </pkt-el-component>
|
|
10
|
+
*/
|
|
11
|
+
string: string;
|
|
12
|
+
strings: string[];
|
|
13
|
+
darkmode: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Private properties, for internal use only
|
|
16
|
+
*/
|
|
17
|
+
private _list;
|
|
18
|
+
/**
|
|
19
|
+
* Runs on mount, used to set up various values and whatever you need to run
|
|
20
|
+
*/
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
/**
|
|
23
|
+
* Render functions
|
|
24
|
+
*/
|
|
25
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
26
|
+
private renderList;
|
|
27
|
+
/**
|
|
28
|
+
* Add other functionality under here
|
|
29
|
+
*/
|
|
30
|
+
private doStuff;
|
|
31
|
+
/**
|
|
32
|
+
* Handlers for returning data from the component
|
|
33
|
+
*/
|
|
34
|
+
private handleGreeting;
|
|
35
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PktSlotController } from '../../controllers/pkt-slot-controller';
|
|
2
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
3
|
+
import { LitElement } from 'lit';
|
|
4
|
+
|
|
5
|
+
export declare class PktElement extends LitElement {
|
|
6
|
+
/**
|
|
7
|
+
* Runs on mount, used to set up various values and whatever you need to run
|
|
8
|
+
*/
|
|
9
|
+
connectedCallback(): void;
|
|
10
|
+
/**
|
|
11
|
+
* Make sure the component renders in light DOM instead of shadow DOM
|
|
12
|
+
*/
|
|
13
|
+
createRenderRoot(): this;
|
|
14
|
+
/**
|
|
15
|
+
* Add support for Hot Module Reloading in dev mode
|
|
16
|
+
*/
|
|
17
|
+
hotReplacedCallback(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Set up slot support for Light DOM
|
|
20
|
+
*/
|
|
21
|
+
slotController: PktSlotController;
|
|
22
|
+
defaultSlot: Ref<HTMLElement>;
|
|
23
|
+
namedSlot: Ref<HTMLElement>;
|
|
24
|
+
constructor();
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
|
|
3
|
+
export declare class PktIcon extends LitElement {
|
|
4
|
+
/**
|
|
5
|
+
* Element attributes
|
|
6
|
+
*/
|
|
7
|
+
name: string;
|
|
8
|
+
path: string;
|
|
9
|
+
private icon;
|
|
10
|
+
/**
|
|
11
|
+
* Make sure the component renders in light DOM instead of shadow DOM
|
|
12
|
+
*/
|
|
13
|
+
createRenderRoot(): this;
|
|
14
|
+
/**
|
|
15
|
+
* Add support for Hot Module Reloading in dev mode
|
|
16
|
+
*/
|
|
17
|
+
hotReplacedCallback(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Runs on mount, used to set up various values and whatever you need to run
|
|
20
|
+
*/
|
|
21
|
+
connectedCallback(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Runs every time a property changes
|
|
24
|
+
*/
|
|
25
|
+
update(changedProperties: Map<string, unknown>): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Component functionality and render
|
|
28
|
+
*/
|
|
29
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
30
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Ref } from 'lit/directives/ref.js';
|
|
2
|
+
import { LitElement, ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
+
|
|
4
|
+
export declare class PktSlotController implements ReactiveController {
|
|
5
|
+
host: LitElement & ReactiveControllerHost;
|
|
6
|
+
nodes: Element[];
|
|
7
|
+
slots: Ref<HTMLElement>[];
|
|
8
|
+
constructor(host: LitElement & ReactiveControllerHost, ...slots: Ref<HTMLElement>[]);
|
|
9
|
+
hostUpdate(): void;
|
|
10
|
+
hostUpdated(): void;
|
|
11
|
+
private nodeFromElement;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PktCalendar } from './components';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"example": {
|
|
3
|
+
"hi": "Hei!"
|
|
4
|
+
},
|
|
5
|
+
"dates": {
|
|
6
|
+
"days": ["Mandag", "Tirsdag", "Onsdag", "Torsdag", "Fredag", "Lørdag", "Søndag"],
|
|
7
|
+
"daysShort": ["Man", "Tir", "Ons", "Tor", "Fre", "Lør", "Søn"],
|
|
8
|
+
"months": [
|
|
9
|
+
"Januar",
|
|
10
|
+
"Februar",
|
|
11
|
+
"Mars",
|
|
12
|
+
"April",
|
|
13
|
+
"Mai",
|
|
14
|
+
"Juni",
|
|
15
|
+
"Juli",
|
|
16
|
+
"August",
|
|
17
|
+
"September",
|
|
18
|
+
"Oktober",
|
|
19
|
+
"November",
|
|
20
|
+
"Desember"
|
|
21
|
+
],
|
|
22
|
+
"monthsShort": [
|
|
23
|
+
"Jan",
|
|
24
|
+
"Feb",
|
|
25
|
+
"Mar",
|
|
26
|
+
"Apr",
|
|
27
|
+
"Mai",
|
|
28
|
+
"Jun",
|
|
29
|
+
"Jul",
|
|
30
|
+
"Aug",
|
|
31
|
+
"Sep",
|
|
32
|
+
"Okt",
|
|
33
|
+
"Nov",
|
|
34
|
+
"Des"
|
|
35
|
+
],
|
|
36
|
+
"week": "Uke",
|
|
37
|
+
"prevMonth": "Forrige måned",
|
|
38
|
+
"nextMonth": "Neste måned"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
;
|
|
42
|
+
|
|
43
|
+
export default _default;
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oslokommune/punkt-elements",
|
|
3
|
+
"version": "11.12.3",
|
|
4
|
+
"description": "Komponentbiblioteket til Punkt, et designsystem laget av Oslo Origo",
|
|
5
|
+
"homepage": "https://punkt.oslo.kommune.no",
|
|
6
|
+
"author": "Team Designsystem, Oslo Origo",
|
|
7
|
+
"main": "dist/pkt-el-index.js",
|
|
8
|
+
"module": "dist/pkt-el-index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"/dist",
|
|
11
|
+
"src/components/**/*",
|
|
12
|
+
"CHANGELOG.md",
|
|
13
|
+
"CONTRIBUTING.md"
|
|
14
|
+
],
|
|
15
|
+
"type": "module",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"dev": "vite",
|
|
24
|
+
"build": "tsc && vite build",
|
|
25
|
+
"preview": "vite preview --outDir dist-app"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"date-fns": "^3.6.0",
|
|
29
|
+
"lit": "^3.1.2"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@oslokommune/punkt-assets": "*",
|
|
33
|
+
"@oslokommune/punkt-css": "^11.12.3",
|
|
34
|
+
"sass": "^1.63.6",
|
|
35
|
+
"typescript": "^4.9.3",
|
|
36
|
+
"vite": "^4.5.3",
|
|
37
|
+
"vite-plugin-dts": "^3.8.1",
|
|
38
|
+
"vite-plugin-web-components-hmr": "^0.1.3"
|
|
39
|
+
},
|
|
40
|
+
"private": false,
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"registry": "https://registry.npmjs.org"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"punkt",
|
|
47
|
+
"designsystem",
|
|
48
|
+
"webcomponents",
|
|
49
|
+
"customelements",
|
|
50
|
+
"lit"
|
|
51
|
+
],
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "git+https://github.com/oslokommune/punkt.git"
|
|
55
|
+
},
|
|
56
|
+
"bugs": {
|
|
57
|
+
"url": "https://github.com/oslokommune/punkt/issues"
|
|
58
|
+
},
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"gitHead": "3d1c0ec4fee5ae98b0e26d1068b76faec73406b0"
|
|
61
|
+
}
|