@lundal/zed-solid 0.0.3 → 0.0.5

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/Button.d.ts CHANGED
@@ -5,6 +5,6 @@ export type ButtonProps = {
5
5
  busy?: boolean;
6
6
  type: "primary" | "secondary" | "tertiary";
7
7
  label: string;
8
- onClick: () => void;
8
+ onClick: "submit" | (() => void);
9
9
  };
10
10
  export declare function Button(props: ButtonProps): JSX.Element;
@@ -1,9 +1,9 @@
1
1
  import { JSX } from "solid-js";
2
- export type AppProps = {
2
+ export type PageProps = {
3
3
  class?: string;
4
4
  style?: JSX.CSSProperties;
5
5
  layout: "3";
6
6
  theme: "light" | "dark";
7
7
  children: JSX.Element;
8
8
  };
9
- export declare function App(props: AppProps): JSX.Element;
9
+ export declare function Page(props: PageProps): JSX.Element;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from "./App.tsx";
2
1
  export * from "./Button.tsx";
3
2
  export * from "./Card.tsx";
4
3
  export * from "./CheckBox.tsx";
@@ -15,6 +14,7 @@ export * from "./Link.tsx";
15
14
  export * from "./Nav.tsx";
16
15
  export * from "./NavHeader.tsx";
17
16
  export * from "./NavLink.tsx";
17
+ export * from "./Page.tsx";
18
18
  export * from "./RadioButtons.tsx";
19
19
  export * from "./Row.tsx";
20
20
  export * from "./Select.tsx";
package/dist/index.js CHANGED
@@ -312,48 +312,33 @@ function mergeClasses(a, b) {
312
312
  return b;
313
313
  return void 0;
314
314
  }
315
- const _tmpl$$k = /* @__PURE__ */ template(`<div>`);
316
- function App(props) {
317
- return (() => {
318
- const _el$ = _tmpl$$k();
319
- insert(_el$, () => props.children);
320
- createRenderEffect((_p$) => {
321
- const _v$ = mergeClasses(`z-app z-app--layout-${props.layout} z-theme--${props.theme}`, props.class), _v$2 = props.style;
322
- _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
323
- _p$._v$2 = style(_el$, _v$2, _p$._v$2);
324
- return _p$;
325
- }, {
326
- _v$: void 0,
327
- _v$2: void 0
328
- });
329
- return _el$;
330
- })();
331
- }
332
- const _tmpl$$j = /* @__PURE__ */ template(`<button>`);
315
+ const _tmpl$$k = /* @__PURE__ */ template(`<button>`);
333
316
  function Button(props) {
334
317
  return (() => {
335
- const _el$ = _tmpl$$j();
336
- _el$.$$click = () => !props.busy && props.onClick();
318
+ const _el$ = _tmpl$$k();
319
+ _el$.$$click = () => props.onClick !== "submit" && !props.busy && props.onClick();
337
320
  insert(_el$, () => props.label);
338
321
  createRenderEffect((_p$) => {
339
- const _v$ = mergeClasses(`z-button z-button--${props.type}`, props.class), _v$2 = props.style, _v$3 = props.busy;
322
+ const _v$ = mergeClasses(`z-button z-button--${props.type}`, props.class), _v$2 = props.style, _v$3 = props.busy, _v$4 = props.onClick === "submit" ? "submit" : "button";
340
323
  _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
341
324
  _p$._v$2 = style(_el$, _v$2, _p$._v$2);
342
325
  _v$3 !== _p$._v$3 && setAttribute(_el$, "aria-busy", _p$._v$3 = _v$3);
326
+ _v$4 !== _p$._v$4 && setAttribute(_el$, "type", _p$._v$4 = _v$4);
343
327
  return _p$;
344
328
  }, {
345
329
  _v$: void 0,
346
330
  _v$2: void 0,
347
- _v$3: void 0
331
+ _v$3: void 0,
332
+ _v$4: void 0
348
333
  });
349
334
  return _el$;
350
335
  })();
351
336
  }
352
337
  delegateEvents(["click"]);
353
- const _tmpl$$i = /* @__PURE__ */ template(`<div>`);
338
+ const _tmpl$$j = /* @__PURE__ */ template(`<div>`);
354
339
  function Card(props) {
355
340
  return (() => {
356
- const _el$ = _tmpl$$i();
341
+ const _el$ = _tmpl$$j();
357
342
  insert(_el$, () => props.children);
358
343
  createRenderEffect((_p$) => {
359
344
  const _v$ = mergeClasses("z-card", props.class), _v$2 = props.style;
@@ -367,10 +352,10 @@ function Card(props) {
367
352
  return _el$;
368
353
  })();
369
354
  }
370
- const _tmpl$$h = /* @__PURE__ */ template(`<div><input type="checkbox"><label>`);
355
+ const _tmpl$$i = /* @__PURE__ */ template(`<div><input type="checkbox"><label>`);
371
356
  function CheckBox(props) {
372
357
  return (() => {
373
- const _el$ = _tmpl$$h(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
358
+ const _el$ = _tmpl$$i(), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
374
359
  _el$2.addEventListener("change", () => props.onChange(!props.value));
375
360
  insert(_el$3, () => props.label);
376
361
  createRenderEffect((_p$) => {
@@ -394,10 +379,10 @@ function CheckBox(props) {
394
379
  return _el$;
395
380
  })();
396
381
  }
397
- const _tmpl$$g = /* @__PURE__ */ template(`<fieldset><legend>`), _tmpl$2$5 = /* @__PURE__ */ template(`<div class="z-checkbox"><input type="checkbox"><label>`), _tmpl$3$3 = /* @__PURE__ */ template(`<div class="z-error">`), _tmpl$4$2 = /* @__PURE__ */ template(`<div class="z-error-placeholder">`);
382
+ const _tmpl$$h = /* @__PURE__ */ template(`<fieldset><legend>`), _tmpl$2$5 = /* @__PURE__ */ template(`<div class="z-checkbox"><input type="checkbox"><label>`), _tmpl$3$3 = /* @__PURE__ */ template(`<div class="z-error">`), _tmpl$4$2 = /* @__PURE__ */ template(`<div class="z-error-placeholder">`);
398
383
  function CheckBoxes(props) {
399
384
  return (() => {
400
- const _el$ = _tmpl$$g(), _el$2 = _el$.firstChild;
385
+ const _el$ = _tmpl$$h(), _el$2 = _el$.firstChild;
401
386
  insert(_el$2, () => props.label);
402
387
  insert(_el$, createComponent(For, {
403
388
  get each() {
@@ -449,10 +434,10 @@ function CheckBoxes(props) {
449
434
  return _el$;
450
435
  })();
451
436
  }
452
- const _tmpl$$f = /* @__PURE__ */ template(`<div>`);
437
+ const _tmpl$$g = /* @__PURE__ */ template(`<div>`);
453
438
  function Column(props) {
454
439
  return (() => {
455
- const _el$ = _tmpl$$f();
440
+ const _el$ = _tmpl$$g();
456
441
  insert(_el$, () => props.children);
457
442
  createRenderEffect((_p$) => {
458
443
  const _v$ = mergeClasses("z-column", props.class), _v$2 = props.style;
@@ -466,7 +451,7 @@ function Column(props) {
466
451
  return _el$;
467
452
  })();
468
453
  }
469
- const _tmpl$$e = /* @__PURE__ */ template(`<dialog>`);
454
+ const _tmpl$$f = /* @__PURE__ */ template(`<dialog>`);
470
455
  function Dialog(props) {
471
456
  const [wasOutside, setWasOutside] = createSignal(false);
472
457
  function isOutside(e) {
@@ -486,7 +471,7 @@ function Dialog(props) {
486
471
  }, 100);
487
472
  }
488
473
  return (() => {
489
- const _el$ = _tmpl$$e();
474
+ const _el$ = _tmpl$$f();
490
475
  _el$.$$click = (e) => {
491
476
  if (wasOutside() && isOutside(e)) {
492
477
  e.preventDefault();
@@ -516,10 +501,10 @@ function Dialog(props) {
516
501
  })();
517
502
  }
518
503
  delegateEvents(["mousedown", "click"]);
519
- const _tmpl$$d = /* @__PURE__ */ template(`<div>`), _tmpl$2$4 = /* @__PURE__ */ template(`<label>`), _tmpl$3$2 = /* @__PURE__ */ template(`<div class="z-error">`), _tmpl$4$1 = /* @__PURE__ */ template(`<div class="z-error-placeholder">`);
504
+ const _tmpl$$e = /* @__PURE__ */ template(`<div>`), _tmpl$2$4 = /* @__PURE__ */ template(`<label>`), _tmpl$3$2 = /* @__PURE__ */ template(`<div class="z-error">`), _tmpl$4$1 = /* @__PURE__ */ template(`<div class="z-error-placeholder">`);
520
505
  function Field(props) {
521
506
  return (() => {
522
- const _el$ = _tmpl$$d();
507
+ const _el$ = _tmpl$$e();
523
508
  insert(_el$, (() => {
524
509
  const _c$ = createMemo(() => !!props.label);
525
510
  return () => _c$() && (() => {
@@ -559,10 +544,10 @@ function Field(props) {
559
544
  return _el$;
560
545
  })();
561
546
  }
562
- const _tmpl$$c = /* @__PURE__ */ template(`<div>`);
547
+ const _tmpl$$d = /* @__PURE__ */ template(`<form>`);
563
548
  function Form(props) {
564
549
  return (() => {
565
- const _el$ = _tmpl$$c();
550
+ const _el$ = _tmpl$$d();
566
551
  _el$.addEventListener("submit", (event) => {
567
552
  event.preventDefault();
568
553
  props.onSubmit();
@@ -580,10 +565,10 @@ function Form(props) {
580
565
  return _el$;
581
566
  })();
582
567
  }
583
- const _tmpl$$b = /* @__PURE__ */ template(`<header><a class="z-header--app" href="/"><span></span></a><div class="z-header--buttons">`);
568
+ const _tmpl$$c = /* @__PURE__ */ template(`<header><a class="z-header--app" href="/"><span></span></a><div class="z-header--buttons">`);
584
569
  function Header(props) {
585
570
  return (() => {
586
- const _el$ = _tmpl$$b(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
571
+ const _el$ = _tmpl$$c(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$2.nextSibling;
587
572
  insert(_el$2, () => props.appIcon, _el$3);
588
573
  insert(_el$3, () => props.appName);
589
574
  insert(_el$4, () => props.children);
@@ -599,10 +584,10 @@ function Header(props) {
599
584
  return _el$;
600
585
  })();
601
586
  }
602
- const _tmpl$$a = /* @__PURE__ */ template(`<h1>`), _tmpl$2$3 = /* @__PURE__ */ template(`<h2>`), _tmpl$3$1 = /* @__PURE__ */ template(`<h3>`);
587
+ const _tmpl$$b = /* @__PURE__ */ template(`<h1>`), _tmpl$2$3 = /* @__PURE__ */ template(`<h2>`), _tmpl$3$1 = /* @__PURE__ */ template(`<h3>`);
603
588
  function H1(props) {
604
589
  return (() => {
605
- const _el$ = _tmpl$$a();
590
+ const _el$ = _tmpl$$b();
606
591
  insert(_el$, () => props.children);
607
592
  createRenderEffect((_p$) => {
608
593
  const _v$ = mergeClasses("z-" + (props.lookLike ?? "h1"), props.class), _v$2 = props.style;
@@ -648,7 +633,7 @@ function H3(props) {
648
633
  return _el$3;
649
634
  })();
650
635
  }
651
- const _tmpl$$9 = /* @__PURE__ */ template(`<svg>`), _tmpl$2$2 = /* @__PURE__ */ template(`<svg><path fill="currentColor"></svg>`, false, true);
636
+ const _tmpl$$a = /* @__PURE__ */ template(`<svg>`), _tmpl$2$2 = /* @__PURE__ */ template(`<svg><path fill="currentColor"></svg>`, false, true);
652
637
  function Icon(props) {
653
638
  const data = createMemo(() => {
654
639
  const [width, height, , , paths] = props.definition.icon;
@@ -659,7 +644,7 @@ function Icon(props) {
659
644
  };
660
645
  });
661
646
  return (() => {
662
- const _el$ = _tmpl$$9();
647
+ const _el$ = _tmpl$$a();
663
648
  insert(_el$, createComponent(For, {
664
649
  get each() {
665
650
  return data().paths;
@@ -684,10 +669,10 @@ function Icon(props) {
684
669
  return _el$;
685
670
  })();
686
671
  }
687
- const _tmpl$$8 = /* @__PURE__ */ template(`<button>`);
672
+ const _tmpl$$9 = /* @__PURE__ */ template(`<button>`);
688
673
  function IconButton(props) {
689
674
  return (() => {
690
- const _el$ = _tmpl$$8();
675
+ const _el$ = _tmpl$$9();
691
676
  _el$.$$click = () => !props.busy && props.onClick();
692
677
  insert(_el$, () => props.icon);
693
678
  createRenderEffect((_p$) => {
@@ -728,10 +713,10 @@ function Link(props) {
728
713
  }
729
714
  });
730
715
  }
731
- const _tmpl$$7 = /* @__PURE__ */ template(`<nav>`);
716
+ const _tmpl$$8 = /* @__PURE__ */ template(`<nav>`);
732
717
  function Nav(props) {
733
718
  return (() => {
734
- const _el$ = _tmpl$$7();
719
+ const _el$ = _tmpl$$8();
735
720
  insert(_el$, () => props.children);
736
721
  createRenderEffect((_p$) => {
737
722
  const _v$ = mergeClasses("z-nav", props.class), _v$2 = props.style;
@@ -745,10 +730,10 @@ function Nav(props) {
745
730
  return _el$;
746
731
  })();
747
732
  }
748
- const _tmpl$$6 = /* @__PURE__ */ template(`<div>`);
733
+ const _tmpl$$7 = /* @__PURE__ */ template(`<div>`);
749
734
  function NavHeader(props) {
750
735
  return (() => {
751
- const _el$ = _tmpl$$6();
736
+ const _el$ = _tmpl$$7();
752
737
  insert(_el$, () => props.children);
753
738
  createRenderEffect((_p$) => {
754
739
  const _v$ = mergeClasses("z-nav--header", props.class), _v$2 = props.style;
@@ -762,7 +747,7 @@ function NavHeader(props) {
762
747
  return _el$;
763
748
  })();
764
749
  }
765
- const _tmpl$$5 = /* @__PURE__ */ template(`<span>`);
750
+ const _tmpl$$6 = /* @__PURE__ */ template(`<span>`);
766
751
  function NavLink(props) {
767
752
  return createComponent(A, {
768
753
  get ["class"]() {
@@ -779,13 +764,30 @@ function NavLink(props) {
779
764
  end: true,
780
765
  get children() {
781
766
  return [createMemo(() => props.icon), (() => {
782
- const _el$ = _tmpl$$5();
767
+ const _el$ = _tmpl$$6();
783
768
  insert(_el$, () => props.text);
784
769
  return _el$;
785
770
  })()];
786
771
  }
787
772
  });
788
773
  }
774
+ const _tmpl$$5 = /* @__PURE__ */ template(`<div>`);
775
+ function Page(props) {
776
+ return (() => {
777
+ const _el$ = _tmpl$$5();
778
+ insert(_el$, () => props.children);
779
+ createRenderEffect((_p$) => {
780
+ const _v$ = mergeClasses(`z-page z-page--layout-${props.layout} z-theme--${props.theme}`, props.class), _v$2 = props.style;
781
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
782
+ _p$._v$2 = style(_el$, _v$2, _p$._v$2);
783
+ return _p$;
784
+ }, {
785
+ _v$: void 0,
786
+ _v$2: void 0
787
+ });
788
+ return _el$;
789
+ })();
790
+ }
789
791
  const _tmpl$$4 = /* @__PURE__ */ template(`<fieldset><legend>`), _tmpl$2$1 = /* @__PURE__ */ template(`<div class="z-radiobutton"><input type="radio"><label>`), _tmpl$3 = /* @__PURE__ */ template(`<div class="z-error">`), _tmpl$4 = /* @__PURE__ */ template(`<div class="z-error-placeholder">`);
790
792
  function RadioButtons(props) {
791
793
  return (() => {
@@ -942,7 +944,6 @@ function TextBox(props) {
942
944
  }
943
945
  delegateEvents(["input"]);
944
946
  export {
945
- App,
946
947
  Button,
947
948
  Card,
948
949
  CheckBox,
@@ -961,6 +962,7 @@ export {
961
962
  Nav,
962
963
  NavHeader,
963
964
  NavLink,
965
+ Page,
964
966
  RadioButtons,
965
967
  Row,
966
968
  Select,
package/dist/style.css CHANGED
@@ -19,42 +19,6 @@
19
19
  *::-moz-focus-inner {
20
20
  border: none;
21
21
  }
22
- .z-app {
23
- width: 100vw;
24
- height: 100vh;
25
-
26
- background: var(--z-background);
27
- color: var(--z-text-body);
28
-
29
- font-family: "Inter", sans-serif;
30
- font-size: 16px;
31
- font-weight: 400;
32
- }
33
-
34
- .z-app > * {
35
- overflow: auto;
36
- }
37
-
38
- .z-app--layout-3 {
39
- display: grid;
40
- grid-template-rows: auto 1fr;
41
- grid-template-columns: auto 1fr;
42
- grid-template-areas: "header header" "nav main";
43
- }
44
-
45
- .z-app--layout-3 > header {
46
- grid-area: header;
47
- border-bottom: 1px solid var(--z-border);
48
- }
49
-
50
- .z-app--layout-3 > nav {
51
- grid-area: nav;
52
- border-right: 1px solid var(--z-border);
53
- }
54
-
55
- .z-app--layout-3 > main {
56
- grid-area: main;
57
- }
58
22
  .z-button {
59
23
  height: 36px;
60
24
  padding: 6px 24px;
@@ -381,6 +345,47 @@ dialog:focus-visible {
381
345
  .z-nav--link:focus-visible {
382
346
  outline-color: var(--z-focus);
383
347
  }
348
+ .z-page {
349
+ width: 100vw;
350
+ height: 100vh;
351
+
352
+ background: var(--z-background);
353
+ color: var(--z-text-body);
354
+
355
+ font-family: "Inter", sans-serif;
356
+ font-size: 16px;
357
+ font-weight: 400;
358
+ }
359
+
360
+ .z-page > * {
361
+ overflow: auto;
362
+ }
363
+
364
+ .z-page--layout-3 {
365
+ display: grid;
366
+ grid-template-rows: auto 1fr;
367
+ grid-template-columns: auto 1fr auto;
368
+ grid-template-areas: "header header header" "nav main aside";
369
+ }
370
+
371
+ .z-page--layout-3 > header {
372
+ grid-area: header;
373
+ border-bottom: 1px solid var(--z-border);
374
+ }
375
+
376
+ .z-page--layout-3 > nav {
377
+ grid-area: nav;
378
+ border-right: 1px solid var(--z-border);
379
+ }
380
+
381
+ .z-page--layout-3 > main {
382
+ grid-area: main;
383
+ }
384
+
385
+ .z-page--layout-3 > aside {
386
+ grid-area: aside;
387
+ border-left: 1px solid var(--z-border);
388
+ }
384
389
  .z-radiobutton {
385
390
  display: flex;
386
391
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lundal/zed-solid",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "license": "LGPL-3.0-or-later",
5
5
  "type": "module",
6
6
  "module": "dist/index.js",