jbx 2.9.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 (44) 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 -148
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +6 -2792
  25. package/dist/index.js.map +1 -0
  26. package/dist/main.css +2 -2
  27. package/dist/primitives.d.ts +139 -0
  28. package/dist/primitives.d.ts.map +1 -0
  29. package/dist/primitives.js +102 -0
  30. package/dist/primitives.js.map +1 -0
  31. package/dist/spacing.d.ts +22 -0
  32. package/dist/spacing.d.ts.map +1 -0
  33. package/dist/spacing.js +27 -0
  34. package/dist/spacing.js.map +1 -0
  35. package/package.json +45 -28
  36. package/src/JBX.tsx +24 -0
  37. package/src/classList.tsx +9 -0
  38. package/src/components/Layout.tsx +31 -0
  39. package/src/components/MoreExperiments.tsx +74 -0
  40. package/src/generated/css.ts +2 -0
  41. package/src/index.tsx +6 -0
  42. package/src/primitives.tsx +247 -0
  43. package/src/spacing.ts +43 -0
  44. package/src/style.css +369 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","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"}
package/dist/main.css CHANGED
@@ -356,8 +356,8 @@ a.jbx-a:hover::before,
356
356
  height: calc(var(--size) * 1.25);
357
357
  width: calc(var(--size) * 1.25);
358
358
  border-radius: 100%;
359
- top: -4px;
360
- margin-right: 4px;
359
+ top: -2px;
360
+ margin-right: 2px;
361
361
  }
362
362
 
363
363
  .jbx-hr {
@@ -0,0 +1,139 @@
1
+ import React, { ReactNode, CSSProperties } from 'react';
2
+ import { SpacingProps } from './spacing.js';
3
+ type DivProps = React.HTMLAttributes<HTMLDivElement>;
4
+ type ComponentConfig = {
5
+ /** Tag to render. Defaults to `div`. */
6
+ element?: string;
7
+ /** Extra props always passed to the element. */
8
+ props?: Record<string, unknown>;
9
+ /**
10
+ * Props the style function consumes. They are used to compute the style and
11
+ * then kept off the DOM, so `<Inline gap={1} />` doesn't emit `gap="1"`.
12
+ */
13
+ styleProps?: readonly string[];
14
+ };
15
+ type StyleSource<T> = CSSProperties | ((props: T) => CSSProperties);
16
+ export declare function Component<T>(className: string, styleSrc?: StyleSource<T>, config?: ComponentConfig): (props: T & {
17
+ children?: ReactNode;
18
+ style?: CSSProperties;
19
+ }) => React.JSX.Element;
20
+ export declare const Container: (props: DivProps & {
21
+ children?: ReactNode;
22
+ style?: CSSProperties;
23
+ }) => React.JSX.Element;
24
+ export declare const Text: (props: DivProps & {
25
+ children?: ReactNode;
26
+ style?: CSSProperties;
27
+ }) => React.JSX.Element;
28
+ export declare const SmallText: (props: DivProps & {
29
+ children?: ReactNode;
30
+ style?: CSSProperties;
31
+ }) => React.JSX.Element;
32
+ export declare const Button: (props: React.ButtonHTMLAttributes<HTMLButtonElement> & {
33
+ children?: ReactNode;
34
+ style?: CSSProperties;
35
+ }) => React.JSX.Element;
36
+ export declare const Input: (props: React.InputHTMLAttributes<HTMLInputElement> & {
37
+ children?: ReactNode;
38
+ style?: CSSProperties;
39
+ }) => React.JSX.Element;
40
+ export declare const Range: (props: React.InputHTMLAttributes<HTMLInputElement> & {
41
+ children?: ReactNode;
42
+ style?: CSSProperties;
43
+ }) => React.JSX.Element;
44
+ type HeadingProps = React.HTMLAttributes<HTMLHeadingElement>;
45
+ export declare const HeaderH1: (props: HeadingProps & {
46
+ children?: ReactNode;
47
+ style?: CSSProperties;
48
+ }) => React.JSX.Element;
49
+ export declare const HeaderH2: (props: HeadingProps & {
50
+ children?: ReactNode;
51
+ style?: CSSProperties;
52
+ }) => React.JSX.Element;
53
+ export declare const HeaderH3: (props: HeadingProps & {
54
+ children?: ReactNode;
55
+ style?: CSSProperties;
56
+ }) => React.JSX.Element;
57
+ export declare const HeaderH4: (props: HeadingProps & {
58
+ children?: ReactNode;
59
+ style?: CSSProperties;
60
+ }) => React.JSX.Element;
61
+ export declare const HR: (props: React.HTMLAttributes<HTMLHRElement> & {
62
+ children?: ReactNode;
63
+ style?: CSSProperties;
64
+ }) => React.JSX.Element;
65
+ export declare const MainHeader: (props: HeadingProps & {
66
+ children?: ReactNode;
67
+ style?: CSSProperties;
68
+ }) => React.JSX.Element;
69
+ export declare const A: (props: React.AnchorHTMLAttributes<HTMLAnchorElement> & {
70
+ href: string;
71
+ } & {
72
+ children?: ReactNode;
73
+ style?: CSSProperties;
74
+ }) => React.JSX.Element;
75
+ export declare const Space: (props: DivProps & {
76
+ inline?: boolean;
77
+ h?: number;
78
+ w?: number;
79
+ } & {
80
+ children?: ReactNode;
81
+ style?: CSSProperties;
82
+ }) => React.JSX.Element;
83
+ export declare const Inline: (props: DivProps & SpacingProps & {
84
+ wrap?: boolean;
85
+ } & {
86
+ children?: ReactNode;
87
+ style?: CSSProperties;
88
+ }) => React.JSX.Element;
89
+ export declare const Stack: (props: DivProps & SpacingProps & {
90
+ children?: ReactNode;
91
+ style?: CSSProperties;
92
+ }) => React.JSX.Element;
93
+ export declare const Dropzone: (props: DivProps & {
94
+ children?: ReactNode;
95
+ style?: CSSProperties;
96
+ }) => React.JSX.Element;
97
+ export declare const Ul: (props: React.HTMLAttributes<HTMLUListElement> & {
98
+ children?: ReactNode;
99
+ style?: CSSProperties;
100
+ }) => React.JSX.Element;
101
+ export declare const Li: (props: React.LiHTMLAttributes<HTMLLIElement> & {
102
+ children?: ReactNode;
103
+ style?: CSSProperties;
104
+ }) => React.JSX.Element;
105
+ export declare const Tabs: (props: DivProps & {
106
+ children?: ReactNode;
107
+ style?: CSSProperties;
108
+ }) => React.JSX.Element;
109
+ export declare const Tab: (props: DivProps & {
110
+ info?: boolean;
111
+ active?: boolean;
112
+ } & {
113
+ children?: ReactNode;
114
+ style?: CSSProperties;
115
+ }) => React.JSX.Element;
116
+ export declare const CodeSnippet: (props: React.HTMLAttributes<HTMLPreElement> & {
117
+ children?: ReactNode;
118
+ style?: CSSProperties;
119
+ }) => React.JSX.Element;
120
+ export declare const CodeTextarea: (props: React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
121
+ children?: ReactNode;
122
+ style?: CSSProperties;
123
+ }) => React.JSX.Element;
124
+ export declare const CheckboxHidden: (props: DivProps & {
125
+ isChecked?: boolean;
126
+ } & {
127
+ children?: ReactNode;
128
+ style?: CSSProperties;
129
+ }) => React.JSX.Element;
130
+ export declare function Checkbox({ label, checked, onChange }: {
131
+ label: string;
132
+ checked: boolean;
133
+ onChange?: (value: boolean) => void;
134
+ }): React.JSX.Element;
135
+ export declare function Bullet({ value }: {
136
+ value: number;
137
+ }): React.JSX.Element;
138
+ export {};
139
+ //# sourceMappingURL=primitives.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prim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from './spacing.js';
3
+ export function Component(className, styleSrc = {}, config = {}) {
4
+ const { element = `div`, props: otherProps, styleProps } = config;
5
+ return function MakeComponent({ children, style, ...props }) {
6
+ const calculatedStyle = typeof styleSrc === 'function' ? styleSrc(props) : styleSrc;
7
+ const elementProps = styleProps
8
+ ? Object.fromEntries(Object.entries(props).filter(([key]) => !styleProps.includes(key)))
9
+ : props;
10
+ return createElement(element, {
11
+ className,
12
+ // The caller's `style` wins over the computed one.
13
+ style: { ...calculatedStyle, ...style },
14
+ ...otherProps,
15
+ ...elementProps
16
+ }, children);
17
+ };
18
+ }
19
+ export const Container = Component(`jbx-container`);
20
+ export const Text = Component(`jbx-text`);
21
+ export const SmallText = Component(`jbx-small-text`);
22
+ export const Button = Component(`jbx-button`, {}, { element: 'button' });
23
+ export const Input = Component(`jbx-input`, {}, { element: 'input' });
24
+ export const Range = Component(`jbx-range`, {}, {
25
+ element: 'input',
26
+ props: {
27
+ type: 'range'
28
+ }
29
+ });
30
+ export const HeaderH1 = Component(`jbx-h${1}`, {}, { element: 'h1' });
31
+ export const HeaderH2 = Component(`jbx-h${2}`, {}, { element: 'h2' });
32
+ export const HeaderH3 = Component(`jbx-h${3}`, {}, { element: 'h3' });
33
+ export const HeaderH4 = Component(`jbx-h${4}`, {}, { element: 'h4' });
34
+ export const HR = Component(`jbx-hr`, {}, { element: 'hr' });
35
+ export const MainHeader = Component(`jbx-main-h1`, {}, { element: 'h1' });
36
+ export const A = Component(`jbx-a`, {}, { element: 'a' });
37
+ export const Space = Component(`jbx-space`, ({ inline, h, w }) => ({
38
+ display: inline ? 'inline-block' : 'block',
39
+ height: h === undefined ? undefined : space(h),
40
+ width: w === undefined ? undefined : space(w)
41
+ }), { styleProps: ['inline', 'h', 'w'] });
42
+ export const Inline = Component(`jbx-inline`, ({ wrap = true, ...spacing }) => ({
43
+ ...spacingPropsToStyle(spacing),
44
+ flexWrap: wrap ? 'wrap' : 'nowrap'
45
+ }), { styleProps: [...SPACING_PROPS, 'wrap'] });
46
+ export const Stack = Component(`jbx-stack`, (props) => spacingPropsToStyle(props), {
47
+ styleProps: SPACING_PROPS
48
+ });
49
+ export const Dropzone = Component(`jbx-dropzone`);
50
+ export const Ul = Component(`jbx-ul`, {
51
+ margin: 0,
52
+ padding: `0 0 0 ${space(0.25)}`
53
+ }, { element: 'ul' });
54
+ export const Li = Component(`jbx-li`, {
55
+ margin: `0 0 0 ${space(1)}`,
56
+ padding: `${space(0.25)} 0`
57
+ }, { element: 'li' });
58
+ export const Tabs = Component(`jbx-tabs`);
59
+ export const Tab = Component(`jbx-tabs--tab`, ({ info, active }) => ({
60
+ userSelect: 'none',
61
+ cursor: 'pointer',
62
+ backgroundColor: active ? '#000' : info ? '#fff' : '#ecf0f1',
63
+ color: active ? '#fff' : '#000',
64
+ padding: space(0.5),
65
+ paddingLeft: info ? 0 : space(0.5)
66
+ }), { styleProps: ['info', 'active'] });
67
+ export const CodeSnippet = Component(`jbx-code-snippet`, {}, { element: 'pre' });
68
+ export const CodeTextarea = Component(`jbx-code-area`, {}, { element: 'textarea' });
69
+ export const CheckboxHidden = Component(`jbx-checkbox-hidden`, ({ isChecked }) => ({
70
+ height: `calc(${space(2)} - 4px)`,
71
+ width: `calc(${space(2)} - 4px)`,
72
+ paddingTop: 2,
73
+ paddingLeft: 2,
74
+ backgroundColor: isChecked ? 'var(--accent-color)' : 'white',
75
+ borderRadius: BASE_RADIUS,
76
+ boxShadow: isChecked
77
+ ? 'inset rgba(0, 0, 0, 0.07) 0 0 0 1px'
78
+ : 'inset rgba(0, 0, 0, 0.33) 0 0 0 1.5px',
79
+ cursor: 'pointer'
80
+ }), { styleProps: ['isChecked'] });
81
+ export function Checkbox({ label, checked, onChange }) {
82
+ function toggle() {
83
+ if (onChange)
84
+ onChange(!checked);
85
+ }
86
+ return (React.createElement(Inline, { role: "checkbox", "aria-checked": checked, tabIndex: 0, onClick: toggle, onKeyDown: (event) => {
87
+ if (event.key === ' ' || event.key === 'Enter') {
88
+ event.preventDefault();
89
+ toggle();
90
+ }
91
+ }, style: { alignItems: 'center', cursor: 'pointer' } },
92
+ React.createElement(CheckboxHidden, { isChecked: checked },
93
+ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", className: "feather feather-check", viewBox: "0 0 24 24", color: checked ? 'white' : '#ddd', style: { height: `calc(${space(2)} - 8px)`, width: `calc(${space(2)} - 8px)` } },
94
+ React.createElement("path", { d: "M20 6L9 17 4 12" }))),
95
+ React.createElement(Space, { w: 0.5 }),
96
+ React.createElement(Text, { style: { userSelect: 'none' } }, label)));
97
+ }
98
+ export function Bullet({ value }) {
99
+ return (React.createElement("div", { className: "jbx-bullet-container" },
100
+ React.createElement("div", { className: "jbx-bullet" }, value)));
101
+ }
102
+ //# sourceMappingURL=primitives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitives.js","sourceRoot":"","sources":["../src/primitives.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAA4B,MAAM,OAAO,CAAC;AACvE,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AAkBpG,MAAM,UAAU,SAAS,CACvB,SAAiB,EACjB,WAA2B,EAAE,EAC7B,SAA0B,EAAE;IAE5B,MAAM,EAAE,OAAO,GAAG,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC;IAElE,OAAO,SAAS,aAAa,CAAC,EAC5B,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EAIT;QACC,MAAM,eAAe,GACnB,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAqB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAE9E,MAAM,YAAY,GAAG,UAAU;YAC7B,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,MAA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@ -0,0 +1,22 @@
1
+ import type { CSSProperties } from 'react';
2
+ /**
3
+ * One spacing unit, as a css value rather than a number, so javascript-driven
4
+ * spacing tracks the responsive `--size` variable in style.css the same way
5
+ * the stylesheet does.
6
+ */
7
+ export declare function space(n: number): string;
8
+ export declare const BASE_RADIUS = "calc(var(--size) / 3)";
9
+ export type SpacingProps = {
10
+ /** Vertical margin, in spacing units. */
11
+ v?: number;
12
+ /** Horizontal margin, in spacing units. */
13
+ h?: number;
14
+ /** Gap between children, in spacing units. */
15
+ gap?: number;
16
+ /** Padding, in spacing units. An array is joined like the css shorthand. */
17
+ padding?: number | number[];
18
+ };
19
+ /** Keys `spacingPropsToStyle` consumes, so they can be kept off the DOM. */
20
+ export declare const SPACING_PROPS: readonly ["v", "h", "gap", "padding"];
21
+ export declare function spacingPropsToStyle({ v, h, gap, padding }: SpacingProps): CSSProperties;
22
+ //# sourceMappingURL=spacing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spacing.d.ts","sourceRoot":"","sources":["../src/spacing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvC;AAED,eAAO,MAAM,WAAW,0BAA0B,CAAC;AAEnD,MAAM,MAAM,YAAY,GAAG;IACzB,yCAAyC;IACzC,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC7B,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,aAAa,uCAAwC,CAAC;AAEnE,wBAAgB,mBAAmB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,YAAY,GAAG,aAAa,CAevF"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * One spacing unit, as a css value rather than a number, so javascript-driven
3
+ * spacing tracks the responsive `--size` variable in style.css the same way
4
+ * the stylesheet does.
5
+ */
6
+ export function space(n) {
7
+ return `calc(var(--size) * ${n})`;
8
+ }
9
+ export const BASE_RADIUS = `calc(var(--size) / 3)`;
10
+ /** Keys `spacingPropsToStyle` consumes, so they can be kept off the DOM. */
11
+ export const SPACING_PROPS = ['v', 'h', 'gap', 'padding'];
12
+ export function spacingPropsToStyle({ v, h, gap, padding }) {
13
+ return {
14
+ marginLeft: h === undefined ? undefined : space(h),
15
+ marginRight: h === undefined ? undefined : space(h),
16
+ marginTop: v === undefined ? undefined : space(v),
17
+ marginBottom: v === undefined ? undefined : space(v),
18
+ gap: gap === undefined ? undefined : space(gap),
19
+ padding: padding === undefined
20
+ ? undefined
21
+ : [padding]
22
+ .flat()
23
+ .map((value) => space(value))
24
+ .join(' ')
25
+ };
26
+ }
27
+ //# sourceMappingURL=spacing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spacing.js","sourceRoot":"","sources":["../src/spacing.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,KAAK,CAAC,CAAS;IAC7B,OAAO,sBAAsB,CAAC,GAAG,CAAC;AACpC,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AAanD,4EAA4E;AAC5E,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,CAAU,CAAC;AAEnE,MAAM,UAAU,mBAAmB,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,EAAgB;IACtE,OAAO;QACL,UAAU,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QAClD,WAAW,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACnD,SAAS,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACjD,YAAY,EAAE,CAAC,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;QACpD,GAAG,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;QAC/C,OAAO,EACL,OAAO,KAAK,SAAS;YACnB,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,CAAC,OAAO,CAAC;iBACN,IAAI,EAAE;iBACN,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBAC5B,IAAI,CAAC,GAAG,CAAC;KACnB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,40 +1,57 @@
1
1
  {
2
2
  "name": "jbx",
3
- "version": "2.9.0",
3
+ "version": "2.11.0",
4
4
  "author": "hi@javier.xyz",
5
5
  "license": "Unlicensed",
6
- "main": "./dist/index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/javierbyte/jbx.git"
9
+ },
7
10
  "type": "module",
