@crewlethq/artifact-kit 0.48.3 → 0.49.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.
package/dist/theme.js CHANGED
@@ -1 +1 @@
1
- "use strict";(()=>{var c="crewlet";var y=["system","light","dark"],v=["normal","compact","comfortable"],E=/^[a-z][a-z0-9-]{0,63}$/;function d(e){return typeof e=="string"&&y.includes(e)}function l(e){return typeof e=="string"&&v.includes(e)}function f(e){return typeof e=="string"&&E.test(e)}function g(){return typeof document>"u"?null:document.documentElement}function x(e,a=g()){a&&(e==="system"?a.removeAttribute("data-theme"):a.setAttribute("data-theme",e))}function h(e,a=g()){a&&(e==="normal"?a.removeAttribute("data-density"):a.setAttribute("data-density",e))}function w(e,a=g()){if(!f(e))throw new Error(`"${e}" is not a palette id.`);a&&(e===c?a.removeAttribute("data-palette"):a.setAttribute("data-palette",e))}var o={hello:"crewlet.hello",port:"crewlet.port",theme:"crewlet.theme",openLink:"crewlet.openLink",focusExit:"crewlet.focusExit"};var i={mode:"system",palette:c,density:"normal"};var F=/^[A-Za-z0-9_-]{16,256}$/;function b(e){let a=new URLSearchParams(e.startsWith("#")?e.slice(1):e),r=a.get("nonce"),n=a.get("theme"),t=a.get("palette"),m=a.get("density");return{nonce:r!==null&&F.test(r)?r:null,theme:{mode:d(n)?n:i.mode,palette:f(t)?t:i.palette,density:l(m)?m:i.density}}}var k=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null;var A=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=9999;function p(e){let a=k(e);return!a||a.type!==o.port||!A(a.bridge)?null:{type:o.port,bridge:a.bridge}}function u(e){let a=k(e);if(!a||a.type!==o.theme)return null;let{mode:r,palette:n,density:t}=a;return!d(r)||!f(n)||!l(t)?null:{mode:r,palette:n,density:t}}function s(e,a){x(e.mode,a),w(e.palette,a),h(e.density,a)}s(b(window.location.hash).theme);window.addEventListener("message",e=>{if(e.source!==window.parent||window.parent===window||!p(e.data))return;let a=e.ports[0];a&&(a.addEventListener("message",r=>{let n=u(r.data);n&&s(n)}),a.start())});})();
1
+ "use strict";(()=>{var c="crewlet";var E=["system","light","dark"],A=["normal","compact","comfortable"],k=/^[a-z][a-z0-9-]{0,63}$/;function d(e){return typeof e=="string"&&E.includes(e)}function l(e){return typeof e=="string"&&A.includes(e)}function i(e){return typeof e=="string"&&k.test(e)}function p(){return typeof document>"u"?null:document.documentElement}function h(e,a=p()){a&&(e==="system"?a.removeAttribute("data-theme"):a.setAttribute("data-theme",e))}function x(e,a=p()){a&&(e==="normal"?a.removeAttribute("data-density"):a.setAttribute("data-density",e))}function w(e,a=p()){if(!i(e))throw new Error(`"${e}" is not a palette id.`);a&&(e===c?a.removeAttribute("data-palette"):a.setAttribute("data-palette",e))}var s={hello:"crewlet.hello",port:"crewlet.port",theme:"crewlet.theme",openLink:"crewlet.openLink",focusExit:"crewlet.focusExit"};var f={mode:"system",palette:c,density:"normal"};var F=/^[A-Za-z0-9_-]{16,256}$/;function g(e){let a=new URLSearchParams(e.startsWith("#")?e.slice(1):e),r=a.get("nonce"),t=a.get("theme"),n=a.get("palette"),u=a.get("density");return{nonce:r!==null&&F.test(r)?r:null,theme:{mode:d(t)?t:f.mode,palette:i(n)?n:f.palette,density:l(u)?u:f.density}}}var y=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:null;var v=e=>typeof e=="number"&&Number.isInteger(e)&&e>=1&&e<=9999;function b(e){let a=y(e);return!a||a.type!==s.port||!v(a.bridge)?null:{type:s.port,bridge:a.bridge}}function m(e){let a=y(e);if(!a||a.type!==s.theme)return null;let{mode:r,palette:t,density:n}=a;return!d(r)||!i(t)||!l(n)?null:{mode:r,palette:t,density:n}}function o(e,a){h(e.mode,a),w(e.palette,a),x(e.density,a)}o(g(window.location.hash).theme);window.addEventListener("message",e=>{if(e.source!==window.parent||window.parent===window||!b(e.data))return;let a=e.ports[0];a&&(a.addEventListener("message",r=>{let t=m(r.data);t&&o(t)}),a.start())});})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewlethq/artifact-kit",
3
- "version": "0.48.3",
3
+ "version": "0.49.1",
4
4
  "description": "The Crewlet design system as a framework-free browser bundle for artifact pages: the tokens, every theme, the fonts and the base stylesheet, an opt-in stylesheet for a page's plain HTML, the theme bootstrap, and the sheet as custom elements bound to the artifact runtime.",
5
5
  "license": "MIT AND OFL-1.1 AND ISC",
6
6
  "repository": {
@@ -35,9 +35,9 @@
35
35
  "clean": "rm -rf dist"
36
36
  },
37
37
  "devDependencies": {
38
- "@crewlethq/icons": "0.48.3",
39
- "@crewlethq/tokens": "0.48.3",
40
- "@crewlethq/ui": "0.48.3",
38
+ "@crewlethq/icons": "0.49.1",
39
+ "@crewlethq/tokens": "0.49.1",
40
+ "@crewlethq/ui": "0.49.1",
41
41
  "@types/react": "^19.0.0",
42
42
  "@types/react-dom": "^19.3.0",
43
43
  "esbuild": "^0.28.2",