Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@finsweet/attributes-cmsselect

Package Overview
Dependencies
Maintainers
3
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@finsweet/attributes-cmsselect - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

2

changesets.json

@@ -1,1 +0,1 @@

[{"version":"v1.4.0","date":"26 April 2022","markdown":"Added support to use `cmsselect` + `cmsload` (all modes are supported) together.\n\nNow when a user adds `cmsload` to the parent `Collection List` of a `fs-cmsselect-element=\"text-value\"` element, `cmsselect` will populate the new options as soon they are loaded.\n\nAll `cmsload` modes are supported and will trigger adding all items as options.\nFor instance, if the `Collection List` uses `pagination` mode, all items will be added as `<select>` options even if the user doesn't click on the `Next` button.\n\nAlso, `cmsselect` will now make sure that the added options are unique and not repeated.\nThis means that now users can set the `fs-cmsselect-element=\"text-value\"` to any `Collection List Item` inside a `cmsfilter` setup to populate a `<select>` dropdown in the filters form.\n"},{"version":"v1.3.0","date":"19 April 2022","markdown":"- Added support wizard and publishing new schema version\n"},{"version":"v1.2.0","date":"10 February 2022","markdown":"Included a new `window.fsAttributes.push()` method in the developer API that provides a standarized way to safely access any Attribute internals once it has fully loaded.\nIt can be used like:\n\n```html\n<script>\n window.fsAttributes = window.fsAttributes || [];\n window.fsAttributes.push([\n 'cmsselect',\n (elements) => {\n console.log('Attribute has successfully loaded!');\n console.log(elements);\n },\n ]);\n</script>\n```\n"},{"version":"v1.2.0-beta.0","date":"24 January 2022","markdown":"- Internal: implemented `schema.json` and improvements in constants.\n"},{"version":"v1.1.0","date":"29 November 2021","markdown":"- Created `changesets.json` API.\n"},{"version":"v1.0.4","date":"17 November 2021","markdown":"- Fixed `examples.json` not being available on NPM.\n"},{"version":"v1.0.3","date":"10 November 2021","markdown":"- Updated package description.\n"},{"version":"v1.0.2","date":"7 November 2021","markdown":"- Breaking change: renamed `fs-cmsselect-element=\"source\"` as `fs-cmsselect-element=\"text-value\"`.\n- Breaking change: renamed `fs-cmsselect-element=\"target\"` as `fs-cmsselect-element=\"select\"`.\n"},{"version":"v1.0.1","date":"25 October 2021","markdown":"- Added `initAttributes` call to make sure `window.fsAttributes` exists.\n"},{"version":"v1.0.0","date":"18 October 2021","markdown":"- Created the attribute package.\n"}]
[{"version":"1.6.0","markdown":"- e4b3b680: Created new `window.fsAttributes.destroy()` method to support SPA environments.\n This new method allows users to destroy all Attributes instances, cleaning up event listeners, observers, states, global variables, etc.\n\n Websites that use a client-side router that simulates an SPA environment like [barba.js](https://barba.js.org/) or [Swup](https://swup.js.org/) can now properly init and destroy Attributes.\n After destroying, Attributes can be manually re-initted by calling `window.fsAttribute[ATTRIBUTE_KEY].init()`.\n\n Updated changesets system, now all updates will be correctly reflected in [the official updates page](https://www.finsweet.com/attributes/updates)."},{"version":"1.5.1","markdown":"- Updated dependencies [4792998a]\n- Updated dependencies [4792998a]\n - @global/constants@1.2.0\n - @finsweet/attributes-cmscore@1.8.0\n - @global/factory@1.1.5"},{"version":"1.5.0","markdown":"- 07f32375: Created `fs-cmsattribute` Attribute- Updated dependencies [07f32375]\n - @global/constants@1.1.0\n - @global/factory@1.1.4\n - @finsweet/attributes-cmscore@1.7.2"},{"version":"1.4.9","markdown":"- Updated dependencies [d8a4bf6f]\n - @finsweet/attributes-cmscore@1.7.1"},{"version":"1.4.8","markdown":"- Updated dependencies [ef56d454]\n - @finsweet/attributes-cmscore@1.7.0"},{"version":"1.4.7","markdown":"- Updated dependencies [299fd136]\n - @finsweet/attributes-cmscore@1.6.10"},{"version":"1.4.6","markdown":"- Updated dependencies [7542dcdb]\n - @global/constants@1.0.2\n - @global/factory@1.1.3\n - @finsweet/attributes-cmscore@1.6.9"},{"version":"1.4.5","markdown":"- Updated dependencies [bdd1a78]\n - @global/constants@1.0.1\n - @global/factory@1.1.2\n - @finsweet/attributes-cmscore@1.6.8"},{"version":"1.4.4","markdown":"- Updated dependencies [13c3e23]\n - @global/factory@1.1.1\n - @finsweet/attributes-cmsload@1.7.5\n - @finsweet/attributes-cmscore@1.6.7"},{"version":"1.4.3","markdown":"- Updated dependencies [627bf25]\n - @global/factory@1.1.0\n - @finsweet/attributes-cmsload@1.7.4\n - @finsweet/attributes-cmscore@1.6.7"},{"version":"1.4.2","markdown":"- Updated dependencies [8f9d08d]\n - @finsweet/attributes-cmsload@1.7.3"},{"version":"1.4.1","markdown":"- Updated dependencies [7f509db]\n - @finsweet/attributes-cmsload@1.7.2"},{"version":"1.4.0","markdown":"Added support to use `cmsselect` + `cmsload` (all modes are supported) together.\n\nNow when a user adds `cmsload` to the parent `Collection List` of a `fs-cmsselect-element=\"text-value\"` element, `cmsselect` will populate the new options as soon they are loaded.\n\nAll `cmsload` modes are supported and will trigger adding all items as options.\nFor instance, if the `Collection List` uses `pagination` mode, all items will be added as `<select>` options even if the user doesn't click on the `Next` button.\n\nAlso, `cmsselect` will now make sure that the added options are unique and not repeated.\nThis means that now users can set the `fs-cmsselect-element=\"text-value\"` to any `Collection List Item` inside a `cmsfilter` setup to populate a `<select>` dropdown in the filters form."},{"version":"1.3.0","markdown":"- Added support wizard and publishing new schema version"},{"version":"1.2.0","markdown":"Included a new `window.fsAttributes.push()` method in the developer API that provides a standarized way to safely access any Attribute internals once it has fully loaded.\nIt can be used like:\n\n```html\n<script>\n window.fsAttributes = window.fsAttributes || [];\n window.fsAttributes.push([\n 'cmsselect',\n (elements) => {\n console.log('Attribute has successfully loaded!');\n console.log(elements);\n },\n ]);\n</script>\n```"},{"version":"1.1.0","markdown":"- Created `changesets.json` API."},{"version":"1.0.4","markdown":"- Fixed `examples.json` not being available on NPM."},{"version":"1.0.3","markdown":"- Updated package description."},{"version":"1.0.2","markdown":"- Breaking change: renamed `fs-cmsselect-element=\"source\"` as `fs-cmsselect-element=\"text-value\"`.\n- Breaking change: renamed `fs-cmsselect-element=\"target\"` as `fs-cmsselect-element=\"select\"`."},{"version":"1.0.1","markdown":"- Added `initAttributes` call to make sure `window.fsAttributes` exists."},{"version":"1.0.0","markdown":"- Created the attribute package."}]

