svseeds 0.1.1 → 0.2.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.
@@ -1,8 +1,6 @@
1
- export { type ClassRuleSet, type ThemePreset, CONST, STATE, AREA, elemId, theme, fnClass, isNeutral, omit, debounce, throttle, UniqueId, };
1
+ export { type ClassRuleSet, CONST, STATE, AREA, elemId, theme, fnClass, isNeutral, omit, debounce, throttle, UniqueId, };
2
2
  type ClassRule = Partial<Record<string, string>>;
3
3
  type ClassRuleSet = Partial<Record<string, ClassRule>>;
4
- type CssVarSet = Record<string, string>;
5
- type ThemePreset = Record<string, CssVarSet>;
6
4
  declare const CONST = "const";
7
5
  declare const STATE: Readonly<{
8
6
  DEFAULT: "default";
@@ -31,7 +29,6 @@ declare class ThemeSwitcher {
31
29
  #private;
32
30
  get current(): string;
33
31
  constructor();
34
- setPreset(preset: ThemePreset): ThemeSwitcher;
35
32
  toLight(): void;
36
33
  toDark(): void;
37
34
  switch(theme: string): void;
package/_svseeds/core.js CHANGED
@@ -1 +1 @@
1
- var t=this&&this.__assign||function(){return t=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)},e=this&&this.__classPrivateFieldSet||function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n},n=this&&this.__classPrivateFieldGet||function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},r=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};export{i as CONST,o as STATE,a as AREA,f as elemId,l as theme,s as fnClass,h as isNeutral,d as omit,p as debounce,v as throttle,c as UniqueId};var i="const",o=Object.freeze({DEFAULT:"default",ACTIVE:"active",INACTIVE:"inactive"}),a=Object.freeze({WHOLE:"whole",MIDDLE:"middle",MAIN:"main",TOP:"top",LEFT:"left",RIGHT:"right",BOTTOM:"bottom",LABEL:"label",AUX:"aux",EXTRA:"extra"}),c=function(){function t(t){void 0===t&&(t=4),i.add(this),c.set(this,new Set),u.set(this,4),t>2&&e(this,u,t,"f")}var i,o,a,c,u,f,l,s;return Object.defineProperty(t.prototype,"id",{get:function(){return this.get(!0)},enumerable:!1,configurable:!0}),t.prototype.get=function(t){if(t)return n(this,c,"f").size>1e4&&n(this,c,"f").clear(),n(this,i,"m",s).call(this)},o=t,c=new WeakMap,u=new WeakMap,i=new WeakSet,f=function(){return n(o,o,"f",a)[Math.trunc(Math.random()*n(o,o,"f",a).length)]},l=function(){var t=this;return String.fromCharCode.apply(String,Array(n(this,u,"f")).fill(null).map((function(){return n(t,i,"m",f).call(t)})))},s=function(){for(var t=n(this,i,"m",l).call(this);n(this,c,"f").has(t);)t=n(this,i,"m",l).call(this);return n(this,c,"f").add(t),t},a={value:r(r([],Array.from(Array(25).keys(),(function(t){return t+65})),!0),Array.from(Array(25).keys(),(function(t){return t+97})),!0)},t}(),u=function(){function t(){r.add(this),c.set(this,new Map),u.set(this,void 0),e(this,u,n(i,i,"m",d).call(i),"f")}var r,i,o,a,c,u,f,l,s,h,d;return Object.defineProperty(t.prototype,"current",{get:function(){return n(this,u,"f")},enumerable:!1,configurable:!0}),t.prototype.setPreset=function(t){return n(this,r,"m",s).call(this,t),n(this,r,"m",l).call(this),this},t.prototype.toLight=function(){this.switch(n(i,i,"f",a))},t.prototype.toDark=function(){this.switch(n(i,i,"f",o))},t.prototype.switch=function(t){n(this,c,"f").has(t)&&(e(this,u,t,"f"),n(this,r,"m",f).call(this))},i=t,c=new WeakMap,u=new WeakMap,r=new WeakSet,f=function(){var t;if("undefined"!=typeof window){var e=window.document.body.style;Object.entries(null!==(t=n(this,c,"f").get(n(this,u,"f")))&&void 0!==t?t:{}).forEach((function(t){var n=t[0],r=t[1];return e.setProperty(n,r)}))}},l=function(){if("undefined"!=typeof window){var t=Object.keys(n(this,c,"f")).filter((function(t){return t===n(i,i,"f",a)||t===n(i,i,"f",o)}));window.document.documentElement.style.colorScheme=t.join(" ")}},s=function(t){var e=this;Object.entries(t).forEach((function(t){var r=t[0],o=t[1];return n(e,c,"f").set(r,n(i,i,"m",h).call(i,o))}))},h=function(t){return Object.fromEntries(Object.entries(t).map((function(t){var e=t[0],n=t[1];return["--".concat(e.replaceAll("_","-")),n]})))},d=function(){return"undefined"==typeof window||window.matchMedia("(prefers-color-scheme: light)").matches?n(i,i,"f",a):n(i,i,"f",o)},o={value:"dark"},a={value:"light"},t}(),f=new c,l=new u;function s(e,n,a){var c=function(e,n,i){if("string"==typeof i)return i.trim()?i:e;var o=function(e,n){var i=Object.keys(e);if(i.length<=0)return n;var o=Object.keys(n);if(o.length<=0)return e;var a={};return new Set(r(r([],i,!0),o,!0)).forEach((function(r){var i,o;a[r]=t(t({},null!==(i=e[r])&&void 0!==i?i:{}),null!==(o=n[r])&&void 0!==o?o:{})})),a}(n,i);return Object.keys(o).length<=0?e:o}(e,n,null!=a?a:{});return"string"==typeof c?function(t,e){return function(t,e,n){return"".concat(t," ").concat(e).concat(n===o.DEFAULT?"":" ".concat(n))}(c,t,e)}:function(t,e){return function(t,e,n){var r,a,c,u,f,l,s=null!==(a=null===(r=t[e])||void 0===r?void 0:r[i])&&void 0!==a?a:"",h=null!==(l=null!==(u=null===(c=t[e])||void 0===c?void 0:c[n])&&void 0!==u?u:null===(f=t[e])||void 0===f?void 0:f[o.DEFAULT])&&void 0!==l?l:"";return""===s&&""===h?void 0:"".concat(s).concat(s&&h?" ":"").concat(h)}(c,t,e)}}function h(t){return t!==o.ACTIVE&&t!==o.INACTIVE}function d(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(!e)return{};var i=t({},e);return n.forEach((function(t){return delete i[t]})),i}function p(t,e){var n;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];n&&clearTimeout(n),n=setTimeout((function(){e.call.apply(e,r([null],i,!1))}),t)}}function v(t,e){var n,i=0,o=function(){return Date.now()-i},a=function(t){e.call.apply(e,r([null],t,!1)),i=Date.now()};return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(!i)return a(e);clearTimeout(n),n=setTimeout((function(){o()>=t&&a(e)}),t-o())}}
1
+ var t=this&&this.__assign||function(){return t=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},t.apply(this,arguments)},e=this&&this.__classPrivateFieldSet||function(t,e,n,r,i){if("m"===r)throw new TypeError("Private method is not writable");if("a"===r&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===r?i.call(t,n):i?i.value=n:e.set(t,n),n},n=this&&this.__classPrivateFieldGet||function(t,e,n,r){if("a"===n&&!r)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?r:"a"===n?r.call(t):r?r.value:e.get(t)},r=this&&this.__spreadArray||function(t,e,n){if(n||2===arguments.length)for(var r,i=0,o=e.length;i<o;i++)!r&&i in e||(r||(r=Array.prototype.slice.call(e,0,i)),r[i]=e[i]);return t.concat(r||Array.prototype.slice.call(e))};export{i as CONST,o as STATE,a as AREA,f as elemId,u as theme,s as fnClass,h as isNeutral,d as omit,v as debounce,p as throttle,c as UniqueId};var i="const",o=Object.freeze({DEFAULT:"default",ACTIVE:"active",INACTIVE:"inactive"}),a=Object.freeze({WHOLE:"whole",MIDDLE:"middle",MAIN:"main",TOP:"top",LEFT:"left",RIGHT:"right",BOTTOM:"bottom",LABEL:"label",AUX:"aux",EXTRA:"extra"}),c=function(){function t(t){void 0===t&&(t=4),i.add(this),c.set(this,new Set),l.set(this,4),t>2&&e(this,l,t,"f")}var i,o,a,c,l,f,u,s;return Object.defineProperty(t.prototype,"id",{get:function(){return this.get(!0)},enumerable:!1,configurable:!0}),t.prototype.get=function(t){if(t)return n(this,c,"f").size>1e4&&n(this,c,"f").clear(),n(this,i,"m",s).call(this)},o=t,c=new WeakMap,l=new WeakMap,i=new WeakSet,f=function(){return n(o,o,"f",a)[Math.trunc(Math.random()*n(o,o,"f",a).length)]},u=function(){var t=this;return String.fromCharCode.apply(String,Array(n(this,l,"f")).fill(null).map((function(){return n(t,i,"m",f).call(t)})))},s=function(){for(var t=n(this,i,"m",u).call(this);n(this,c,"f").has(t);)t=n(this,i,"m",u).call(this);return n(this,c,"f").add(t),t},a={value:r(r([],Array.from(Array(25).keys(),(function(t){return t+65})),!0),Array.from(Array(25).keys(),(function(t){return t+97})),!0)},t}(),l=function(){function t(){r.add(this),c.set(this,new Map),l.set(this,void 0),e(this,l,n(i,i,"m",y).call(i),"f"),n(this,r,"m",s).call(this),n(this,r,"m",u).call(this),n(this,r,"m",f).call(this),console.log(n(this,c,"f"))}var r,i,o,a,c,l,f,u,s,h,d,v,p,w,m,y;return Object.defineProperty(t.prototype,"current",{get:function(){return n(this,l,"f")},enumerable:!1,configurable:!0}),t.prototype.toLight=function(){this.switch(n(i,i,"f",a))},t.prototype.toDark=function(){this.switch(n(i,i,"f",o))},t.prototype.switch=function(t){n(this,c,"f").has(t)&&(e(this,l,t,"f"),n(this,r,"m",f).call(this))},i=t,c=new WeakMap,l=new WeakMap,r=new WeakSet,f=function(){var t;if("undefined"!=typeof window){var e=window.document.documentElement.style;Object.entries(null!==(t=n(this,c,"f").get(n(this,l,"f")))&&void 0!==t?t:{}).forEach((function(t){var n=t[0],r=t[1];return e.setProperty(n,r)}))}},u=function(){if("undefined"!=typeof window){var t=Object.keys(n(this,c,"f")).filter((function(t){return t===n(i,i,"f",a)||t===n(i,i,"f",o)}));window.document.documentElement.style.colorScheme=t.join(" ")}},s=function(){if("undefined"!=typeof window)for(var t=window.document.styleSheets,e=0;e<t.length;e++)n(this,r,"m",h).call(this,t[e])},h=function(t){var e=n(i,i,"m",w).call(i,t);if(e)for(var o=0;o<e.length;o++)n(this,r,"m",d).call(this,e[o])},d=function(t){if(t instanceof CSSGroupingRule)return n(this,r,"m",h).call(this,t);(t instanceof CSSStyleRule||t instanceof CSSPageRule)&&t.selectorText.includes(":root")&&n(this,r,"m",v).call(this,t.style)},v=function(t){for(var e=0;e<t.length;e++){var o=t[e];if(o.startsWith("--")){var a=n(i,i,"m",m).call(i,o),c=a[0],l=a[1],f=c?t.getPropertyValue(o).trim():"";n(this,r,"m",p).call(this,c,l,f)}}},p=function(t,e,r){t&&(console.log(r),n(this,c,"f").has(t)||n(this,c,"f").set(t,{}),n(this,c,"f").get(t)[e]=r)},w=function(t){try{return t.cssRules}catch(t){return}},m=function(t){var e=t.split("--").filter((function(t){return t}));return e.length<=1?["",""]:[e.shift(),"--".concat(e.length>1?e.join("--"):e[0])]},y=function(){return"undefined"==typeof window||window.matchMedia("(prefers-color-scheme: light)").matches?n(i,i,"f",a):n(i,i,"f",o)},o={value:"dark"},a={value:"light"},t}(),f=new c,u=new l;function s(e,n,a){var c=function(e,n,i){if("string"==typeof i)return i.trim()?i:e;var o=function(e,n){var i=Object.keys(e);if(i.length<=0)return n;var o=Object.keys(n);if(o.length<=0)return e;var a={};return new Set(r(r([],i,!0),o,!0)).forEach((function(r){var i,o;a[r]=t(t({},null!==(i=e[r])&&void 0!==i?i:{}),null!==(o=n[r])&&void 0!==o?o:{})})),a}(n,i);return Object.keys(o).length<=0?e:o}(e,n,null!=a?a:{});return"string"==typeof c?function(t,e){return function(t,e,n){return"".concat(t," ").concat(e).concat(n===o.DEFAULT?"":" ".concat(n))}(c,t,e)}:function(t,e){return function(t,e,n){var r,a,c,l,f,u,s=null!==(a=null===(r=t[e])||void 0===r?void 0:r[i])&&void 0!==a?a:"",h=null!==(u=null!==(l=null===(c=t[e])||void 0===c?void 0:c[n])&&void 0!==l?l:null===(f=t[e])||void 0===f?void 0:f[o.DEFAULT])&&void 0!==u?u:"";return""===s&&""===h?void 0:"".concat(s).concat(s&&h?" ":"").concat(h)}(c,t,e)}}function h(t){return t!==o.ACTIVE&&t!==o.INACTIVE}function d(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(!e)return{};var i=t({},e);return n.forEach((function(t){return delete i[t]})),i}function v(t,e){var n;return function(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];n&&clearTimeout(n),n=setTimeout((function(){e.call.apply(e,r([null],i,!1))}),t)}}function p(t,e){var n,i=0,o=function(){return Date.now()-i},a=function(t){e.call.apply(e,r([null],t,!1)),i=Date.now()};return function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];if(!i)return a(e);clearTimeout(n),n=setTimeout((function(){o()>=t&&a(e)}),t-o())}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svseeds",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Simple headless components for Svelte.",
5
5
  "type": "module",
6
6
  "main": "./index.js",