8
- "files": [
9
- "./dist/main.css",
10
- "./dist/index.d.ts",
11
- "./dist/index.js"
11
+ "sideEffects": [
12
+ "*.css"
12
13
  ],
14
+ "main": "./dist/index.js",
15
+ "module": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
13
17
  "exports": {
14
- "types": "./dist/index.d.ts",
15
- "module": "./dist/index.js"
18
+ ".": {
19
+ "types": "./dist/index.d.ts",
20
+ "default": "./dist/index.js"
21
+ },
22
+ "./main.css": "./dist/main.css",
23
+ "./dist/main.css": "./dist/main.css",
24
+ "./package.json": "./package.json"
16
25
  },
17
- "watch": {
18
- "build": {
19
- "patterns": [
20
- "src"
21
- ],
22
- "extensions": "tsx,ts,css",
23
- "quiet": false
24
- }
26
+ "files": [
27
+ "dist",
28
+ "src"
29
+ ],
30
+ "engines": {
31
+ "node": ">=18"
25
32
  },
26
- "devDependencies": {
27
- "@types/react": "^18.2.21",
28
- "bunchee": "^3.7.1",
29
- "react": "^18.2.0",
30
- "react-dom": "^18.2.0",
31
- "typescript": "^5.2.2"
33
+ "scripts": {
34
+ "css": "node ./scripts/build-css.mjs",
35
+ "prebuild": "npm run css",
36
+ "build": "tsc -p tsconfig.build.json",
37
+ "dev": "npm run css && tsc -p tsconfig.build.json --watch",
38
+ "pretypecheck": "npm run css",
39
+ "typecheck": "tsc --noEmit",
40
+ "pretest": "npm run build",
41
+ "test": "node ./scripts/smoke.mjs",
42
+ "prepublishOnly": "npm run typecheck && npm test"
32
43
  },
33
- "dependencies": {
34
- "npm-watch": "^0.11.0"
44
+ "peerDependencies": {
45
+ "react": "^17 || ^18 || ^19"
35
46
  },
36
- "scripts": {
37
- "build": "bunchee ./src/index.tsx && cp ./src/style.css ./dist/main.css",
38
- "watch": "npm-watch"
47
+ "devDependencies": {
48
+ "@types/react": "^19.2.18",
49
+ "@types/react-dom": "^19.2.3",
50
+ "react": "^19.2.8",
51
+ "react-dom": "^19.2.8",
52
+ "typescript": "^5.9.3"
53
+ },
54
+ "publishConfig": {
55
+ "access": "public"
39
56
  }
40
- }
57
+ }
package/src/JBX.tsx ADDED
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { CSS } from './generated/css.js';
3
+
4
+ type JBXProps = {
5
+ accent?: string;
6
+ };
7
+
8
+ /**
9
+ * Drops the JBX base stylesheet into the page, optionally setting the accent
10
+ * color. Use this when you don't want to wire up a css import:
11
+ *
12
+ * <JBX accent="#f1c40f" />
13
+ *
14
+ * The alternative is `import 'jbx/main.css'` plus your own `--accent-color`.
15
+ * Doing both is harmless — the rules are identical.
16
+ *
17
+ * No hooks and no dependencies, so it also renders inside a React server
18
+ * component.
19
+ */
20
+ export function JBX({ accent }: JBXProps) {
21
+ const css = accent ? `${CSS}\n:root {\n --accent-color: ${accent};\n}\n` : CSS;
22
+
23
+ return <style data-jbx="" dangerouslySetInnerHTML={{ __html: css }} />;
24
+ }
@@ -0,0 +1,9 @@
1
+ export function classList(classes: any[] | Record<string, any>) {
2
+ if (Array.isArray(classes)) {
3
+ return classes.filter((e) => e).join(' ');
4
+ } else {
5
+ return Object.keys(classes)
6
+ .filter((e) => classes[e])
7
+ .join(' ');
8
+ }
9
+ }
@@ -0,0 +1,31 @@
1
+ import React, { CSSProperties } from 'react';
2
+ import { spacingPropsToStyle, SpacingProps } from '../spacing.js';
3
+ import { classList } from '../classList.js';
4
+
5
+ type BoxProps = SpacingProps & {
6
+ children?: React.ReactNode;
7
+ smallText?: boolean;
8
+ flex?: number;
9
+ minWidth?: number | string;
10
+ style?: CSSProperties;
11
+ };
12
+
13
+ export function Box({ children, smallText, flex, minWidth, style, ...spacing }: BoxProps) {
14
+ const styles = {
15
+ flex,
16
+ minWidth,
17
+ ...spacingPropsToStyle(spacing),
18
+ ...style
19
+ };
20
+
21
+ const className = classList({
22
+ 'jbx-box': true,
23
+ 'jbx-small-text': smallText
24
+ });
25
+
26
+ return (
27
+ <div className={className} style={styles}>
28
+ {children}
29
+ </div>
30
+ );
31
+ }
@@ -0,0 +1,74 @@
1
+ import React, { Fragment } from 'react';
2
+ import { Text, Space, Ul, Li, A } from '../primitives.js';
3
+
4
+ const PROJECT_DATA = [
5
+ {
6
+ name: 'PINTR',
7
+ description: 'Tool that turns your images into plotter-like line drawings',
8
+ url: 'https://javier.xyz/pintr'
9
+ },
10
+ {
11
+ name: 'Visual Center',
12
+ description: 'Tool that help you visually center objects in a container',
13
+ url: 'https://javier.xyz/visual-center'
14
+ },
15
+ {
16
+ name: 'Brutalita',
17
+ description:
18
+ 'Grid based font editor and font. Create fonts in the browser and export OpenType files',
19
+ url: 'https://brutalita.com'
20
+ },
21
+ {
22
+ name: 'Morphin',
23
+ description:
24
+ 'Create animated CSS transitions. Add sprites and get the code ready to paste in your site',
25
+ url: 'https://javier.xyz/morphin'
26
+ },
27
+ {
28
+ name: 'Droste Creator',
29
+ description: 'Create recursive images with the droste effect',
30
+ url: 'https://javier.xyz/droste-creator'
31
+ },
32
+ {
33
+ name: 'Sombras.app',
34
+ description: 'Create art with shadows. Draw shadows and get 3D objects that project them.',
35
+ url: 'https://sombras.app'
36
+ },
37
+ {
38
+ name: 'Cohesive Colors',
39
+ description: 'Tool that can help you to create cohesive color palettes',
40
+ url: 'https://javier.xyz/cohesive-colors'
41
+ }
42
+ ] as const;
43
+
44
+ const seed = 0;
45
+ const maxItems = 5;
46
+
47
+ type MoreExperimentsProps = {
48
+ exclude?: string;
49
+ };
50
+
51
+ export function MoreExperiments({ exclude }: MoreExperimentsProps) {
52
+ const projects = exclude
53
+ ? PROJECT_DATA.filter((project) => !project.url.includes(exclude))
54
+ : PROJECT_DATA;
55
+
56
+ const items = new Array(Math.min(maxItems, projects.length)).fill('').map((_0, idx) => {
57
+ const project = projects[(seed + idx) % projects.length];
58
+ return (
59
+ <Li key={project.url}>
60
+ <A href={project.url}>{project.name}</A>
61
+ {`, `}
62
+ {project.description}.
63
+ </Li>
64
+ );
65
+ });
66
+
67
+ return (
68
+ <Fragment>
69
+ <Text>More experiments</Text>
70
+ <Space h={1} />
71
+ <Ul>{items}</Ul>
72
+ </Fragment>
73
+ );
74
+ }
@@ -0,0 +1,2 @@
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";
package/src/index.tsx ADDED
@@ -0,0 +1,6 @@
1
+ export * from './primitives.js';
2
+
3
+ export { space } from './spacing.js';
4
+ export { JBX } from './JBX.js';
5
+ export { Box } from './components/Layout.js';
6
+ export { MoreExperiments } from './components/MoreExperiments.js';