@@ -1,1 +0,1 @@

"use strict";(()=>{var K=Object.create;var b=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var H=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var q=(e,t,r)=>t in e?b(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var G=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var X=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of F(t))!j.call(e,o)&&o!==r&&b(e,o,{get:()=>t[o],enumerable:!(n=$(t,o))||n.enumerable});return e};var W=(e,t,r)=>(r=e!=null?K(H(e)):{},X(t||!e||!e.__esModule?b(r,"default",{value:e,enumerable:!0}):r,e));var _=(e,t,r)=>(q(e,typeof t!="symbol"?t+"":t,r),r);var d=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,r){if(this.alertsActivated&&window.alert(t),r==="error")throw new Error(t)}};_(d,"alertsActivated",!1);var y={wrapper:"w-dyn-list",list:"w-dyn-items",item:"w-dyn-item",paginationWrapper:"w-pagination-wrapper",paginationNext:"w-pagination-next",paginationPrevious:"w-pagination-previous",pageCount:"w-page-count",emptyState:"w-dyn-empty"};var x=e=>{let t=e.split("-"),r=parseInt(t[t.length-1]);if(!isNaN(r))return r};var R=(e,t)=>{let r=e.getAttribute(t);return r?x(r):void 0};var f=async()=>{let{fsAttributes:e}=window;e.cms||(e.cms={});let{cms:t}=e;if(t.coreImport)return t.coreImport;try{let r=import("https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmscore@1/cmscore.js");return t.coreImport=r,r.then(n=>{n&&(t.coreVersion||(t.coreVersion=n.version))}),r}catch(r){d.alert(`${r}`,"error");return}};var S="fs-attributes";var g="cmsattribute";var L="cmsload";var m="cmsselect";var Y=`${S}-support`,Q="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",M=async()=>{let{fsAttributes:e,location:t}=window,{host:r,searchParams:n}=new URL(t.href);if(!r.includes("webflow.io")||!n.has(Y))return!1;if(e.supportImport)return e.supportImport;try{e.supportImport=new Promise((o,s)=>{let i=document.createElement("script");i.src=Q,i.onload=()=>o(!0),i.onerror=s,document.head.append(i)})}catch(o){return!1}return e.supportImport};var U=e=>t=>`${e}${t?`-${t}`:""}`,A=e=>{let t=(n,o,s)=>{let i=e[n],{key:c,values:a}=i,p;if(!o)return`[${c}]`;let l=a==null?void 0:a[o];typeof l=="string"?p=l:p=l(s&&"instanceIndex"in s?s.instanceIndex:void 0);let u=s&&"caseInsensitive"in s&&s.caseInsensitive?"i":"";if(!(s!=null&&s.operator))return`[${c}="${p}"${u}]`;switch(s.operator){case"prefixed":return`[${c}^="${p}"${u}]`;case"suffixed":return`[${c}$="${p}"${u}]`;case"contains":return`[${c}*="${p}"${u}]`}};function r(n,o){let s=t("element",n,o),i=(o==null?void 0:o.scope)||document;return o!=null&&o.all?i.querySelectorAll(s):i.querySelector(s)}return[t,r]};var T={preventLoad:{key:`${S}-preventload`},debugMode:{key:`${S}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${S}-dev`}},[w,Bt]=A(T);var h=e=>{let{currentScript:t}=document,r={};if(!t)return{attributes:r,preventsLoad:!1};let o={preventsLoad:typeof t.getAttribute(T.preventLoad.key)=="string",attributes:r};for(let s in e){let i=t.getAttribute(e[s]);o.attributes[s]=i}return o};var B=()=>{if(window.fsAttributes&&!Array.isArray(window.fsAttributes))return;let e={cms:{},push(...t){var r,n;for(let[o,s]of t)(n=(r=this[o])==null?void 0:r.loading)==null||n.then(s)}};z(e),J(e),window.fsAttributes=e,window.FsAttributes=window.fsAttributes,M()},z=e=>{let t=w("src","finsweet",{operator:"contains"}),r=w("dev"),o=[...document.querySelectorAll(`script${t}, script${r}`)].reduce((s,i)=>{var a;let c=i.getAttribute(T.dev.key)||((a=i.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:a[0]);return c&&!s.includes(c)&&s.push(c),s},[]);for(let s of o){e[s]={};let i=e[s];i.loading=new Promise(c=>{i.resolve=a=>{c(a),delete i.resolve}})}},J=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var v="1.5.1";var tt=`fs-${m}`,et="text-value",rt="select",I={element:{key:`${tt}-element`,values:{textValue:U(et),select:rt}}},[E,Gt]=A(I);var P=(e,t)=>{var i;let r=R(e,I.element.key),n=O(r),o=new Set,s=new Set;for(let c of n){k(e,c,s);let a=c.closest(`.${y.wrapper}`);if(!a)continue;let p=(i=t.createCMSListInstance)==null?void 0:i.call(t,a);!p||o.add(p)}for(let c of o)c.on("additems",a=>{for(let{element:p}of a){let l=O(r,p);for(let u of l)k(e,u,s)}});return[...o]},O=(e,t=document)=>[...t.querySelectorAll(E("element","textValue",{instanceIndex:e}))],k=(e,{innerText:t},r)=>{if(!t||r.has(t))return;let n=new Option(t,t);e.options.add(n),r.add(t)};var C=async()=>{var o,s,i,c;let e=await f();if(!e)return[];await((o=window.fsAttributes[g])==null?void 0:o.loading);let t=[...document.querySelectorAll(E("element","select",{operator:"prefixed"}))],r=new Set;for(let a of t){if(!(a instanceof HTMLSelectElement))continue;let p=P(a,e);for(let l of p)r.add(l)}let n=[...r];return await((s=window.fsAttributes[L])==null?void 0:s.loading),(c=(i=window.fsAttributes[m]).resolve)==null||c.call(i,n),n};B();f();var V,N;(V=window.fsAttributes)[N=m]||(V[N]={});var{preventsLoad:ot}=h(),D=window.fsAttributes[m];D.version=v;ot?D.init=C:(window.Webflow||(window.Webflow=[]),window.Webflow.push(C));})();
"use strict";(()=>{var F=Object.create;var E=Object.defineProperty;var H=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var X=(e,t,r)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var W=(e=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(e,{get:(t,r)=>(typeof require!="undefined"?require:t)[r]}):e)(function(e){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var Y=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of j(t))!G.call(e,o)&&o!==r&&E(e,o,{get:()=>t[o],enumerable:!(s=H(t,o))||s.enumerable});return e};var z=(e,t,r)=>(r=e!=null?F(q(e)):{},Y(t||!e||!e.__esModule?E(r,"default",{value:e,enumerable:!0}):r,e));var y=(e,t,r)=>(X(e,typeof t!="symbol"?t+"":t,r),r);var u="fs-attributes";var I="cmsattribute";var R="cmsload";var p="cmsselect";var f=async(...e)=>{var r;let t=[];for(let s of e){let o=await((r=window.fsAttributes[s])==null?void 0:r.loading);t.push(o)}return t};var m=class{static activateAlerts(){this.alertsActivated=!0}static alert(t,r){if(this.alertsActivated&&window.alert(t),r==="error")throw new Error(t)}};y(m,"alertsActivated",!1);var b=()=>{};var C={wrapper:"w-dyn-list",list:"w-dyn-items",item:"w-dyn-item",paginationWrapper:"w-pagination-wrapper",paginationNext:"w-pagination-next",paginationPrevious:"w-pagination-previous",pageCount:"w-page-count",emptyState:"w-dyn-empty"};var x=e=>{let t=e.split("-"),r=parseInt(t[t.length-1]);if(!isNaN(r))return r};function g(e,t,r){var o;let s=window.fsAttributes[e];return s.destroy=r||b,(o=s.resolve)==null||o.call(s,t),t}var L=async()=>{let{fsAttributes:e}=window;e.cmscore||(e.cmscore={});let{cmscore:t}=e;if(t.import)return t.import;try{return t.import=import("https://cdn.jsdelivr.net/npm/@finsweet/attributes-cmscore@1/cmscore.js"),t.import.then(r=>{r&&(t.version||(t.version=r.version))}),t.import}catch(r){m.alert(`${r}`,"error");return}};var Q=`${u}-support`,J="https://cdn.jsdelivr.net/npm/@finsweet/attributes-support@1/support.js",U=async()=>{let{fsAttributes:e,location:t}=window,{host:r,searchParams:s}=new URL(t.href);e.support||(e.support={});let{support:o}=e;if(!r.includes("webflow.io")||!s.has(Q))return!1;if(o.import)return o.import;try{o.import=new Promise((n,i)=>{let c=document.createElement("script");c.src=J,c.onload=()=>n(!0),c.onerror=i,document.head.append(c)})}catch(n){return!1}return o.import};var v=e=>t=>`${e}${t?`-${t}`:""}`,A=e=>{let t=(s,o,n)=>{let i=e[s],{key:c,values:a}=i,l;if(!o)return`[${c}]`;let d=a==null?void 0:a[o];typeof d=="string"?l=d:l=d(n&&"instanceIndex"in n?n.instanceIndex:void 0);let S=n&&"caseInsensitive"in n&&n.caseInsensitive?"i":"";if(!(n!=null&&n.operator))return`[${c}="${l}"${S}]`;switch(n.operator){case"prefixed":return`[${c}^="${l}"${S}]`;case"suffixed":return`[${c}$="${l}"${S}]`;case"contains":return`[${c}*="${l}"${S}]`}};function r(s,o){let n=t("element",s,o),i=(o==null?void 0:o.scope)||document;return o!=null&&o.all?[...i.querySelectorAll(n)]:i.querySelector(n)}return[t,r]};var T={preventLoad:{key:`${u}-preventload`},debugMode:{key:`${u}-debug`},src:{key:"src",values:{finsweet:"@finsweet/attributes"}},dev:{key:`${u}-dev`}},[w,Lt]=A(T);var B=e=>{let{currentScript:t}=document,r={};if(!t)return{attributes:r,preventsLoad:!1};let o={preventsLoad:typeof t.getAttribute(T.preventLoad.key)=="string",attributes:r};for(let n in e){let i=t.getAttribute(e[n]);o.attributes[n]=i}return o};var h=({scriptAttributes:e,attributeKey:t,version:r,init:s})=>{var c;Z(),(c=window.fsAttributes)[t]||(c[t]={});let{preventsLoad:o,attributes:n}=B(e),i=window.fsAttributes[t];i.version=r,i.init=s,o||(window.Webflow||(window.Webflow=[]),window.Webflow.push(()=>s(n)))},Z=()=>{let e=tt();if(window.fsAttributes&&!Array.isArray(window.fsAttributes)){M(window.fsAttributes,e);return}let t={cms:{},push(...r){var s,o;for(let[n,i]of r)(o=(s=this[n])==null?void 0:s.loading)==null||o.then(i)},destroy(){var r,s;for(let o of e)(s=(r=window.fsAttributes[o])==null?void 0:r.destroy)==null||s.call(r)}};M(t,e),et(t),window.fsAttributes=t,window.FsAttributes=window.fsAttributes,U()},tt=()=>{let e=w("src","finsweet",{operator:"contains"}),t=w("dev");return[...document.querySelectorAll(`script${e}, script${t}`)].reduce((o,n)=>{var c;let i=n.getAttribute(T.dev.key)||((c=n.src.match(/[\w-. ]+(?=(\.js)$)/))==null?void 0:c[0]);return i&&!o.includes(i)&&o.push(i),o},[])},M=(e,t)=>{for(let r of t){if(e[r])continue;e[r]={};let s=e[r];s.loading=new Promise(o=>{s.resolve=n=>{o(n),delete s.resolve}})}},et=e=>{let t=Array.isArray(window.fsAttributes)?window.fsAttributes:[];e.push(...t)};var V="1.6.0";var ot=`fs-${p}`,st="text-value",nt="select",_={element:{key:`${ot}-element`,values:{textValue:v(st),select:nt}}},[O,P]=A(_);var k=(e,t)=>{let r=e.getAttribute(t);return r?x(r):void 0};var D=(e,t)=>{let r=k(e,_.element.key),s=K(r),o=new Set,n=new Set;for(let i of s){N(e,i,n);let c=i.closest(`.${C.wrapper}`);if(!c)continue;let a=t.createCMSListInstance(c);!a||o.add(a)}for(let i of o)i.on("additems",c=>{for(let{element:a}of c){let l=K(r,a);for(let d of l)N(e,d,n)}});return[...o]},K=(e,t=document)=>[...t.querySelectorAll(O("element","textValue",{instanceIndex:e}))],N=(e,{innerText:t},r)=>{if(!t||r.has(t))return;let s=new Option(t,t);e.options.add(s),r.add(t)};var $=async()=>{let e=await L();if(!e)return[];await f(I);let t=P("select",{operator:"prefixed",all:!0}),r=new Set;for(let o of t){if(!(o instanceof HTMLSelectElement))continue;let n=D(o,e);for(let i of n)r.add(i)}let s=[...r];return await f(R),g(p,s,()=>{var o;for(let n of s)(o=n.destroy)==null||o.call(n)})};h({init:$,version:V,attributeKey:p});})();
{
"name": "@finsweet/attributes-cmsselect",
"version": "1.5.1",
"version": "1.6.0",
"description": "Populate Select elements based on a CMS source.",

@@ -31,16 +31,5 @@ "homepage": "https://www.finsweet.com/attributes",

},
"devDependencies": {
"@global/build": "1.0.0",
"@global/tests": "1.0.0",
"@global/types": "1.0.0"
},
"dependencies": {
"@finsweet/attributes-cmscore": "1.8.0",
"@global/constants": "1.2.0",
"@global/factory": "1.1.5",
"@global/helpers": "1.0.0",
"@finsweet/ts-utils": "^0.33.1"
},
"scripts": {
"dev": "cross-env NODE_ENV=development node ./bin/build.js",
"build:dev": "cross-env NODE_ENV=test node ./bin/build.js",
"build": "cross-env NODE_ENV=production node ./bin/build.js",

@@ -47,0 +36,0 @@ "lint": "eslint ./src && prettier --check ./src",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc