jbx 2.10.0 → 2.11.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.
Files changed (43) hide show
  1. package/README.md +57 -11
  2. package/dist/JBX.d.ts +19 -0
  3. package/dist/JBX.d.ts.map +1 -0
  4. package/dist/JBX.js +19 -0
  5. package/dist/JBX.js.map +1 -0
  6. package/dist/classList.d.ts +2 -0
  7. package/dist/classList.d.ts.map +1 -0
  8. package/dist/classList.js +11 -0
  9. package/dist/classList.js.map +1 -0
  10. package/dist/components/Layout.d.ts +12 -0
  11. package/dist/components/Layout.d.ts.map +1 -0
  12. package/dist/components/Layout.js +17 -0
  13. package/dist/components/Layout.js.map +1 -0
  14. package/dist/components/MoreExperiments.d.ts +7 -0
  15. package/dist/components/MoreExperiments.d.ts.map +1 -0
  16. package/dist/components/MoreExperiments.js +59 -0
  17. package/dist/components/MoreExperiments.js.map +1 -0
  18. package/dist/generated/css.d.ts +2 -0
  19. package/dist/generated/css.d.ts.map +1 -0
  20. package/dist/generated/css.js +3 -0
  21. package/dist/generated/css.js.map +1 -0
  22. package/dist/index.d.ts +6 -153
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +6 -2846
  25. package/dist/index.js.map +1 -0
  26. package/dist/primitives.d.ts +139 -0
  27. package/dist/primitives.d.ts.map +1 -0
  28. package/dist/primitives.js +102 -0
  29. package/dist/primitives.js.map +1 -0
  30. package/dist/spacing.d.ts +22 -0
  31. package/dist/spacing.d.ts.map +1 -0
  32. package/dist/spacing.js +27 -0
  33. package/dist/spacing.js.map +1 -0
  34. package/package.json +45 -28
  35. package/src/JBX.tsx +24 -0
  36. package/src/classList.tsx +9 -0
  37. package/src/components/Layout.tsx +31 -0
  38. package/src/components/MoreExperiments.tsx +74 -0
  39. package/src/generated/css.ts +2 -0
  40. package/src/index.tsx +6 -0
  41. package/src/primitives.tsx +247 -0
  42. package/src/spacing.ts +43 -0
  43. package/src/style.css +369 -0
package/README.md CHANGED
@@ -1,29 +1,75 @@
1
1
  # JBX
2
2
 
