@supersoniks/concorde 2.0.0 → 2.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.
@@ -618,7 +618,7 @@ const{D:Ee}=Tt,je=()=>document.createComment(""),Me=(t,e,s)=>{var i;const r=t._$
618
618
  * Copyright 2017 Google LLC
619
619
  * SPDX-License-Identifier: BSD-3-Clause
620
620
  */
621
- let ls=class extends Gt{constructor(t){if(super(t),this.et=kt,t.type!==Yt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===kt||null==t)return this.vt=void 0,this.et=t;if(t===_t)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;const e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ls.directiveName="unsafeHTML",ls.resultType=1;const cs=Qt(ls),hs=new Map,ds={heroicons:{url:"https://cdn.jsdelivr.net/npm/heroicons@2.0.4/24/$prefix/$name.svg",defaultPrefix:"outline"},iconoir:{url:"https://cdnjs.cloudflare.com/ajax/libs/iconoir/5.1.4/icons/$name.svg"},feathers:{url:"https://cdn.jsdelivr.net/npm/feather-icons@4.29.0/dist/icons/$name.svg"},lucide:{url:"https://cdn.jsdelivr.net/npm/lucide-static@0.16.29/icons/$name.svg"},material:{url:"https://cdn.jsdelivr.net/npm/@material-icons/svg@1.0.5/svg/$name/$prefix.svg",defaultPrefix:"regular"},fontAwesome:{url:"https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.1/svgs/$prefix/$name.svg",defaultPrefix:"regular"},custom:{url:"",defaultPrefix:""}};let ps=!1;const us=sessionStorage.getItem("sonicIconsCache"),gs=us?JSON.parse(us):{icons:{},names:[]},bs=class{static registerIcons(t){const e=as;for(const s in t){const i=t[s],r=e[s]||{};for(const t in i)r[t]=i[t];e[s]=r}}};bs.fontAwesomeNext={get:async t=>{const e=t.library,s=t.name||"",i=as;var r,o;if("custom"==e&&(ps||(ps=!0,ds.custom.url=(null==(r=document.querySelector("[customIconLibraryPath]"))?void 0:r.getAttribute("customIconLibraryPath"))||"",ds.custom.defaultPrefix=(null==(o=document.querySelector("[customIconDefaultPrefix]"))?void 0:o.getAttribute("customIconDefaultPrefix"))||"")),e&&ds[e]){const r=ds[e],o=t.prefix||r.defaultPrefix||"",n=i[e]||{};i[e]=n;const a=o+"-"+s;if(n[a])return cs(n[a]);const l=r.url.replace("$prefix",o).replace("$name",s);if(gs.icons[l])return n[a]=gs.icons[l],cs(gs.icons[l]);if(!hs.has(l)){const t=new Promise((async t=>{const e=await fetch(l);if(e.ok)try{t(await e.text())}catch(s){t(null)}else t(`<b title="Erreur ${e.status}">😶</b>`)}));hs.set(l,t)}const c=await hs.get(l);if(hs.delete(l),n[a]=c||"",gs.icons[l]=c||"",gs.names.length>100){const t=gs.names.shift();delete gs.icons[t]}return sessionStorage.setItem("sonicIconsCache",JSON.stringify(gs)),cs(c)}return cs(i.core[t.name]||"")}},bs.default=bs.fontAwesomeNext;let ms=bs;var fs=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,ys=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?vs(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&fs(e,s,o),o};let ws=class extends Rt{constructor(){super(...arguments),this.iconText="",this.name="",this.prefix="",this.library=""}async updateIcon(){this.iconText=await ms.default.get({name:this.name,prefix:this.prefix,library:this.library})}willUpdate(t){(t.has("name")||t.has("prefix")||t.has("library"))&&this.updateIcon(),super.willUpdate(t)}render(){return this.iconText?this.iconText:kt}};ws.styles=_`
621
+ let ls=class extends Gt{constructor(t){if(super(t),this.et=kt,t.type!==Yt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===kt||null==t)return this.vt=void 0,this.et=t;if(t===_t)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.et)return this.vt;this.et=t;const e=[t];return e.raw=e,this.vt={_$litType$:this.constructor.resultType,strings:e,values:[]}}};ls.directiveName="unsafeHTML",ls.resultType=1;const cs=Qt(ls),hs=new Map,ds={heroicons:{url:"https://cdn.jsdelivr.net/npm/heroicons@2.0.4/24/$prefix/$name.svg",defaultPrefix:"outline"},iconoir:{url:"https://cdnjs.cloudflare.com/ajax/libs/iconoir/5.1.4/icons/$name.svg"},feathers:{url:"https://cdn.jsdelivr.net/npm/feather-icons@4.29.0/dist/icons/$name.svg"},lucide:{url:"https://cdn.jsdelivr.net/npm/lucide-static@0.16.29/icons/$name.svg"},material:{url:"https://cdn.jsdelivr.net/npm/@material-icons/svg@1.0.5/svg/$name/$prefix.svg",defaultPrefix:"regular"},fontAwesome:{url:"https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.15.1/svgs/$prefix/$name.svg",defaultPrefix:"regular"},custom:{url:"",defaultPrefix:""}};let ps=!1;const us=sessionStorage.getItem("sonicIconsCache"),gs=us?JSON.parse(us):{icons:{},names:[]},bs=class{static registerIcons(t){const e=as;for(const s in t){const i=t[s],r=e[s]||{};for(const t in i)r[t]=i[t];e[s]=r}}};bs.fontAwesomeNext={get:async t=>{const e=t.library,s=t.name||"";if(!s)return"";const i=as;var r,o;if("custom"==e&&(ps||(ps=!0,ds.custom.url=(null==(r=document.querySelector("[customIconLibraryPath]"))?void 0:r.getAttribute("customIconLibraryPath"))||"",ds.custom.defaultPrefix=(null==(o=document.querySelector("[customIconDefaultPrefix]"))?void 0:o.getAttribute("customIconDefaultPrefix"))||"")),e&&ds[e]){const r=ds[e],o=t.prefix||r.defaultPrefix||"",n=i[e]||{};i[e]=n;const a=o+"-"+s;if(n[a])return cs(n[a]);const l=r.url.replace("$prefix",o).replace("$name",s);if(gs.icons[l])return n[a]=gs.icons[l],cs(gs.icons[l]);if(!hs.has(l)){const t=new Promise((async t=>{const e=await fetch(l);if(e.ok)try{t(await e.text())}catch(s){t(null)}else t(`<b title="Erreur ${e.status}">😶</b>`)}));hs.set(l,t)}const c=await hs.get(l);if(hs.delete(l),n[a]=c||"",gs.icons[l]=c||"",gs.names.length>100){const t=gs.names.shift();delete gs.icons[t]}return sessionStorage.setItem("sonicIconsCache",JSON.stringify(gs)),cs(c)}return cs(i.core[t.name]||"")}},bs.default=bs.fontAwesomeNext;let ms=bs;var fs=Object.defineProperty,vs=Object.getOwnPropertyDescriptor,ys=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?vs(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&fs(e,s,o),o};let ws=class extends Rt{constructor(){super(...arguments),this.iconText="",this.name="",this.prefix="",this.library=""}async updateIcon(){this.iconText=await ms.default.get({name:this.name,prefix:this.prefix,library:this.library})}willUpdate(t){(t.has("name")||t.has("prefix")||t.has("library"))&&this.updateIcon(),super.willUpdate(t)}render(){return this.iconText?this.iconText:kt}};ws.styles=_`
622
622
  :host {
623
623
  line-height: 0.1em;
624
624
  width: fit-content;
@@ -940,7 +940,7 @@ const Vs=Qt(class extends Gt{constructor(t){if(super(t),t.type!==Yt)throw Error(
940
940
  </sonic-subscriber>
941
941
  ${o&&!c?Vs(o):kt}
942
942
  `}))}
943
- `}};Zs([U({type:Object})],Ys.prototype,"itemPropertyMap",2),Zs([U({type:String})],Ys.prototype,"templateKey",2),Zs([U({type:String})],Ys.prototype,"idKey",2),Zs([U()],Ys.prototype,"limit",2),Zs([U()],Ys.prototype,"offset",2),Ys=Zs([m("sonic-list")],Ys);var Qs=Object.defineProperty,Gs=Object.getOwnPropertyDescriptor,Js=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?Gs(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Qs(e,s,o),o};let Xs=class extends(G(Rt)){constructor(){super(...arguments),this.templates=null,this.lastRequestTime=0,this.key="",this.itemPropertyMap=null,this.cache="default",this.targetRequestDuration=500,this.limit=5,this.lazyBoundsRatio=1,this.offset=0,this.resultCount=0,this.noLazyload=!1,this.filteredFields="",this.instanceId=0,this.localStorage="disabled",this.filterPublisher=null,this.searchHash="",this.requestId=0,this.isFirstRequest=!0,this.dataProviderExpression="",this.idKey="id",this.currentScrollPosition=void 0,this.listDataProviders=[],this.nextHadEvent=!1}disconnectedCallback(){for(const t of this.listDataProviders)d.delete(t);super.disconnectedCallback()}async connectedCallback(){this.instanceId=Xs.instanceCounter++,this.localStorage=this.getAttribute("localStorage")||this.localStorage,this.removeAttribute("localStorage"),this.noShadowDom="",this.defferedDebug=this.hasAttribute("debug")||null,this.dataProvider||(this.dataProvider=this.dataProviderExpression||"sonic-queue-"+this.instanceId+"-"+Math.random().toString(36).substring(7)),this.dataProviderExpression||(this.dataProviderExpression=he.getAncestorAttributeValue(this.parentElement,"dataProvider")||""),super.connectedCallback(),this.key=this.getAttribute("key"),this.templates||(this.templates=Array.from(this.querySelectorAll("template"))),this.lastRequestTime=(new Date).getTime(),await d.getInstance().isLocalStrorageReady,this.configFilter()}configFilter(){var t;const e=this.getAncestorAttributeValue("dataFilterProvider");e?(this.filterPublisher=d.getInstance().get(e),null==(t=this.filterPublisher)||t.onInternalMutation((()=>{this.updateFilteredContent()}))):this.next()}updateFilteredContent(){var t;const e=this.dataProviderExpression.split("?");e.shift();const s=new URLSearchParams(e.join("?")),i=null==(t=this.filterPublisher)?void 0:t.get(),r=this.filteredFields.split(" ");for(const n in i){let t=i[n];Array.isArray(t)&&(t=t.filter((t=>null!==t))),this.filteredFields&&!r.includes(n)||null==t||""===t.toString()||s.set(n,i[n].toString())}const o=s.toString();if(o!=this.searchHash||this.isFirstRequest){this.searchHash=o;for(const t of this.listDataProviders)d.delete(t);this.listDataProviders=[],clearTimeout(this.filterTimeoutId),this.filterTimeoutId=setTimeout((async()=>{const t=this.resultCount;this.props=null,this.requestId++,this.resultCount=t,await d.getInstance().isLocalStrorageReady,window.requestAnimationFrame((()=>this.next()))}),this.isFirstRequest?0:400),this.isFirstRequest=!1}}resetDuration(){this.lastRequestTime=(new Date).getTime()}next(t){var e;console.log("next",t);let s=this.offset;const i=(new Date).getTime()-this.lastRequestTime;if(!this.nextHadEvent&&t&&(this.publisher.resultCount=0,this.resultCount=0),this.nextHadEvent=!!t,t){if(t.detail.requestId<this.requestId)return;if(console.log("next 2"),this.resultCount+=t.detail.props.length,!t.detail.isFirstLoad||!t.detail.props.length||-1==this.dataProviderExpression.indexOf("$offset"))return void(this.publisher.resultCount=this.resultCount);console.log("next 3")}if(console.log("next 4"),Array.isArray(this.props)){const t=this.props,e=t[t.length-1];s=parseInt(e.offset.toString())+parseInt(e.limit.toString())}else{const t=[];t.resultCount=this.resultCount,this.props=t}i>0&&t&&!this.localStorage&&(this.limit=Math.round(this.limit/i*this.targetRequestDuration)),this.limit<1&&(this.limit=1),this.limit>15&&(this.limit=15);let r=this.dataProviderExpression.replace("$offset",s+"").replace("$limit",this.limit+"");const o=r.split("?"),n=o.shift(),a=new URLSearchParams(o.join("?")),l=null==(e=this.filterPublisher)?void 0:e.get(),c=this.filteredFields.split(" ");for(const d in l)this.filteredFields&&c.includes(d)||null==l[d]||""==l[d]||a.set(d,l[d]);this.searchHash||(this.searchHash=a.toString()),r=n+"?"+a.toString(),this.listDataProviders.push(r);const h=[...this.props,{id:a.toString()+"/"+this.props.length,dataProvider:r+"_item_from_queue_"+this.instanceId,endPoint:r,offset:s,limit:this.limit}];h.resultCount=this.resultCount,this.props=h,this.lastRequestTime=(new Date).getTime()}render(){if(!Array.isArray(this.props))return kt;let t=!this.noLazyload;return 1==this.props.length&&(t=!1),xt`
943
+ `}};Zs([U({type:Object})],Ys.prototype,"itemPropertyMap",2),Zs([U({type:String})],Ys.prototype,"templateKey",2),Zs([U({type:String})],Ys.prototype,"idKey",2),Zs([U()],Ys.prototype,"limit",2),Zs([U()],Ys.prototype,"offset",2),Ys=Zs([m("sonic-list")],Ys);var Qs=Object.defineProperty,Gs=Object.getOwnPropertyDescriptor,Js=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?Gs(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&Qs(e,s,o),o};let Xs=class extends(G(Rt)){constructor(){super(...arguments),this.templates=null,this.lastRequestTime=0,this.key="",this.itemPropertyMap=null,this.cache="default",this.targetRequestDuration=500,this.limit=5,this.lazyBoundsRatio=1,this.offset=0,this.resultCount=0,this.noLazyload=!1,this.filteredFields="",this.instanceId=0,this.localStorage="disabled",this.filterPublisher=null,this.searchHash="",this.requestId=0,this.isFirstRequest=!0,this.dataProviderExpression="",this.idKey="id",this.currentScrollPosition=void 0,this.listDataProviders=[],this.nextHadEvent=!1}disconnectedCallback(){for(const t of this.listDataProviders)d.delete(t);super.disconnectedCallback()}async connectedCallback(){this.instanceId=Xs.instanceCounter++,this.localStorage=this.getAttribute("localStorage")||this.localStorage,this.removeAttribute("localStorage"),this.noShadowDom="",this.defferedDebug=this.hasAttribute("debug")||null,this.dataProvider||(this.dataProvider=this.dataProviderExpression||"sonic-queue-"+this.instanceId+"-"+Math.random().toString(36).substring(7)),this.dataProviderExpression||(this.dataProviderExpression=he.getAncestorAttributeValue(this.parentElement,"dataProvider")||""),super.connectedCallback(),this.key=this.getAttribute("key"),this.templates||(this.templates=Array.from(this.querySelectorAll("template"))),this.lastRequestTime=(new Date).getTime(),await d.getInstance().isLocalStrorageReady,this.configFilter()}configFilter(){var t;const e=this.getAncestorAttributeValue("dataFilterProvider");e?(this.filterPublisher=d.getInstance().get(e),null==(t=this.filterPublisher)||t.onInternalMutation((()=>{this.updateFilteredContent()}))):this.next()}updateFilteredContent(){var t;const e=this.dataProviderExpression.split("?");e.shift();const s=new URLSearchParams(e.join("?")),i=null==(t=this.filterPublisher)?void 0:t.get(),r=this.filteredFields.split(" ");for(const n in i){let t=i[n];Array.isArray(t)&&(t=t.filter((t=>null!==t))),this.filteredFields&&!r.includes(n)||null==t||""===t.toString()||s.set(n,i[n].toString())}const o=s.toString();if(o!=this.searchHash||this.isFirstRequest){this.searchHash=o;for(const t of this.listDataProviders)d.delete(t);this.listDataProviders=[],clearTimeout(this.filterTimeoutId),this.filterTimeoutId=setTimeout((async()=>{const t=this.resultCount;this.props=null,this.requestId++,this.resultCount=t,await d.getInstance().isLocalStrorageReady,window.requestAnimationFrame((()=>this.next()))}),this.isFirstRequest?0:400),this.isFirstRequest=!1}}resetDuration(){this.lastRequestTime=(new Date).getTime()}next(t){var e;let s=this.offset;const i=(new Date).getTime()-this.lastRequestTime;if(!this.nextHadEvent&&t&&(this.publisher.resultCount=0,this.resultCount=0),this.nextHadEvent=!!t,t){if(t.detail.requestId<this.requestId)return;if(this.resultCount+=t.detail.props.length,!t.detail.isFirstLoad||!t.detail.props.length||-1==this.dataProviderExpression.indexOf("$offset"))return void(this.publisher.resultCount=this.resultCount)}if(Array.isArray(this.props)){const t=this.props,e=t[t.length-1];s=parseInt(e.offset.toString())+parseInt(e.limit.toString())}else{const t=[];t.resultCount=this.resultCount,this.props=t}i>0&&t&&!this.localStorage&&(this.limit=Math.round(this.limit/i*this.targetRequestDuration)),this.limit<1&&(this.limit=1),this.limit>15&&(this.limit=15);let r=this.dataProviderExpression.replace("$offset",s+"").replace("$limit",this.limit+"");const o=r.split("?"),n=o.shift(),a=new URLSearchParams(o.join("?")),l=null==(e=this.filterPublisher)?void 0:e.get(),c=this.filteredFields.split(" ");for(const d in l)this.filteredFields&&c.includes(d)||null==l[d]||""==l[d]||a.set(d,l[d]);this.searchHash||(this.searchHash=a.toString()),r=n+"?"+a.toString(),this.listDataProviders.push(r);const h=[...this.props,{id:a.toString()+"/"+this.props.length,dataProvider:r+"_item_from_queue_"+this.instanceId,endPoint:r,offset:s,limit:this.limit}];h.resultCount=this.resultCount,this.props=h,this.lastRequestTime=(new Date).getTime()}render(){if(!Array.isArray(this.props))return kt;let t=!this.noLazyload;return 1==this.props.length&&(t=!1),xt`
944
944
  ${
945
945
  /**
946
946
  * @license
@@ -4713,6 +4713,8 @@ var require_concorde_core_es = __commonJS({
4713
4713
  get: async (params) => {
4714
4714
  const library = params.library;
4715
4715
  const name = params.name || "";
4716
+ if (!name)
4717
+ return "";
4716
4718
  const iconsAsRecord = icons;
4717
4719
  if (library == "custom") {
4718
4720
  enableCustomLibrary();
@@ -5930,7 +5932,6 @@ var require_concorde_core_es = __commonJS({
5930
5932
  }
5931
5933
  next(e2) {
5932
5934
  var _a2;
5933
- console.log("next", e2);
5934
5935
  let offset = this.offset;
5935
5936
  const newTime = (/* @__PURE__ */ new Date()).getTime();
5936
5937
  const requestDuration = newTime - this.lastRequestTime;
@@ -5942,15 +5943,12 @@ var require_concorde_core_es = __commonJS({
5942
5943
  if (e2) {
5943
5944
  if (e2.detail.requestId < this.requestId)
5944
5945
  return;
5945
- console.log("next 2");
5946
5946
  this.resultCount += e2.detail.props.length;
5947
5947
  if (!e2.detail.isFirstLoad || !e2.detail.props.length || this.dataProviderExpression.indexOf("$offset") == -1) {
5948
5948
  this.publisher.resultCount = this.resultCount;
5949
5949
  return;
5950
5950
  }
5951
- console.log("next 3");
5952
5951
  }
5953
- console.log("next 4");
5954
5952
  if (!Array.isArray(this.props)) {
5955
5953
  const newProps2 = [];
5956
5954
  newProps2.resultCount = this.resultCount;
@@ -144,7 +144,6 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
144
144
  this.lastRequestTime = new Date().getTime();
145
145
  }
146
146
  next(e) {
147
- console.log("next", e);
148
147
  let offset = this.offset;
149
148
  const newTime = new Date().getTime();
150
149
  const requestDuration = newTime - this.lastRequestTime;
@@ -160,15 +159,12 @@ let Queue = Queue_1 = class Queue extends Subscriber(LitElement, {}) {
160
159
  if (e) {
161
160
  if (e.detail.requestId < this.requestId)
162
161
  return;
163
- console.log("next 2");
164
162
  this.resultCount += e.detail.props.length;
165
163
  if (!e.detail.isFirstLoad || !e.detail.props.length || this.dataProviderExpression.indexOf("$offset") == -1) {
166
164
  this.publisher.resultCount = this.resultCount;
167
165
  return;
168
166
  }
169
- console.log("next 3");
170
167
  }
171
- console.log("next 4");
172
168
  if (!Array.isArray(this.props)) {
173
169
  const newProps = [];
174
170
  newProps.resultCount = this.resultCount;
@@ -66,6 +66,8 @@ Icons.fontAwesomeNext = {
66
66
  get: async (params) => {
67
67
  const library = params.library;
68
68
  const name = params.name || "";
69
+ if (!name)
70
+ return "";
69
71
  const iconsAsRecord = icons;
70
72
  /**
71
73
  * SVGS en ligne
@@ -90,7 +90,6 @@ export function autoSubscribe() {
90
90
  publisher.onAssign(onAssign, false);
91
91
  });
92
92
  this.__removeAutoSubscribe__ = () => {
93
- console.log("removeAutoSubscribe");
94
93
  publishers.forEach((publisher) => {
95
94
  publisher.offAssign(onAssign);
96
95
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supersoniks/concorde",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "customElements": "custom-elements.json",
5
5
  "license": "MIT",
6
6
  "publishConfig": {