@oslokommune/punkt-elements 12.4.0 → 12.5.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/dist/class-map-Ch54kkX5.cjs +5 -0
- package/dist/{class-map-CL_lSLwn.js → class-map-DunDFQn7.js} +8 -8
- package/dist/{directive-DA0-wdk7.js → directive-Cxhakbpr.js} +3 -3
- package/dist/{directive-19_ixLKS.cjs → directive-DtixNHDT.cjs} +1 -1
- package/dist/{index-Bc9mksHI.cjs → index-BR7VtlYg.cjs} +14 -14
- package/dist/index-Bpc07w_P.cjs +9 -0
- package/dist/{index-m5WP1NKD.js → index-CsTujnXs.js} +93 -93
- package/dist/index-CyqOyy_9.js +88 -0
- package/dist/{index-BUZITHLd.cjs → index-DSyh6tUw.cjs} +8 -8
- package/dist/{index-DQ5xnGw6.js → index-dgAzBeRk.js} +10 -13
- package/dist/index.d.ts +5 -8
- package/dist/pkt-alert.cjs +8 -8
- package/dist/pkt-alert.js +20 -20
- package/dist/pkt-calendar.cjs +1 -1
- package/dist/pkt-calendar.js +5 -5
- package/dist/pkt-card.cjs +10 -10
- package/dist/pkt-card.js +7 -7
- package/dist/pkt-component-template.cjs +6 -6
- package/dist/pkt-component-template.js +14 -14
- package/dist/pkt-datepicker.cjs +48 -48
- package/dist/pkt-datepicker.js +32 -32
- package/dist/pkt-element.cjs +1 -1
- package/dist/pkt-element.js +1 -1
- package/dist/pkt-icon.cjs +1 -1
- package/dist/pkt-icon.js +3 -3
- package/dist/pkt-index.cjs +1 -1
- package/dist/pkt-index.js +2 -2
- package/dist/pkt-input-wrapper.cjs +28 -28
- package/dist/pkt-input-wrapper.js +8 -8
- package/dist/pkt-link.cjs +4 -4
- package/dist/pkt-link.js +9 -9
- package/dist/pkt-messagebox.cjs +6 -6
- package/dist/pkt-messagebox.js +7 -7
- package/dist/pkt-tag.cjs +8 -8
- package/dist/pkt-tag.js +11 -11
- package/dist/{ref-bNNrgsqL.js → ref-By_W8A-f.js} +41 -41
- package/dist/ref-C3InMDfU.cjs +13 -0
- package/package.json +3 -3
- package/src/components/calendar/index.ts +0 -7
- package/src/components/icon/index.ts +16 -12
- package/dist/class-map-BQ5k1q3A.cjs +0 -5
- package/dist/index-BFqUD8HI.cjs +0 -9
- package/dist/index-exzYRW0z.js +0 -82
- package/dist/ref-BdbjJbqo.cjs +0 -13
|
@@ -51,18 +51,6 @@ const downloadIconOrGetFromCache = async (
|
|
|
51
51
|
|
|
52
52
|
@customElement('pkt-icon')
|
|
53
53
|
export class PktIcon extends PktElement {
|
|
54
|
-
constructor() {
|
|
55
|
-
super()
|
|
56
|
-
this.classList.add('pkt-icon')
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
protected willUpdate(_changedProperties: PropertyValues): void {
|
|
60
|
-
super.willUpdate(_changedProperties)
|
|
61
|
-
if (_changedProperties.has('class')) {
|
|
62
|
-
this.classList.add('my-element')
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
54
|
@property({ type: String, reflect: false })
|
|
67
55
|
path: string | undefined = window.pktIconPath
|
|
68
56
|
|
|
@@ -75,9 +63,25 @@ export class PktIcon extends PktElement {
|
|
|
75
63
|
@property({ type: Array, noAccessor: true })
|
|
76
64
|
private _updatedProps: string[] = []
|
|
77
65
|
|
|
66
|
+
connectedCallback(): void {
|
|
67
|
+
super.connectedCallback()
|
|
68
|
+
this.classList.add('pkt-icon')
|
|
69
|
+
}
|
|
78
70
|
async attributeChangedCallback(name: string, _old: string | null, value: string | null) {
|
|
79
71
|
super.attributeChangedCallback(name, _old, value)
|
|
72
|
+
if (name === 'name' || name === 'path') this.getIcon(this.name)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
protected async updated(_changedProperties: PropertyValues) {
|
|
76
|
+
super.updated(_changedProperties)
|
|
77
|
+
if (_changedProperties.has('name') || _changedProperties.has('path')) {
|
|
78
|
+
this.getIcon(this.name)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
protected async getIcon(name = '') {
|
|
80
83
|
if (this._updatedProps.length > 0) {
|
|
84
|
+
if (!this.path) this.path === window.pktIconPath
|
|
81
85
|
this.icon = unsafeSVG(
|
|
82
86
|
await downloadIconOrGetFromCache(this.name || '', this.path).then((res) => res),
|
|
83
87
|
) as SVGElement
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";const a=require("./index-BUZITHLd.cjs"),n=require("./directive-19_ixLKS.cjs");/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2018 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const c=n.e(class extends n.i{constructor(e){var s;if(super(e),e.type!==n.t$1.ATTRIBUTE||e.name!=="class"||((s=e.strings)==null?void 0:s.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(s=>e[s]).join(" ")+" "}update(e,[s]){var r,o;if(this.st===void 0){this.st=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(t=>t!=="")));for(const t in s)s[t]&&!((r=this.nt)!=null&&r.has(t))&&this.st.add(t);return this.render(s)}const i=e.element.classList;for(const t of this.st)t in s||(i.remove(t),this.st.delete(t));for(const t in s){const h=!!s[t];h===this.st.has(t)||(o=this.nt)!=null&&o.has(t)||(h?(i.add(t),this.st.add(t)):(i.remove(t),this.st.delete(t)))}return a.R}});exports.Rt=c;
|
package/dist/index-BFqUD8HI.cjs
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";const o=require("./index-BUZITHLd.cjs"),n=require("./directive-19_ixLKS.cjs");/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/class a extends n.i{constructor(t){if(super(t),this.it=o.D,t.type!==n.t$1.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===o.D||t==null)return this._t=void 0,this.it=t;if(t===o.R)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 r=[t];return r.raw=r,this._t={_$litType$:this.constructor.resultType,strings:r,values:[]}}}a.directiveName="unsafeHTML",a.resultType=1;const f=n.e(a);/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2017 Google LLC
|
|
8
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/class d extends a{}d.directiveName="unsafeSVG",d.resultType=2;const w=n.e(d);var v=Object.defineProperty,g=Object.getOwnPropertyDescriptor,c=(e,t,r,s)=>{for(var i=s>1?void 0:s?g(t,r):t,p=e.length-1,u;p>=0;p--)(u=e[p])&&(i=(s?u(t,r,i):u(i))||i);return s&&i&&v(t,r,i),i};window.pktFetch=window.pktFetch===void 0?fetch:window.pktFetch;window.pktIconPath=window.pktIconPath||"https://punkt-cdn.oslo.kommune.no/latest/icons/";const P=e=>new Promise(t=>setTimeout(t,e)),l='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>',h={},k=async(e,t)=>{let r=0;for(;h[t+e+".svg"]==="fetching"&&(r++,!(r>50));)await P(50);return localStorage.getItem(t+e+".svg")?Promise.resolve(localStorage.getItem(t+e+".svg")):typeof window.pktFetch=="function"?(h[t+e+".svg"]="fetching",Promise.resolve(window.pktFetch(t+e+".svg").then(s=>s.ok?s.text():(console.error("Missing icon: "+t+e+".svg"),l)).then(s=>(s!==l&&localStorage.setItem(t+e+".svg",s),h[t+e+".svg"]="fetched",s)))):Promise.resolve(l)};exports.PktIcon=class extends o.PktElement{constructor(){super(),this.path=window.pktIconPath,this.name="",this.icon=w(l),this._updatedProps=[],this.classList.add("pkt-icon")}willUpdate(t){super.willUpdate(t),t.has("class")&&this.classList.add("my-element")}async attributeChangedCallback(t,r,s){super.attributeChangedCallback(t,r,s),this._updatedProps.length>0?(this.icon=w(await k(this.name||"",this.path).then(i=>i)),this._updatedProps=[]):this._updatedProps.includes(t)||this._updatedProps.push(t)}render(){return o.ke`${this.name&&this.icon}`}};c([o.n({type:String,reflect:!1})],exports.PktIcon.prototype,"path",2);c([o.n({type:String,reflect:!0})],exports.PktIcon.prototype,"name",2);c([o.n({type:SVGElement})],exports.PktIcon.prototype,"icon",2);c([o.n({type:Array,noAccessor:!0})],exports.PktIcon.prototype,"_updatedProps",2);exports.PktIcon=c([n.t("pkt-icon")],exports.PktIcon);exports.ae=f;
|
package/dist/index-exzYRW0z.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { D as w, R as g, P as y, k as P, n as a } from "./index-m5WP1NKD.js";
|
|
2
|
-
import { i as m, a as k, e as v, t as _ } from "./directive-DA0-wdk7.js";
|
|
3
|
-
/**
|
|
4
|
-
* @license
|
|
5
|
-
* Copyright 2017 Google LLC
|
|
6
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
7
|
-
*/
|
|
8
|
-
class l extends m {
|
|
9
|
-
constructor(t) {
|
|
10
|
-
if (super(t), this.it = w, t.type !== k.CHILD) throw Error(this.constructor.directiveName + "() can only be used in child bindings");
|
|
11
|
-
}
|
|
12
|
-
render(t) {
|
|
13
|
-
if (t === w || t == null) return this._t = void 0, this.it = t;
|
|
14
|
-
if (t === g) return t;
|
|
15
|
-
if (typeof t != "string") throw Error(this.constructor.directiveName + "() called with a non-string value");
|
|
16
|
-
if (t === this.it) return this._t;
|
|
17
|
-
this.it = t;
|
|
18
|
-
const r = [t];
|
|
19
|
-
return r.raw = r, this._t = { _$litType$: this.constructor.resultType, strings: r, values: [] };
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
l.directiveName = "unsafeHTML", l.resultType = 1;
|
|
23
|
-
const x = v(l);
|
|
24
|
-
/**
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright 2017 Google LLC
|
|
27
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
-
*/
|
|
29
|
-
class d extends l {
|
|
30
|
-
}
|
|
31
|
-
d.directiveName = "unsafeSVG", d.resultType = 2;
|
|
32
|
-
const f = v(d);
|
|
33
|
-
var b = Object.defineProperty, I = Object.getOwnPropertyDescriptor, n = (e, t, r, s) => {
|
|
34
|
-
for (var i = s > 1 ? void 0 : s ? I(t, r) : t, p = e.length - 1, h; p >= 0; p--)
|
|
35
|
-
(h = e[p]) && (i = (s ? h(t, r, i) : h(i)) || i);
|
|
36
|
-
return s && i && b(t, r, i), i;
|
|
37
|
-
};
|
|
38
|
-
window.pktFetch = window.pktFetch === void 0 ? fetch : window.pktFetch;
|
|
39
|
-
window.pktIconPath = window.pktIconPath || "https://punkt-cdn.oslo.kommune.no/latest/icons/";
|
|
40
|
-
const S = (e) => new Promise((t) => setTimeout(t, e)), c = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>', u = {}, C = async (e, t) => {
|
|
41
|
-
let r = 0;
|
|
42
|
-
for (; u[t + e + ".svg"] === "fetching" && (r++, !(r > 50)); )
|
|
43
|
-
await S(50);
|
|
44
|
-
return localStorage.getItem(t + e + ".svg") ? Promise.resolve(localStorage.getItem(t + e + ".svg")) : typeof window.pktFetch == "function" ? (u[t + e + ".svg"] = "fetching", Promise.resolve(
|
|
45
|
-
window.pktFetch(t + e + ".svg").then((s) => s.ok ? s.text() : (console.error("Missing icon: " + t + e + ".svg"), c)).then((s) => (s !== c && localStorage.setItem(t + e + ".svg", s), u[t + e + ".svg"] = "fetched", s))
|
|
46
|
-
)) : Promise.resolve(c);
|
|
47
|
-
};
|
|
48
|
-
let o = class extends y {
|
|
49
|
-
constructor() {
|
|
50
|
-
super(), this.path = window.pktIconPath, this.name = "", this.icon = f(c), this._updatedProps = [], this.classList.add("pkt-icon");
|
|
51
|
-
}
|
|
52
|
-
willUpdate(e) {
|
|
53
|
-
super.willUpdate(e), e.has("class") && this.classList.add("my-element");
|
|
54
|
-
}
|
|
55
|
-
async attributeChangedCallback(e, t, r) {
|
|
56
|
-
super.attributeChangedCallback(e, t, r), this._updatedProps.length > 0 ? (this.icon = f(
|
|
57
|
-
await C(this.name || "", this.path).then((s) => s)
|
|
58
|
-
), this._updatedProps = []) : this._updatedProps.includes(e) || this._updatedProps.push(e);
|
|
59
|
-
}
|
|
60
|
-
render() {
|
|
61
|
-
return P`${this.name && this.icon}`;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
n([
|
|
65
|
-
a({ type: String, reflect: !1 })
|
|
66
|
-
], o.prototype, "path", 2);
|
|
67
|
-
n([
|
|
68
|
-
a({ type: String, reflect: !0 })
|
|
69
|
-
], o.prototype, "name", 2);
|
|
70
|
-
n([
|
|
71
|
-
a({ type: SVGElement })
|
|
72
|
-
], o.prototype, "icon", 2);
|
|
73
|
-
n([
|
|
74
|
-
a({ type: Array, noAccessor: !0 })
|
|
75
|
-
], o.prototype, "_updatedProps", 2);
|
|
76
|
-
o = n([
|
|
77
|
-
_("pkt-icon")
|
|
78
|
-
], o);
|
|
79
|
-
export {
|
|
80
|
-
o as P,
|
|
81
|
-
x as a
|
|
82
|
-
};
|
package/dist/ref-BdbjJbqo.cjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";const a=require("./index-BUZITHLd.cjs"),$=require("./directive-19_ixLKS.cjs");class p{constructor(e,...s){this.nodes=[],this.host=e,this.host.addController(this),this.slots=s,this.nodes=[]}hostConnected(){Array.from(this.host.childNodes).forEach(e=>{var s;if(e.nodeName==="#text"){if((s=e.nodeValue)!=null&&s.trim()){const i=document==null?void 0:document.createElement("template");i.content.appendChild(e),this.nodes.push(i)}}else this.nodes.push(e)})}hostUpdated(){this.slots.forEach(e=>{if(!e.value)return;const s=e.value.getAttribute("name"),i=this.nodes.flatMap(n=>n.getAttribute&&n.getAttribute("slot")==s?this.nodeFromElement(n,e):[]);i.length&&e.value.replaceChildren(...i)})}nodeFromElement(e,s){var i;return e===((i=s.value)==null?void 0:i.parentNode)?[]:e instanceof HTMLTemplateElement?Array.from(e.content.childNodes):e}}/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
5
|
-
*/const{I:g}=a.si,m=t=>t.strings===void 0,_=()=>document.createComment(""),N=(t,e,s)=>{var o;const i=t._$AA.parentNode,n=e===void 0?t._$AB:e._$AA;if(s===void 0){const c=i.insertBefore(_(),n),l=i.insertBefore(_(),n);s=new g(c,l,t,t.options)}else{const c=s._$AB.nextSibling,l=s._$AM,u=l!==t;if(u){let h;(o=s._$AQ)==null||o.call(s,t),s._$AM=t,s._$AP!==void 0&&(h=t._$AU)!==l._$AU&&s._$AP(h)}if(c!==n||u){let h=s._$AA;for(;h!==c;){const v=h.nextSibling;i.insertBefore(h,n),h=v}}}return s},b=(t,e,s=t)=>(t._$AI(e,s),t),C={},Y=(t,e=C)=>t._$AH=e,M=t=>t._$AH,y=t=>{var i;(i=t._$AP)==null||i.call(t,!1,!0);let e=t._$AA;const s=t._$AB.nextSibling;for(;e!==s;){const n=e.nextSibling;e.remove(),e=n}};/**
|
|
6
|
-
* @license
|
|
7
|
-
* Copyright 2017 Google LLC
|
|
8
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
9
|
-
*/const r=(t,e)=>{var i;const s=t._$AN;if(s===void 0)return!1;for(const n of s)(i=n._$AO)==null||i.call(n,e,!1),r(n,e);return!0},d=t=>{let e,s;do{if((e=t._$AM)===void 0)break;s=e._$AN,s.delete(t),t=e}while((s==null?void 0:s.size)===0)},f=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(s===void 0)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),S(e)}};function w(t){this._$AN!==void 0?(d(this),this._$AM=t,f(this)):this._$AM=t}function x(t,e=!1,s=0){const i=this._$AH,n=this._$AN;if(n!==void 0&&n.size!==0)if(e)if(Array.isArray(i))for(let o=s;o<i.length;o++)r(i[o],!1),d(i[o]);else i!=null&&(r(i,!1),d(i));else r(this,t)}const S=t=>{t.type==$.t$1.CHILD&&(t._$AP??(t._$AP=x),t._$AQ??(t._$AQ=w))};class k extends $.i{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,s,i){super._$AT(e,s,i),f(this),this.isConnected=e._$AU}_$AO(e,s=!0){var i,n;e!==this.isConnected&&(this.isConnected=e,e?(i=this.reconnected)==null||i.call(this):(n=this.disconnected)==null||n.call(this)),s&&(r(this,e),d(this))}setValue(e){if(m(this.t))this.t._$AI(e,this);else{const s=[...this.t._$AH];s[this.i]=e,this.t._$AI(s,this,0)}}disconnected(){}reconnected(){}}/**
|
|
10
|
-
* @license
|
|
11
|
-
* Copyright 2020 Google LLC
|
|
12
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
13
|
-
*/const B=()=>new E;class E{}const A=new WeakMap,H=$.e(class extends k{render(t){return a.D}update(t,[e]){var i;const s=e!==this.Y;return s&&this.Y!==void 0&&this.rt(void 0),(s||this.lt!==this.ct)&&(this.Y=e,this.ht=(i=t.options)==null?void 0:i.host,this.rt(this.ct=t.element)),a.D}rt(t){if(this.isConnected||(t=void 0),typeof this.Y=="function"){const e=this.ht??globalThis;let s=A.get(e);s===void 0&&(s=new WeakMap,A.set(e,s)),s.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),s.set(this.Y,t),t!==void 0&&this.Y.call(this.ht,t)}else this.Y.value=t}get lt(){var t,e;return typeof this.Y=="function"?(t=A.get(this.ht??globalThis))==null?void 0:t.get(this.Y):(e=this.Y)==null?void 0:e.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});exports.Kt=H;exports.PktSlotController=p;exports.at=N;exports.ct=b;exports.dt=Y;exports.ii=B;exports.pt=y;exports.ut=M;
|