3
+ The little component toolkit behind the tools on [javier.xyz](https://javier.xyz). Plain
4
+ components with a class each, one stylesheet, no runtime dependencies.
5
+
3
6
  ```
4
- npm i jbx@latest capsize@latest styled-components@latest
7
+ npm i jbx
5
8
  ```
6
9
 
10
+ ## Styles
11
+
12
+ Either import the stylesheet and set your own accent color:
13
+
14
+ ```js
15
+ import 'jbx/main.css';
16
+ ```
17
+
18
+ ```css
19
+ :root {
20
+ --accent-color: #f1c40f;
21
+ }
22
+ ```
23
+
24
+ Or let the `JBX` component do both:
25
+
26
+ ```jsx
27
+ <JBX accent="#f1c40f" />
28
+ ```
29
+
30
+ `JBX` has no hooks and no dependencies, so it renders inside a React server component too.
31
+
32
+ ## Use
33
+
7
34
  ```jsx
8
35
  import { JBX, MainHeader, Text, Space, Container } from 'jbx';
9
36
 
10
37
  function App() {
11
38
  return (
12
39
  <Container>
40
+ <JBX accent="#f1c40f" />
13
41
  <MainHeader>React Blur</MainHeader>
14
42
  <Space h={1} />
15
- <Text>
16
- Tool that creates animated CSS transitions. Add sprites and get the code ready to paste in
17
- your site.
18
- </Text>
19
- <Space h={2} />
20
- <Text>
21
- Tool that creates animated CSS transitions. Add sprites and get the code ready to paste in
22
- your site.
23
- </Text>
43
+ <Text>React component for creating blurred backgrounds.</Text>
24
44
  </Container>
25
45
  );
26
46
  }
47
+ ```
48
+
49
+ ## Spacing
50
+
51
+ Everything is measured in units of `--size` (16px, 14px on smaller screens). `<Space h={2} />`,
52
+ `<Inline gap={1} />`, `<Box padding={[0.5, 1]} />` all speak the same scale, and `space(n)` gives
53
+ you the raw css value if you need it somewhere else.
54
+
55
+ ## Making your own
56
+
57
+ `Component` is the whole idea — a class name, optional styles, optional element:
27
58
 
28
- export default App;
59
+ ```jsx
60
+ const Sprite = Component(
61
+ `jbx-img`,
62
+ ({ height, width }) => ({ height, width, imageRendering: 'pixelated' }),
63
+ { element: 'img', styleProps: ['height', 'width'] }
64
+ );
65
+ ```
66
+
67
+ `styleProps` lists the props the style function consumes so they don't end up as DOM attributes.
68
+
69
+ ## Develop
70
+
71
+ ```
72
+ npm run dev # rebuild on change
73
+ npm run typecheck
74
+ npm test # renders every export, fails on any React warning
29
75
  ```
package/dist/JBX.d.ts ADDED
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ type JBXProps = {
3
+ accent?: string;
4
+ };
5
+ /**
6
+ * Drops the JBX base stylesheet into the page, optionally setting the accent
7
+ * color. Use this when you don't want to wire up a css import:
8
+ *
9
+ * <JBX accent="#f1c40f" />
10
+ *
11
+ * The alternative is `import 'jbx/main.css'` plus your own `--accent-color`.
12
+ * Doing both is harmless — the rules are identical.
13
+ *
14
+ * No hooks and no dependencies, so it also renders inside a React server
15
+ * component.
16
+ */
17
+ export declare function JBX({ accent }: JBXProps): React.JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=JBX.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JBX.d.ts","sourceRoot":"","sources":["../src/JBX.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,KAAK,QAAQ,GAAG;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,QAAQ,qBAIvC"}
package/dist/JBX.js ADDED
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { CSS } from './generated/css.js';
3
+ /**
4
+ * Drops the JBX base stylesheet into the page, optionally setting the accent
5
+ * color. Use this when you don't want to wire up a css import:
6
+ *
7
+ * <JBX accent="#f1c40f" />
8
+ *
9
+ * The alternative is `import 'jbx/main.css'` plus your own `--accent-color`.
10
+ * Doing both is harmless — the rules are identical.
11
+ *
12
+ * No hooks and no dependencies, so it also renders inside a React server
13
+ * component.
14
+ */
15
+ export function JBX({ accent }) {
16
+ const css = accent ? `${CSS}\n:root {\n --accent-color: ${accent};\n}\n` : CSS;
17
+ return React.createElement("style", { "data-jbx": "", dangerouslySetInnerHTML: { __html: css } });
18
+ }
19
+ //# sourceMappingURL=JBX.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"JBX.js","sourceRoot":"","sources":["../src/JBX.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,oBAAoB,CAAC;AAMzC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,GAAG,CAAC,EAAE,MAAM,EAAY;IACtC,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,gCAAgC,MAAM,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;IAEhF,OAAO,2CAAgB,EAAE,EAAC,uBAAuB,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAI,CAAC;AACzE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function classList(classes: any[] | Record<string, any>): string;
2
+ //# sourceMappingURL=classList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classList.d.ts","sourceRoot":"","sources":["../src/classList.tsx"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,UAQ7D"}
@@ -0,0 +1,11 @@
1
+ export function classList(classes) {
2
+ if (Array.isArray(classes)) {
3
+ return classes.filter((e) => e).join(' ');
4
+ }
5
+ else {
6
+ return Object.keys(classes)
7
+ .filter((e) => classes[e])
8
+ .join(' ');
9
+ }
10
+ }
11
+ //# sourceMappingURL=classList.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classList.js","sourceRoot":"","sources":["../src/classList.tsx"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,OAAoC;IAC5D,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;SAAM,CAAC;QACN,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC;aACxB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;aACzB,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import React, { CSSProperties } from 'react';
2
+ import { SpacingProps } from '../spacing.js';
3
+ type BoxProps = SpacingProps & {
4
+ children?: React.ReactNode;
5
+ smallText?: boolean;
6
+ flex?: number;
7
+ minWidth?: number | string;
8
+ style?: CSSProperties;
9
+ };
10
+ export declare function Box({ children, smallText, flex, minWidth, style, ...spacing }: BoxProps): React.JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=Layout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../src/components/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAuB,YAAY,EAAE,MAAM,eAAe,CAAC;AAGlE,KAAK,QAAQ,GAAG,YAAY,GAAG;IAC7B,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AAEF,wBAAgB,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,EAAE,QAAQ,qBAkBvF"}
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { spacingPropsToStyle } from '../spacing.js';
3
+ import { classList } from '../classList.js';
4
+ export function Box({ children, smallText, flex, minWidth, style, ...spacing }) {
5
+ const styles = {
6
+ flex,
7
+ minWidth,
8
+ ...spacingPropsToStyle(spacing),
9
+ ...style
10
+ };
11
+ const className = classList({
12
+ 'jbx-box': true,
13
+ 'jbx-small-text': smallText
14
+ });
15
+ return (React.createElement("div", { className: className, style: styles }, children));
16
+ }
17
+ //# sourceMappingURL=Layout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../src/components/Layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAgB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAU5C,MAAM,UAAU,GAAG,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,OAAO,EAAY;IACtF,MAAM,MAAM,GAAG;QACb,IAAI;QACJ,QAAQ;QACR,GAAG,mBAAmB,CAAC,OAAO,CAAC;QAC/B,GAAG,KAAK;KACT,CAAC;IAEF,MAAM,SAAS,GAAG,SAAS,CAAC;QAC1B,SAAS,EAAE,IAAI;QACf,gBAAgB,EAAE,SAAS;KAC5B,CAAC,CAAC;IAEH,OAAO,CACL,6BAAK,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,IACrC,QAAQ,CACL,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ type MoreExperimentsProps = {
3
+ exclude?: string;
4
+ };
5
+ export declare function MoreExperiments({ exclude }: MoreExperimentsProps): React.JSX.Element;
6
+ export {};
7
+ //# sourceMappingURL=MoreExperiments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoreExperiments.d.ts","sourceRoot":"","sources":["../../src/components/MoreExperiments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AA8CxC,KAAK,oBAAoB,GAAG;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,EAAE,oBAAoB,qBAuBhE"}
@@ -0,0 +1,59 @@
1
+ import React, { Fragment } from 'react';
2
+ import { Text, Space, Ul, Li, A } from '../primitives.js';
3
+ const PROJECT_DATA = [
4
+ {
5
+ name: 'PINTR',
6
+ description: 'Tool that turns your images into plotter-like line drawings',
7
+ url: 'https://javier.xyz/pintr'
8
+ },
9
+ {
10
+ name: 'Visual Center',
11
+ description: 'Tool that help you visually center objects in a container',
12
+ url: 'https://javier.xyz/visual-center'
13
+ },
14
+ {
15
+ name: 'Brutalita',
16
+ description: 'Grid based font editor and font. Create fonts in the browser and export OpenType files',
17
+ url: 'https://brutalita.com'
18
+ },
19
+ {
20
+ name: 'Morphin',
21
+ description: 'Create animated CSS transitions. Add sprites and get the code ready to paste in your site',
22
+ url: 'https://javier.xyz/morphin'
23
+ },
24
+ {
25
+ name: 'Droste Creator',
26
+ description: 'Create recursive images with the droste effect',
27
+ url: 'https://javier.xyz/droste-creator'
28
+ },
29
+ {
30
+ name: 'Sombras.app',
31
+ description: 'Create art with shadows. Draw shadows and get 3D objects that project them.',
32
+ url: 'https://sombras.app'
33
+ },
34
+ {
35
+ name: 'Cohesive Colors',
36
+ description: 'Tool that can help you to create cohesive color palettes',
37
+ url: 'https://javier.xyz/cohesive-colors'
38
+ }
39
+ ];
40
+ const seed = 0;
41
+ const maxItems = 5;
42
+ export function MoreExperiments({ exclude }) {
43
+ const projects = exclude
44
+ ? PROJECT_DATA.filter((project) => !project.url.includes(exclude))
45
+ : PROJECT_DATA;
46
+ const items = new Array(Math.min(maxItems, projects.length)).fill('').map((_0, idx) => {
47
+ const project = projects[(seed + idx) % projects.length];
48
+ return (React.createElement(Li, { key: project.url },
49
+ React.createElement(A, { href: project.url }, project.name),
50
+ `, `,
51
+ project.description,
52
+ "."));
53
+ });
54
+ return (React.createElement(Fragment, null,
55
+ React.createElement(Text, null, "More experiments"),
56
+ React.createElement(Space, { h: 1 }),
57
+ React.createElement(Ul, null, items)));
58
+ }
59
+ //# sourceMappingURL=MoreExperiments.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MoreExperiments.js","sourceRoot":"","sources":["../../src/components/MoreExperiments.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAE1D,MAAM,YAAY,GAAG;IACnB;QACE,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,6DAA6D;QAC1E,GAAG,EAAE,0BAA0B;KAChC;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,2DAA2D;QACxE,GAAG,EAAE,kCAAkC;KACxC;IACD;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,wFAAwF;QAC1F,GAAG,EAAE,uBAAuB;KAC7B;IACD;QACE,IAAI,EAAE,SAAS;QACf,WAAW,EACT,2FAA2F;QAC7F,GAAG,EAAE,4BAA4B;KAClC;IACD;QACE,IAAI,EAAE,gBAAgB;QACtB,WAAW,EAAE,gDAAgD;QAC7D,GAAG,EAAE,mCAAmC;KACzC;IACD;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,6EAA6E;QAC1F,GAAG,EAAE,qBAAqB;KAC3B;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE,0DAA0D;QACvE,GAAG,EAAE,oCAAoC;KAC1C;CACO,CAAC;AAEX,MAAM,IAAI,GAAG,CAAC,CAAC;AACf,MAAM,QAAQ,GAAG,CAAC,CAAC;AAMnB,MAAM,UAAU,eAAe,CAAC,EAAE,OAAO,EAAwB;IAC/D,MAAM,QAAQ,GAAG,OAAO;QACtB,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClE,CAAC,CAAC,YAAY,CAAC;IAEjB,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE;QACpF,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;QACzD,OAAO,CACL,oBAAC,EAAE,IAAC,GAAG,EAAE,OAAO,CAAC,GAAG;YAClB,oBAAC,CAAC,IAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAG,OAAO,CAAC,IAAI,CAAK;YACvC,IAAI;YACJ,OAAO,CAAC,WAAW;gBACjB,CACN,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,QAAQ;QACP,oBAAC,IAAI,2BAAwB;QAC7B,oBAAC,KAAK,IAAC,CAAC,EAAE,CAAC,GAAI;QACf,oBAAC,EAAE,QAAE,KAAK,CAAM,CACP,CACZ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const CSS = "html {\n box-sizing: border-box;\n}\n*,\n*:before,\n*:after {\n box-sizing: inherit;\n}\n\n:root {\n --size: 16px;\n --font-size: 16px;\n --font-size-small: 17px;\n --radius-small: 2px;\n}\n\n@media screen and (max-width: 1200px) {\n :root {\n --font-size: 18px;\n --font-size-small: 16px;\n --size: 14px;\n }\n}\n\n@media screen and (max-width: 600px) {\n :root {\n --font-size: 16px;\n --font-size-small: 14px;\n }\n}\n\n* {\n padding: 0;\n margin: 0;\n position: relative;\n}\n\nbody {\n touch-action: pan-y;\n}\n\nbody,\ninput,\ntextarea {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n}\n\nbody {\n background: #fcfcfd;\n color: #000;\n}\n\nh1,\nh2,\nh3,\nh4 {\n line-height: 1;\n padding: 0;\n font-variation-settings: 'wght' 600;\n font-weight: 600;\n color: var(--base-font-color-bright);\n}\nh1 {\n font-variation-settings: 'wdth' 107, 'wght' 650;\n font-weight: 650;\n}\n\nstrong,\nb {\n font-weight: 500;\n}\n\n.jbx-main-h1 {\n display: inline-block;\n background-color: var(--accent-color);\n font-size: calc(var(--font-size) * 2);\n padding: 8px;\n}\n\n.jbx-h1 {\n font-size: calc(var(--font-size) * 2);\n font-weight: 700;\n}\n.jbx-h2 {\n font-size: calc(var(--font-size) * 1.25);\n}\n.jbx-h3 {\n font-size: calc(var(--font-size) * 1.125);\n}\n.jbx-h4 {\n font-size: var(--font-size-small);\n text-transform: uppercase;\n}\n\n/* base text */\nhtml,\nbody,\n.jbx-button,\n.jbx-input {\n font-size: var(--font-size);\n line-height: 1;\n}\n\n.jbx-code-snippet {\n border-radius: var(--size);\n font-family: monaco, monospace;\n border: none;\n width: 100%;\n font-size: calc(var(--size) - 3px);\n line-height: 1.33;\n padding: var(--size) calc(var(--size) * 1.2);\n background: #ecf0f1;\n color: #34495e;\n resize: none;\n}\n.jbx-code-snippet:focus {\n outline: none;\n}\n\n.jbx-code-area {\n border-radius: var(--size);\n font-family: monaco, monospace;\n border: none;\n width: 100%;\n font-size: calc(var(--size) - 3px);\n line-height: 1.33;\n padding: var(--size) calc(var(--size) * 1.2);\n background: #ecf0f1;\n color: #34495e;\n resize: none;\n min-height: 120px;\n}\n.jbx-code-area:focus {\n outline: none;\n}\n\n.jbx-button {\n color: #000;\n border-radius: var(--radius-small);\n appearance: none;\n user-select: none;\n cursor: pointer;\n display: inline-block;\n background-color: #eee;\n box-shadow: 3px 3px 0 #ccc;\n padding: 0 calc(var(--size) / 2);\n border: none;\n height: calc(var(--size) * 2.5);\n transition: top 0.1s, left 0.1s, box-shadow 0.05s;\n}\n.jbx-button:active {\n top: 1px;\n left: 1px;\n box-shadow: 1px 1px 0 #ccc;\n}\n\n/* LINKS */\n.jbx-a {\n cursor: pointer;\n color: #000;\n box-shadow: #0002 0 2px 0;\n font-weight: 500;\n text-decoration: none;\n}\n.jbx-a::after {\n content: '\u2197';\n color: #0004;\n font-size: var(--font-size-small);\n position: relative;\n top: -1px;\n right: -1px;\n transition: top 0.3s, right 0.3s, color 0.3s;\n}\n.jbx-a:hover,\n.jbx-block-link:hover .jbx-a {\n box-shadow: var(--accent-color) 0 2px 0;\n}\n.jbx-a:hover::after,\n.jbx-block-link:hover .jbx-a::after {\n top: -3px;\n right: -3px;\n color: var(--accent-color);\n}\n\n.jbx-block-link {\n min-width: 300px;\n flex: 1;\n text-decoration: none;\n color: #000;\n display: inline-block;\n padding: var(--size);\n}\na.jbx-a::before,\n.jbx-block-link::before {\n content: '';\n display: block;\n position: absolute;\n background-color: #ecf0f1;\n z-index: -1;\n transition: transform 0.2s, opacity 0.2s;\n transform: scale(0.98) translatey(4px);\n opacity: 0;\n top: -4px;\n left: -6px;\n right: -6px;\n bottom: -4px;\n}\n.jbx-block-link::before {\n border-radius: 16px;\n}\na.jbx-a::before {\n border-radius: 8px;\n}\na.jbx-a:hover::before,\n.jbx-block-link:hover::before {\n transform: scale(1) translatey(0);\n opacity: 1;\n}\n\n.jbx-a {\n display: inline-block;\n}\n\n/* /LINKS */\n\n.jbx-small-text {\n font-size: var(--font-size-small);\n}\n\n.jbx-container {\n max-width: 1080px;\n margin: 0 auto;\n padding: calc(var(--size) * 2.5) calc(var(--size) * 1.5) calc(var(--size) * 4);\n}\n\n.jbx-box {\n flex: 1;\n}\n\n.jbx-inline {\n flex: 1;\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n}\n\n.jbx-stack {\n flex: 1;\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.jbx-text {\n line-height: 1.4;\n}\n\n.jbx-input {\n color: #777;\n -webkit-text-fill-color: #777;\n opacity: 1;\n flex: 1;\n display: block;\n appearance: none;\n border: none;\n border-radius: var(--radius-small);\n height: calc(var(--size) * 2.5);\n background-color: #eee;\n padding: 0 calc(var(--size) * 0.5);\n box-shadow: inset rgba(0, 0, 0, 0.04) 3px 3px 0, inset rgba(0, 0, 0, 0.03) 0.5px 0.5px 0;\n}\n\n.jbx-dropzone {\n height: 120px;\n flex: 1;\n display: flex;\n text-align: center;\n align-items: center;\n align-content: center;\n justify-content: center;\n flex-direction: column;\n border: 2px dashed #000;\n color: #000;\n padding: 0;\n cursor: pointer;\n}\n.jbx-dropzone:hover {\n border-color: #999;\n}\n.jbx-dropzone span {\n width: 100%;\n cursor: pointer;\n}\n.jbx-dropzone input {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n opacity: 0;\n cursor: pointer;\n}\n\n.jbx-range {\n flex: 1;\n width: 100%;\n appearance: none;\n background-color: #bdc3c780;\n height: var(--size);\n border-radius: 0;\n border-radius: var(--radius-small);\n}\n\n.jbx-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n box-shadow: none;\n border-radius: 0;\n height: calc(var(--size) * 2);\n width: var(--size);\n background-color: #000;\n border: none;\n border-radius: var(--radius-small);\n}\n.jbx-range::-moz-range-thumb {\n appearance: none;\n box-shadow: none;\n border-radius: 0;\n height: calc(var(--size) * 2);\n width: var(--size);\n background-color: #000;\n border: none;\n border-radius: var(--radius-small);\n}\n.jbx-range::-webkit-slider-runnable-track {\n appearance: none;\n}\n.jbx-range:focus {\n outline: none;\n}\n\n.jbx-bullet-container {\n display: inline-block;\n margin: -8px 4px -8px 0;\n}\n\n.jbx-bullet {\n border: 1px solid #0001;\n color: #000;\n background-color: #0001;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: calc(var(--font-size-small) - 3px);\n height: calc(var(--size) * 1.25);\n width: calc(var(--size) * 1.25);\n border-radius: 100%;\n top: -2px;\n margin-right: 2px;\n}\n\n.jbx-hr {\n margin: calc(var(--size) * 2) auto;\n width: 38.2%;\n border-radius: 0;\n border: none;\n border-top: 2px solid #ecf0f1;\n}\n";
2
+ //# sourceMappingURL=css.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.d.ts","sourceRoot":"","sources":["../../src/generated/css.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,GAAG,unNAAknN,CAAC"}
@@ -0,0 +1,3 @@
1
+ // Generated by scripts/build-css.mjs from src/style.css. Do not edit.
2
+ export const CSS = "html {\n box-sizing: border-box;\n}\n*,\n*:before,\n*:after {\n box-sizing: inherit;\n}\n\n:root {\n --size: 16px;\n --font-size: 16px;\n --font-size-small: 17px;\n --radius-small: 2px;\n}\n\n@media screen and (max-width: 1200px) {\n :root {\n --font-size: 18px;\n --font-size-small: 16px;\n --size: 14px;\n }\n}\n\n@media screen and (max-width: 600px) {\n :root {\n --font-size: 16px;\n --font-size-small: 14px;\n }\n}\n\n* {\n padding: 0;\n margin: 0;\n position: relative;\n}\n\nbody {\n touch-action: pan-y;\n}\n\nbody,\ninput,\ntextarea {\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;\n}\n\nbody {\n background: #fcfcfd;\n color: #000;\n}\n\nh1,\nh2,\nh3,\nh4 {\n line-height: 1;\n padding: 0;\n font-variation-settings: 'wght' 600;\n font-weight: 600;\n color: var(--base-font-color-bright);\n}\nh1 {\n font-variation-settings: 'wdth' 107, 'wght' 650;\n font-weight: 650;\n}\n\nstrong,\nb {\n font-weight: 500;\n}\n\n.jbx-main-h1 {\n display: inline-block;\n background-color: var(--accent-color);\n font-size: calc(var(--font-size) * 2);\n padding: 8px;\n}\n\n.jbx-h1 {\n font-size: calc(var(--font-size) * 2);\n font-weight: 700;\n}\n.jbx-h2 {\n font-size: calc(var(--font-size) * 1.25);\n}\n.jbx-h3 {\n font-size: calc(var(--font-size) * 1.125);\n}\n.jbx-h4 {\n font-size: var(--font-size-small);\n text-transform: uppercase;\n}\n\n/* base text */\nhtml,\nbody,\n.jbx-button,\n.jbx-input {\n font-size: var(--font-size);\n line-height: 1;\n}\n\n.jbx-code-snippet {\n border-radius: var(--size);\n font-family: monaco, monospace;\n border: none;\n width: 100%;\n font-size: calc(var(--size) - 3px);\n line-height: 1.33;\n padding: var(--size) calc(var(--size) * 1.2);\n background: #ecf0f1;\n color: #34495e;\n resize: none;\n}\n.jbx-code-snippet:focus {\n outline: none;\n}\n\n.jbx-code-area {\n border-radius: var(--size);\n font-family: monaco, monospace;\n border: none;\n width: 100%;\n font-size: calc(var(--size) - 3px);\n line-height: 1.33;\n padding: var(--size) calc(var(--size) * 1.2);\n background: #ecf0f1;\n color: #34495e;\n resize: none;\n min-height: 120px;\n}\n.jbx-code-area:focus {\n outline: none;\n}\n\n.jbx-button {\n color: #000;\n border-radius: var(--radius-small);\n appearance: none;\n user-select: none;\n cursor: pointer;\n display: inline-block;\n background-color: #eee;\n box-shadow: 3px 3px 0 #ccc;\n padding: 0 calc(var(--size) / 2);\n border: none;\n height: calc(var(--size) * 2.5);\n transition: top 0.1s, left 0.1s, box-shadow 0.05s;\n}\n.jbx-button:active {\n top: 1px;\n left: 1px;\n box-shadow: 1px 1px 0 #ccc;\n}\n\n/* LINKS */\n.jbx-a {\n cursor: pointer;\n color: #000;\n box-shadow: #0002 0 2px 0;\n font-weight: 500;\n text-decoration: none;\n}\n.jbx-a::after {\n content: '↗';\n color: #0004;\n font-size: var(--font-size-small);\n position: relative;\n top: -1px;\n right: -1px;\n transition: top 0.3s, right 0.3s, color 0.3s;\n}\n.jbx-a:hover,\n.jbx-block-link:hover .jbx-a {\n box-shadow: var(--accent-color) 0 2px 0;\n}\n.jbx-a:hover::after,\n.jbx-block-link:hover .jbx-a::after {\n top: -3px;\n right: -3px;\n color: var(--accent-color);\n}\n\n.jbx-block-link {\n min-width: 300px;\n flex: 1;\n text-decoration: none;\n color: #000;\n display: inline-block;\n padding: var(--size);\n}\na.jbx-a::before,\n.jbx-block-link::before {\n content: '';\n display: block;\n position: absolute;\n background-color: #ecf0f1;\n z-index: -1;\n transition: transform 0.2s, opacity 0.2s;\n transform: scale(0.98) translatey(4px);\n opacity: 0;\n top: -4px;\n left: -6px;\n right: -6px;\n bottom: -4px;\n}\n.jbx-block-link::before {\n border-radius: 16px;\n}\na.jbx-a::before {\n border-radius: 8px;\n}\na.jbx-a:hover::before,\n.jbx-block-link:hover::before {\n transform: scale(1) translatey(0);\n opacity: 1;\n}\n\n.jbx-a {\n display: inline-block;\n}\n\n/* /LINKS */\n\n.jbx-small-text {\n font-size: var(--font-size-small);\n}\n\n.jbx-container {\n max-width: 1080px;\n margin: 0 auto;\n padding: calc(var(--size) * 2.5) calc(var(--size) * 1.5) calc(var(--size) * 4);\n}\n\n.jbx-box {\n flex: 1;\n}\n\n.jbx-inline {\n flex: 1;\n display: flex;\n flex-wrap: wrap;\n flex-direction: row;\n}\n\n.jbx-stack {\n flex: 1;\n display: flex;\n flex-wrap: wrap;\n flex-direction: column;\n}\n\n.jbx-text {\n line-height: 1.4;\n}\n\n.jbx-input {\n color: #777;\n -webkit-text-fill-color: #777;\n opacity: 1;\n flex: 1;\n display: block;\n appearance: none;\n border: none;\n border-radius: var(--radius-small);\n height: calc(var(--size) * 2.5);\n background-color: #eee;\n padding: 0 calc(var(--size) * 0.5);\n box-shadow: inset rgba(0, 0, 0, 0.04) 3px 3px 0, inset rgba(0, 0, 0, 0.03) 0.5px 0.5px 0;\n}\n\n.jbx-dropzone {\n height: 120px;\n flex: 1;\n display: flex;\n text-align: center;\n align-items: center;\n align-content: center;\n justify-content: center;\n flex-direction: column;\n border: 2px dashed #000;\n color: #000;\n padding: 0;\n cursor: pointer;\n}\n.jbx-dropzone:hover {\n border-color: #999;\n}\n.jbx-dropzone span {\n width: 100%;\n cursor: pointer;\n}\n.jbx-dropzone input {\n position: absolute;\n top: 0;\n left: 0;\n height: 100%;\n width: 100%;\n opacity: 0;\n cursor: pointer;\n}\n\n.jbx-range {\n flex: 1;\n width: 100%;\n appearance: none;\n background-color: #bdc3c780;\n height: var(--size);\n border-radius: 0;\n border-radius: var(--radius-small);\n}\n\n.jbx-range::-webkit-slider-thumb {\n -webkit-appearance: none;\n appearance: none;\n box-shadow: none;\n border-radius: 0;\n height: calc(var(--size) * 2);\n width: var(--size);\n background-color: #000;\n border: none;\n border-radius: var(--radius-small);\n}\n.jbx-range::-moz-range-thumb {\n appearance: none;\n box-shadow: none;\n border-radius: 0;\n height: calc(var(--size) * 2);\n width: var(--size);\n background-color: #000;\n border: none;\n border-radius: var(--radius-small);\n}\n.jbx-range::-webkit-slider-runnable-track {\n appearance: none;\n}\n.jbx-range:focus {\n outline: none;\n}\n\n.jbx-bullet-container {\n display: inline-block;\n margin: -8px 4px -8px 0;\n}\n\n.jbx-bullet {\n border: 1px solid #0001;\n color: #000;\n background-color: #0001;\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: calc(var(--font-size-small) - 3px);\n height: calc(var(--size) * 1.25);\n width: calc(var(--size) * 1.25);\n border-radius: 100%;\n top: -2px;\n margin-right: 2px;\n}\n\n.jbx-hr {\n margin: calc(var(--size) * 2) auto;\n width: 38.2%;\n border-radius: 0;\n border: none;\n border-top: 2px solid #ecf0f1;\n}\n";
3
+ //# sourceMappingURL=css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"css.js","sourceRoot":"","sources":["../../src/generated/css.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,GAAG,GAAG,+mNAA+mN,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,153 +1,6 @@
1
- import React, { CSSProperties, ReactNode } from 'react';
2
-
3
- type BoxProps = {
4
- children?: React.ReactNode;
5
- smallText?: true | false;
6
- padding?: number;
7
- flex?: number;
8
- style?: CSSProperties;
9
- };
10
- declare function Box({ children, smallText, padding, flex, style }: BoxProps): React.JSX.Element;
11
-
12
- type MoreExperimentsProps = {
13
- exclude?: string;
14
- };
15
- declare function MoreExperiments({ exclude }: MoreExperimentsProps): React.JSX.Element;
16
-
17
- declare function Component<T>(className: string, styleSrc?: {}, config?: {
18
- element?: string;
19
- props?: any;
20
- }): (props: T & {
21
- children?: ReactNode;
22
- style?: CSSProperties;
23
- }) => JSX.Element;
24
- declare const Container: (props: {
25
- children?: ReactNode;
26
- style?: React.CSSProperties | undefined;
27
- }) => JSX.Element;
28
- declare const Text: (props: {
29
- children?: ReactNode;
30
- style?: React.CSSProperties | undefined;
31
- }) => JSX.Element;
32
- declare const SmallText: (props: {
33
- children?: ReactNode;
34
- style?: React.CSSProperties | undefined;
35
- }) => JSX.Element;
36
- declare const Button: (props: React.HTMLProps<HTMLButtonElement> & {
37
- children?: ReactNode;
38
- style?: React.CSSProperties | undefined;
39
- }) => JSX.Element;
40
- declare const Input: (props: React.HTMLProps<HTMLInputElement> & {
41
- children?: ReactNode;
42
- } & {
43
- children?: ReactNode;
44
- style?: React.CSSProperties | undefined;
45
- }) => JSX.Element;
46
- declare const Range: (props: React.HTMLProps<HTMLInputElement> & {
47
- children?: ReactNode;
48
- } & {
49
- children?: ReactNode;
50
- style?: React.CSSProperties | undefined;
51
- }) => JSX.Element;
52
- declare const HeaderH1: (props: {
53
- children?: ReactNode;
54
- style?: React.CSSProperties | undefined;
55
- }) => JSX.Element;
56
- declare const HeaderH2: (props: {
57
- children?: ReactNode;
58
- style?: React.CSSProperties | undefined;
59
- }) => JSX.Element;
60
- declare const HeaderH3: (props: {
61
- children?: ReactNode;
62
- style?: React.CSSProperties | undefined;
63
- }) => JSX.Element;
64
- declare const HeaderH4: (props: {
65
- children?: ReactNode;
66
- style?: React.CSSProperties | undefined;
67
- }) => JSX.Element;
68
- declare const HR: (props: {
69
- children?: ReactNode;
70
- style?: React.CSSProperties | undefined;
71
- }) => JSX.Element;
72
- declare const MainHeader: (props: {
73
- children?: ReactNode;
74
- style?: React.CSSProperties | undefined;
75
- }) => JSX.Element;
76
- declare const A: (props: React.HTMLProps<HTMLAnchorElement> & {
77
- children?: ReactNode;
78
- href: string;
79
- } & {
80
- children?: ReactNode;
81
- style?: React.CSSProperties | undefined;
82
- }) => JSX.Element;
83
- type SpaceProps = {
84
- inline?: boolean;
85
- h?: number;
86
- w?: number;
87
- };
88
- declare const Space: (props: SpaceProps & {
89
- children?: ReactNode;
90
- style?: React.CSSProperties | undefined;
91
- }) => JSX.Element;
92
- type InlineProps = {
93
- v?: number;
94
- h?: number;
95
- gap?: number;
96
- wrap?: boolean;
97
- };
98
- declare const Inline: (props: InlineProps & {
99
- children?: ReactNode;
100
- style?: React.CSSProperties | undefined;
101
- }) => JSX.Element;
102
- declare const Stack: (props: {
103
- children?: ReactNode;
104
- style?: React.CSSProperties | undefined;
105
- }) => JSX.Element;
106
- declare const Dropzone: (props: {
107
- children?: ReactNode;
108
- style?: React.CSSProperties | undefined;
109
- }) => JSX.Element;
110
- declare const Ul: (props: {
111
- children?: ReactNode;
112
- style?: React.CSSProperties | undefined;
113
- }) => JSX.Element;
114
- declare const Li: (props: {
115
- children?: ReactNode;
116
- style?: React.CSSProperties | undefined;
117
- }) => JSX.Element;
118
- declare const Tabs: (props: {
119
- children?: ReactNode;
120
- style?: React.CSSProperties | undefined;
121
- }) => JSX.Element;
122
- type TabProps = {
123
- info?: boolean;
124
- active?: boolean;
125
- };
126
- declare const Tab: (props: TabProps & {
127
- children?: ReactNode;
128
- style?: React.CSSProperties | undefined;
129
- }) => JSX.Element;
130
- declare const CodeSnippet: (props: {
131
- children?: ReactNode;
132
- style?: React.CSSProperties | undefined;
133
- }) => JSX.Element;
134
- declare const CodeTextarea: (props: {
135
- children?: ReactNode;
136
- style?: React.CSSProperties | undefined;
137
- }) => JSX.Element;
138
- declare const CheckboxHidden: (props: {
139
- isChecked: boolean;
140
- } & {
141
- children?: ReactNode;
142
- style?: React.CSSProperties | undefined;
143
- }) => JSX.Element;
144
- declare const Checkbox: ({ label, checked, onChange }: {
145
- label: string;
146
- checked: boolean;
147
- onChange?: ((value: boolean) => void) | undefined;
148
- }) => React.DetailedReactHTMLElement<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>;
149
- declare function Bullet({ value }: {
150
- value: number;
151
- }): React.JSX.Element;
152
-
153
- export { A, Box, Bullet, Button, Checkbox, CheckboxHidden, CodeSnippet, CodeTextarea, Component, Container, Dropzone, HR, HeaderH1, HeaderH2, HeaderH3, HeaderH4, Inline, Input, Li, MainHeader, MoreExperiments, Range, SmallText, Space, Stack, Tab, Tabs, Text, Ul };
1
+ export * from './primitives.js';
2
+ export { space } from './spacing.js';
3
+ export { JBX } from './JBX.js';
4
+ export { Box } from './components/Layout.js';
5
+ export { MoreExperiments } from './components/MoreExperiments.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAEhC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC"}