@k2b/ui 0.65.0 → 0.66.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 (106) hide show
  1. package/README.md +47 -0
  2. package/dist/browser/v2/button.js +180 -0
  3. package/dist/browser/v2/button.js.map +1 -0
  4. package/dist/browser/v2/components.js +763 -0
  5. package/dist/browser/v2/components.js.map +1 -0
  6. package/dist/browser/v2/content.js +1107 -0
  7. package/dist/browser/v2/content.js.map +1 -0
  8. package/dist/browser/v2/controls.js +568 -0
  9. package/dist/browser/v2/controls.js.map +1 -0
  10. package/dist/browser/v2/describe.js +397 -0
  11. package/dist/browser/v2/describe.js.map +1 -0
  12. package/dist/browser/v2/index.js +25 -0
  13. package/dist/browser/v2/index.js.map +1 -0
  14. package/dist/browser/v2/layout.js +578 -0
  15. package/dist/browser/v2/layout.js.map +1 -0
  16. package/dist/browser/v2/link.js +9 -0
  17. package/dist/browser/v2/link.js.map +1 -0
  18. package/dist/browser/v2/marks.js +211 -0
  19. package/dist/browser/v2/marks.js.map +1 -0
  20. package/dist/browser/v2/states.js +180 -0
  21. package/dist/browser/v2/states.js.map +1 -0
  22. package/dist/browser/v2/structure.js +328 -0
  23. package/dist/browser/v2/structure.js.map +1 -0
  24. package/dist/browser/v2/testing/index.js +23 -0
  25. package/dist/browser/v2/testing/index.js.map +1 -0
  26. package/dist/browser/v2/testing/measure-v2-layout.js +762 -0
  27. package/dist/browser/v2/testing/measure-v2-layout.js.map +1 -0
  28. package/dist/browser/v2/testing/settled.js +52 -0
  29. package/dist/browser/v2/testing/settled.js.map +1 -0
  30. package/dist/browser/v2/tokens.js +83 -0
  31. package/dist/browser/v2/tokens.js.map +1 -0
  32. package/dist/browser/v2/types.js +24 -0
  33. package/dist/browser/v2/types.js.map +1 -0
  34. package/dist/ssr/v2/button.js +177 -0
  35. package/dist/ssr/v2/button.js.map +1 -0
  36. package/dist/ssr/v2/components.js +518 -0
  37. package/dist/ssr/v2/components.js.map +1 -0
  38. package/dist/ssr/v2/content.js +727 -0
  39. package/dist/ssr/v2/content.js.map +1 -0
  40. package/dist/ssr/v2/controls.js +268 -0
  41. package/dist/ssr/v2/controls.js.map +1 -0
  42. package/dist/ssr/v2/describe.js +397 -0
  43. package/dist/ssr/v2/describe.js.map +1 -0
  44. package/dist/ssr/v2/index.js +25 -0
  45. package/dist/ssr/v2/index.js.map +1 -0
  46. package/dist/ssr/v2/layout.js +377 -0
  47. package/dist/ssr/v2/layout.js.map +1 -0
  48. package/dist/ssr/v2/link.js +9 -0
  49. package/dist/ssr/v2/link.js.map +1 -0
  50. package/dist/ssr/v2/marks.js +126 -0
  51. package/dist/ssr/v2/marks.js.map +1 -0
  52. package/dist/ssr/v2/states.js +128 -0
  53. package/dist/ssr/v2/states.js.map +1 -0
  54. package/dist/ssr/v2/structure.js +229 -0
  55. package/dist/ssr/v2/structure.js.map +1 -0
  56. package/dist/ssr/v2/testing/index.js +23 -0
  57. package/dist/ssr/v2/testing/index.js.map +1 -0
  58. package/dist/ssr/v2/testing/measure-v2-layout.js +762 -0
  59. package/dist/ssr/v2/testing/measure-v2-layout.js.map +1 -0
  60. package/dist/ssr/v2/testing/settled.js +52 -0
  61. package/dist/ssr/v2/testing/settled.js.map +1 -0
  62. package/dist/ssr/v2/tokens.js +83 -0
  63. package/dist/ssr/v2/tokens.js.map +1 -0
  64. package/dist/ssr/v2/types.js +24 -0
  65. package/dist/ssr/v2/types.js.map +1 -0
  66. package/dist/types/v2/button.d.ts +54 -0
  67. package/dist/types/v2/components.d.ts +173 -0
  68. package/dist/types/v2/content.d.ts +233 -0
  69. package/dist/types/v2/controls.d.ts +118 -0
  70. package/dist/types/v2/describe.d.ts +18 -0
  71. package/dist/types/v2/index.d.ts +22 -0
  72. package/dist/types/v2/layout.d.ts +124 -0
  73. package/dist/types/v2/link.d.ts +7 -0
  74. package/dist/types/v2/marks.d.ts +90 -0
  75. package/dist/types/v2/states.d.ts +45 -0
  76. package/dist/types/v2/structure.d.ts +47 -0
  77. package/dist/types/v2/testing/index.d.ts +16 -0
  78. package/dist/types/v2/testing/measure-v2-layout.d.ts +99 -0
  79. package/dist/types/v2/testing/settled.d.ts +13 -0
  80. package/dist/types/v2/tokens.d.ts +77 -0
  81. package/dist/types/v2/types.d.ts +44 -0
  82. package/dist/v2.css +3072 -0
  83. package/package.json +23 -4
  84. package/skills/k2b-ui/SKILL.md +201 -0
  85. package/skills/k2b-ui/images/form-1440.png +0 -0
  86. package/skills/k2b-ui/images/form-390.png +0 -0
  87. package/skills/k2b-ui/images/list-detail-1440.png +0 -0
  88. package/skills/k2b-ui/images/list-detail-390.png +0 -0
  89. package/skills/k2b-ui/images/mail-1440.png +0 -0
  90. package/skills/k2b-ui/images/mail-390.png +0 -0
  91. package/skills/k2b-ui/images/record-1440.png +0 -0
  92. package/skills/k2b-ui/images/record-390.png +0 -0
  93. package/skills/k2b-ui/images/record-groups-1440.png +0 -0
  94. package/skills/k2b-ui/images/record-groups-390.png +0 -0
  95. package/skills/k2b-ui/images/table-1440.png +0 -0
  96. package/skills/k2b-ui/images/table-390.png +0 -0
  97. package/skills/k2b-ui/recipes/form.tsx +54 -0
  98. package/skills/k2b-ui/recipes/list-detail.tsx +105 -0
  99. package/skills/k2b-ui/recipes/mail.tsx +193 -0
  100. package/skills/k2b-ui/recipes/record-groups.tsx +115 -0
  101. package/skills/k2b-ui/recipes/record.tsx +163 -0
  102. package/skills/k2b-ui/recipes/table.tsx +68 -0
  103. package/skills/k2b-ui/references/mistakes.md +162 -0
  104. package/skills/k2b-ui/references/primitives.md +310 -0
  105. package/skills/k2b-ui/references/recipes.md +101 -0
  106. package/skills/k2b-ui/references/seeing.md +94 -0
@@ -0,0 +1,128 @@
1
+ import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
2
+ import { memo as _$memo } from "solid-js/web";
3
+ import { ssr as _$ssr } from "solid-js/web";
4
+ import { escape as _$escape } from "solid-js/web";
5
+ import { createComponent as _$createComponent } from "solid-js/web";
6
+ var _tmpl$ = ["<div class=\"k2-state\" data-k2-part=\"Empty\"><span class=\"k2-sign\">", "</span><span class=\"k2-state-text\">", "</span>", "</div>"],
7
+ _tmpl$2 = ["<div class=\"k2-state\" data-k2-part=\"Failed\" role=\"alert\"><span class=\"k2-sign\" data-tone=\"bad\">", "</span><span class=\"k2-state-text\">", "</span>", "</div>"],
8
+ _tmpl$3 = ["<div class=\"k2-list k2-loading\" data-k2-part=\"Loading\">", "", "</div>"],
9
+ _tmpl$4 = ["<span class=\"k2-hidden-text\" role=\"status\">", "</span>"],
10
+ _tmpl$5 = ["<div class=\"k2-row\"", " aria-hidden=\"true\"><span class=\"k2-row-lead\"></span>", "</div>"],
11
+ _tmpl$6 = ["<span", "><span class=\"k2-skel\"></span></span>"];
12
+ import { For, Index, Show } from "solid-js";
13
+ import { useUiMessages } from "../intl/messages";
14
+ import { ActionButton, Button } from "./button";
15
+ import { Icon } from "./marks";
16
+
17
+ // The three states every place that shows data has, in the place where the data will stand (design guide "Zustände"):
18
+ // empty, loading and failed. None draws a box; each stands where the list, the table or the content would stand, so
19
+ // the head and the status row above it never move.
20
+
21
+ /** Nothing here: a round sign, one sentence, one way out, without a box (mockup: Notice · Empty). */
22
+ export const Empty = props => _$ssr(_tmpl$, _$escape(_$createComponent(Icon, {
23
+ get name() {
24
+ return props.icon;
25
+ }
26
+ })), _$escape(props.text), _$escape(_$createComponent(Show, {
27
+ get when() {
28
+ return props.action;
29
+ },
30
+ children: action => _$createComponent(ActionButton, {
31
+ get action() {
32
+ return action();
33
+ }
34
+ })
35
+ })));
36
+ /**
37
+ * Loading failed: the shape of `Empty` with a sign in the tone of wrong, the sentence, and "Erneut versuchen". It
38
+ * replaces only the data; the selection and the view around it stay. (A connection that retries on its own shows in
39
+ * the status row instead, without a button; something a person must fix is a `Notice` that names the deed.)
40
+ */
41
+ export const Failed = props => {
42
+ const t = useUiMessages();
43
+ let root;
44
+ return _$ssr(_tmpl$2, _$escape(_$createComponent(Icon, {
45
+ name: "alert-circle"
46
+ })), _$escape(props.text), _$escape(_$createComponent(Button, {
47
+ icon: "refresh",
48
+ onClick: () => {
49
+ // the focus is on the button, which leaves with this state: it goes on to what comes in its place
50
+ if (root?.contains(document.activeElement)) focusWhatComes(root);
51
+ props.onRetry();
52
+ },
53
+ get children() {
54
+ return t().retry;
55
+ }
56
+ })));
57
+ };
58
+ const focusable = "a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]";
59
+
60
+ /**
61
+ * Gives the focus to the first visible thing that can take it among what replaces `state` in its place, such as the
62
+ * first row of the list that loaded. It waits while placeholders stand there, and stops once it has placed the
63
+ * focus, once the person focuses something themselves, or once the content has come without anything to focus.
64
+ */
65
+ const focusWhatComes = state => {
66
+ const place = state.parentElement;
67
+ if (!place || typeof MutationObserver === "undefined") return;
68
+ const before = state.previousSibling;
69
+ const after = state.nextSibling;
70
+ const follows = (node, anchor) => !anchor?.isConnected || !!(anchor.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_FOLLOWING);
71
+ const precedes = (node, anchor) => !anchor?.isConnected || !!(anchor.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_PRECEDING);
72
+ const inPlace = node => follows(node, before) && precedes(node, after) && !state.contains(node);
73
+ const stop = () => {
74
+ observer.disconnect();
75
+ document.removeEventListener("focusin", stop);
76
+ };
77
+ const settle = () => {
78
+ const target = [...place.querySelectorAll(focusable)].find(element => inPlace(element) && element.tabIndex >= 0 && element.getClientRects().length > 0);
79
+ if (target) {
80
+ stop();
81
+ target.focus();
82
+ return;
83
+ }
84
+ const waiting = [...place.querySelectorAll('[data-k2-part="Loading"], [aria-busy="true"]')].some(inPlace);
85
+ if (!state.isConnected && !waiting) stop();
86
+ };
87
+ const observer = new MutationObserver(settle);
88
+ observer.observe(place, {
89
+ childList: true,
90
+ subtree: true
91
+ });
92
+ document.addEventListener("focusin", stop);
93
+ };
94
+ /**
95
+ * Loading: square placeholders in the heights of the real rows, so nothing moves when the data arrives. It stands
96
+ * where the `List` will stand; a `Table` takes `loading` itself and keeps its head. Assistive technology hears
97
+ * "Wird geladen…" (in the language of the page) from a status line; the placeholders themselves are hidden from it.
98
+ */
99
+ export const Loading = props => _$ssr(_tmpl$3, _$escape(_$createComponent(LoadingStatus, {})), _$escape(_$createComponent(PlaceholderRows, {
100
+ get rows() {
101
+ return props.rows ?? 3;
102
+ },
103
+ get lines() {
104
+ return props.lines ?? 1;
105
+ }
106
+ })));
107
+
108
+ /** The words "loading" for assistive technology only (internal: `Loading` and a loading `Table`). */
109
+ export const LoadingStatus = () => {
110
+ const t = useUiMessages();
111
+ return _$ssr(_tmpl$4, _$escape(t().loading));
112
+ };
113
+
114
+ /** Rows of placeholders in the shape of `Row` (internal: `Loading` and the phone list of a loading `Table`). */
115
+ export const PlaceholderRows = props => _$createComponent(Index, {
116
+ get each() {
117
+ return Array.from({
118
+ length: Math.max(0, props.rows)
119
+ });
120
+ },
121
+ children: () => _$ssr(_tmpl$5, _$ssrAttribute("data-lines", _$escape(String(props.lines), true), false), _$escape(_$createComponent(For, {
122
+ get each() {
123
+ return ["k2-row-l1", "k2-row-l2", "k2-row-l3"].slice(0, props.lines);
124
+ },
125
+ children: line => _$ssr(_tmpl$6, _$ssrAttribute("class", _$escape(line, true), false))
126
+ })))
127
+ });
128
+ //# sourceMappingURL=states.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["v2/states.tsx"],"sourcesContent":["import { For, Index, Show } from \"solid-js\";\nimport { useUiMessages } from \"../intl/messages\";\nimport { ActionButton, Button } from \"./button\";\nimport { Icon } from \"./marks\";\nimport type { Action } from \"./types\";\n\n// The three states every place that shows data has, in the place where the data will stand (design guide \"Zustände\"):\n// empty, loading and failed. None draws a box; each stands where the list, the table or the content would stand, so\n// the head and the status row above it never move.\n\nexport type EmptyProps = {\n /** A Tabler icon for the round sign, such as `inbox`. */\n icon: string;\n /** One sentence that says what is the matter: \"Noch keine Einlieferung.\" is not \"Keine Treffer mit diesem Filter.\" */\n text: string;\n /** The one way out, such as \"Einlieferung erfassen\" or \"Filter zurücksetzen\". */\n action?: Action;\n};\n\n/** Nothing here: a round sign, one sentence, one way out, without a box (mockup: Notice · Empty). */\nexport const Empty = (props: EmptyProps) => (\n <div class=\"k2-state\" data-k2-part=\"Empty\">\n <span class=\"k2-sign\">\n <Icon name={props.icon} />\n </span>\n <span class=\"k2-state-text\">{props.text}</span>\n <Show when={props.action}>{(action) => <ActionButton action={action()} />}</Show>\n </div>\n);\n\nexport type FailedProps = {\n /**\n * What could not be loaded and what stays as it is, such as \"Unterhaltungen konnten nicht geladen werden. Deine\n * Ansicht und Auswahl bleiben erhalten.\"\n */\n text: string;\n /** Loads again; the button says \"Erneut versuchen\" in the language of the page. */\n onRetry: () => void;\n};\n\n/**\n * Loading failed: the shape of `Empty` with a sign in the tone of wrong, the sentence, and \"Erneut versuchen\". It\n * replaces only the data; the selection and the view around it stay. (A connection that retries on its own shows in\n * the status row instead, without a button; something a person must fix is a `Notice` that names the deed.)\n */\nexport const Failed = (props: FailedProps) => {\n const t = useUiMessages();\n let root: HTMLDivElement | undefined;\n return (\n <div ref={root} class=\"k2-state\" data-k2-part=\"Failed\" role=\"alert\">\n <span class=\"k2-sign\" data-tone=\"bad\">\n <Icon name=\"alert-circle\" />\n </span>\n <span class=\"k2-state-text\">{props.text}</span>\n <Button\n icon=\"refresh\"\n onClick={() => {\n // the focus is on the button, which leaves with this state: it goes on to what comes in its place\n if (root?.contains(document.activeElement)) focusWhatComes(root);\n props.onRetry();\n }}\n >\n {t().retry}\n </Button>\n </div>\n );\n};\n\nconst focusable = \"a[href], button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]\";\n\n/**\n * Gives the focus to the first visible thing that can take it among what replaces `state` in its place, such as the\n * first row of the list that loaded. It waits while placeholders stand there, and stops once it has placed the\n * focus, once the person focuses something themselves, or once the content has come without anything to focus.\n */\nconst focusWhatComes = (state: HTMLElement) => {\n const place = state.parentElement;\n if (!place || typeof MutationObserver === \"undefined\") return;\n const before = state.previousSibling;\n const after = state.nextSibling;\n const follows = (node: Node, anchor: Node | null) =>\n !anchor?.isConnected || !!(anchor.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_FOLLOWING);\n const precedes = (node: Node, anchor: Node | null) =>\n !anchor?.isConnected || !!(anchor.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_PRECEDING);\n const inPlace = (node: Node) => follows(node, before) && precedes(node, after) && !state.contains(node);\n const stop = () => {\n observer.disconnect();\n document.removeEventListener(\"focusin\", stop);\n };\n const settle = () => {\n const target = [...place.querySelectorAll<HTMLElement>(focusable)].find(\n (element) => inPlace(element) && element.tabIndex >= 0 && element.getClientRects().length > 0,\n );\n if (target) {\n stop();\n target.focus();\n return;\n }\n const waiting = [...place.querySelectorAll('[data-k2-part=\"Loading\"], [aria-busy=\"true\"]')].some(inPlace);\n if (!state.isConnected && !waiting) stop();\n };\n const observer = new MutationObserver(settle);\n observer.observe(place, { childList: true, subtree: true });\n document.addEventListener(\"focusin\", stop);\n};\n\nexport type LoadingProps = {\n /** How many rows hold the place; 3 when not set. Give as many as usually come, so nothing moves when they arrive. */\n rows?: number;\n /** The lines of the rows that will come, so each placeholder is exactly as high as its row (40, 52 or 72). */\n lines?: 1 | 2 | 3;\n};\n\n/**\n * Loading: square placeholders in the heights of the real rows, so nothing moves when the data arrives. It stands\n * where the `List` will stand; a `Table` takes `loading` itself and keeps its head. Assistive technology hears\n * \"Wird geladen…\" (in the language of the page) from a status line; the placeholders themselves are hidden from it.\n */\nexport const Loading = (props: LoadingProps) => (\n <div class=\"k2-list k2-loading\" data-k2-part=\"Loading\">\n <LoadingStatus />\n <PlaceholderRows rows={props.rows ?? 3} lines={props.lines ?? 1} />\n </div>\n);\n\n/** The words \"loading\" for assistive technology only (internal: `Loading` and a loading `Table`). */\nexport const LoadingStatus = () => {\n const t = useUiMessages();\n return (\n <span class=\"k2-hidden-text\" role=\"status\">\n {t().loading}\n </span>\n );\n};\n\n/** Rows of placeholders in the shape of `Row` (internal: `Loading` and the phone list of a loading `Table`). */\nexport const PlaceholderRows = (props: { rows: number; lines: 1 | 2 | 3 }) => (\n <Index each={Array.from({ length: Math.max(0, props.rows) })}>\n {() => (\n <div class=\"k2-row\" data-lines={String(props.lines)} aria-hidden=\"true\">\n <span class=\"k2-row-lead\" />\n <For each={([\"k2-row-l1\", \"k2-row-l2\", \"k2-row-l3\"] as const).slice(0, props.lines)}>\n {(line) => (\n <span class={line}>\n <span class=\"k2-skel\" />\n </span>\n )}\n </For>\n </div>\n )}\n </Index>\n);\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,GAAG,EAAE,KAAK,EAAE,IAAI,QAAQ,UAAU;AAC3C,SAAS,aAAa,QAAQ,kBAAkB;AAChD,SAAS,YAAY,EAAE,MAAM,QAAQ,UAAU;AAC/C,SAAS,IAAI,QAAQ,SAAS;;AAG9B;AACA;AACA;;AAWA;AACA,OAAO,MAAM,KAAK,GAAI,KAAiB,6CAGhC,IAAI;EAAA,IAAC,IAAI;IAAA,OAAE,KAAK,CAAC,IAAI;EAAA;AAAA,cAEK,KAAK,CAAC,IAAI,8BACtC,IAAI;EAAA,IAAC,IAAI;IAAA,OAAE,KAAK,CAAC,MAAM;EAAA;EAAA,UAAI,MAAM,sBAAM,YAAY;IAAA,IAAC,MAAM;MAAA,OAAE,MAAM,CAAC,CAAC;IAAA;EAAA;AAAI,IAE5E;AAYD;AACA;AACA;AACA;AACA;AACA,OAAO,MAAM,MAAM,GAAI,KAAkB,IAAK;EAC5C,MAAM,CAAC,GAAG,aAAa,CAAC,CAAC;EACzB,IAAI,IAAgC;EACpC,iDAGO,IAAI;IAAC,IAAI;EAAA,cAEiB,KAAK,CAAC,IAAI,8BACtC,MAAM;IACL,IAAI;IACJ,OAAO,EAAE,MAAM;MACb;MACA,IAAI,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,cAAc,CAAC,IAAI,CA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CAAC,KAAK,CAAC,4CAEhD,GAAG;IAAA,IAAC,IAAI;MAAA,OAAG,CAAC,WAAW,EAAE,WAAW,EAAE,WAAW,CAAC,CAAW,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;IAAA;IAAA,UAC/E,IAAI,oDACS,IAAI;EAGlB;AAGN,EAEJ","ignoreList":[]}
@@ -0,0 +1,229 @@
1
+ import { memo as _$memo } from "solid-js/web";
2
+ import { ssrStyle as _$ssrStyle } from "solid-js/web";
3
+ import { ssr as _$ssr } from "solid-js/web";
4
+ import { ssrAttribute as _$ssrAttribute } from "solid-js/web";
5
+ import { escape as _$escape } from "solid-js/web";
6
+ import { createComponent as _$createComponent } from "solid-js/web";
7
+ var _tmpl$ = ["<span class=\"k2-sh-count\">", "</span>"],
8
+ _tmpl$2 = ["<span class=\"k2-sh-end\">", "</span>"],
9
+ _tmpl$3 = ["<p class=\"k2-sec-summary\">", "</p>"],
10
+ _tmpl$4 = ["<section class=\"k2-sec\" data-k2-part=\"Section\"", "><div class=\"k2-sh\">", "<h3>", "</h3>", "", "</div>", "", "", "</section>"],
11
+ _tmpl$5 = ["<span class=\"k2-stile\" style=\"", "\">", "</span>"],
12
+ _tmpl$6 = ["<b>", "</b>"],
13
+ _tmpl$7 = ["<span class=\"k2-sec-link-meta\">", "</span>"],
14
+ _tmpl$8 = ["<span class=\"k2-gh-count\">", "</span>"],
15
+ _tmpl$9 = ["<span class=\"k2-gh-meta\">", "</span>"],
16
+ _tmpl$0 = ["<span class=\"k2-gh-end\">", "", "", "", "</span>"],
17
+ _tmpl$1 = ["<section class=\"k2-group\" data-k2-part=\"Group\"", "><div class=\"k2-gh\"", ">", "<span class=\"k2-gh-title\">", "", "</span>", "", "</div>", "</section>"],
18
+ _tmpl$10 = "<span></span>";
19
+ import { For, children as resolveChildren, Show } from "solid-js";
20
+ import { Dynamic } from "solid-js/web";
21
+ import { Button } from "./button";
22
+ import { custom, Icon } from "./marks";
23
+ const HeadActions = props => _$createComponent(For, {
24
+ get each() {
25
+ return props.actions;
26
+ },
27
+ children: action => _$createComponent(Button, {
28
+ variant: "text",
29
+ get icon() {
30
+ return action.icon;
31
+ },
32
+ get forward() {
33
+ return action.forward;
34
+ },
35
+ get href() {
36
+ return action.href;
37
+ },
38
+ onClick: () => action.onClick?.(),
39
+ get children() {
40
+ return action.label;
41
+ }
42
+ })
43
+ });
44
+ /**
45
+ * A section: a head with symbol, title, count and at most two text buttons. Rule 9: no line under the head, none
46
+ * between the entries, one line at the end.
47
+ */
48
+ export const Section = props => {
49
+ const summary = resolveChildren(() => props.summary);
50
+ return _$ssr(_tmpl$4, _$ssrAttribute("aria-label", _$escape(props.title, true), false), _$escape(_$createComponent(Show, {
51
+ get when() {
52
+ return props.icon;
53
+ },
54
+ children: name => _$createComponent(Show, {
55
+ get when() {
56
+ return props.color;
57
+ },
58
+ get fallback() {
59
+ return _$createComponent(Icon, {
60
+ get name() {
61
+ return name();
62
+ }
63
+ });
64
+ },
65
+ get children() {
66
+ return _$ssr(_tmpl$5, _$ssrStyle(custom({
67
+ "--k2-c": props.color
68
+ })), _$escape(_$createComponent(Icon, {
69
+ get name() {
70
+ return name();
71
+ }
72
+ })));
73
+ }
74
+ })
75
+ })), _$escape(props.title), _$escape(_$createComponent(Show, {
76
+ get when() {
77
+ return props.count !== undefined;
78
+ },
79
+ get children() {
80
+ return _$ssr(_tmpl$, _$escape(props.count));
81
+ }
82
+ })), _$escape(_$createComponent(Show, {
83
+ get when() {
84
+ return props.actions?.length;
85
+ },
86
+ get children() {
87
+ return _$ssr(_tmpl$2, _$escape(_$createComponent(HeadActions, {
88
+ get actions() {
89
+ return props.actions;
90
+ }
91
+ })));
92
+ }
93
+ })), _$escape(_$createComponent(Show, {
94
+ get when() {
95
+ return summary() !== undefined;
96
+ },
97
+ get children() {
98
+ return _$ssr(_tmpl$3, _$escape(summary()));
99
+ }
100
+ })), _$escape(props.children), _$escape(_$createComponent(Show, {
101
+ get when() {
102
+ return props.more;
103
+ },
104
+ children: more => // One link: a quiet text button at the end of a section; a row with its summary in a side column.
105
+ _$createComponent(Dynamic, {
106
+ get component() {
107
+ return more().href !== undefined ? "a" : "button";
108
+ },
109
+ get type() {
110
+ return more().href !== undefined ? undefined : "button";
111
+ },
112
+ "class": "k2-sec-link",
113
+ get href() {
114
+ return more().href;
115
+ },
116
+ onClick: () => more().onClick?.(),
117
+ get children() {
118
+ return [_$ssr(_tmpl$6, _$escape(more().label)), _$createComponent(Show, {
119
+ get when() {
120
+ return more().meta;
121
+ },
122
+ get children() {
123
+ return _$ssr(_tmpl$7, _$escape(more().meta));
124
+ }
125
+ }), _$createComponent(Icon, {
126
+ name: "chevron-right"
127
+ })];
128
+ }
129
+ })
130
+ })));
131
+ };
132
+ /**
133
+ * The one framed group: what belongs together (a delivery, the items of one consignor, a thread). A square frame of
134
+ * one hairline, a tinted head, and no line inside: entries are told apart by spacing alone. Never nested.
135
+ */
136
+ export const Group = props => {
137
+ // parts passed as JSX are made once and read from here
138
+ const meta = resolveChildren(() => props.meta);
139
+ const state = resolveChildren(() => props.state);
140
+ return _$ssr(_tmpl$1, _$ssrAttribute("aria-label", _$escape(props.title, true), false) + _$ssrAttribute("data-folded", props.folded ? "" : _$escape(undefined, true), false), _$ssrAttribute("data-meta", meta() !== undefined ? "" : _$escape(undefined, true), false), _$escape(_$createComponent(Show, {
141
+ get when() {
142
+ return props.icon;
143
+ },
144
+ get fallback() {
145
+ return _$ssr(_tmpl$10);
146
+ },
147
+ children: name => _$createComponent(Show, {
148
+ get when() {
149
+ return props.color;
150
+ },
151
+ get fallback() {
152
+ return _$createComponent(Icon, {
153
+ get name() {
154
+ return name();
155
+ }
156
+ });
157
+ },
158
+ get children() {
159
+ return _$ssr(_tmpl$5, _$ssrStyle(custom({
160
+ "--k2-c": props.color
161
+ })), _$escape(_$createComponent(Icon, {
162
+ get name() {
163
+ return name();
164
+ }
165
+ })));
166
+ }
167
+ })
168
+ })), _$escape(props.title), _$escape(_$createComponent(Show, {
169
+ get when() {
170
+ return props.count !== undefined;
171
+ },
172
+ get children() {
173
+ return _$ssr(_tmpl$8, _$escape(props.count));
174
+ }
175
+ })), _$escape(_$createComponent(Show, {
176
+ get when() {
177
+ return meta() !== undefined;
178
+ },
179
+ get children() {
180
+ return _$ssr(_tmpl$9, _$escape(meta()));
181
+ }
182
+ })), _$escape(_$createComponent(Show, {
183
+ get when() {
184
+ return state() !== undefined || props.actions?.length || props.menu || props.folded;
185
+ },
186
+ get children() {
187
+ return _$ssr(_tmpl$0, _$escape(state()), _$escape(_$createComponent(Show, {
188
+ get when() {
189
+ return props.menu;
190
+ },
191
+ children: menu => _$createComponent(Button, {
192
+ variant: "ghost",
193
+ get icon() {
194
+ return menu().icon ?? "dots";
195
+ },
196
+ get label() {
197
+ return menu().label;
198
+ },
199
+ onClick: () => menu().onClick?.()
200
+ })
201
+ })), _$escape(_$createComponent(HeadActions, {
202
+ get actions() {
203
+ return props.actions;
204
+ }
205
+ })), _$escape(_$createComponent(Show, {
206
+ get when() {
207
+ return props.folded;
208
+ },
209
+ get children() {
210
+ return _$createComponent(Button, {
211
+ variant: "ghost",
212
+ icon: "chevron-down",
213
+ get label() {
214
+ return props.title;
215
+ }
216
+ });
217
+ }
218
+ })));
219
+ }
220
+ })), _$escape(_$createComponent(Show, {
221
+ get when() {
222
+ return !props.folded;
223
+ },
224
+ get children() {
225
+ return props.children;
226
+ }
227
+ })));
228
+ };
229
+ //# sourceMappingURL=structure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["v2/structure.tsx"],"sourcesContent":["import { For, type JSX, children as resolveChildren, Show } from \"solid-js\";\nimport { Dynamic } from \"solid-js/web\";\nimport { Button } from \"./button\";\nimport { custom, Icon } from \"./marks\";\nimport type { Action, TwoActions } from \"./types\";\n\nconst HeadActions = (props: { actions?: TwoActions }) => (\n <For each={props.actions}>\n {(action) => (\n <Button variant=\"text\" icon={action.icon} forward={action.forward} href={action.href} onClick={() => action.onClick?.()}>\n {action.label}\n </Button>\n )}\n </For>\n);\n\nexport type SectionProps = {\n /** The symbol of the section. With `color` it stands on a tinted tile, otherwise plain. */\n icon?: string;\n /** The data colour of the section's area, such as the colour of deliveries. */\n color?: string;\n title: string;\n count?: number | string;\n /** At most two text buttons in the head; on the phone they keep only their symbol. */\n actions?: TwoActions;\n /** One sentence under the head that sums the section up. */\n summary?: JSX.Element;\n /** The way to all of it, at the end (\"All deliveries ›\"). */\n more?: Action;\n children?: JSX.Element;\n};\n\n/**\n * A section: a head with symbol, title, count and at most two text buttons. Rule 9: no line under the head, none\n * between the entries, one line at the end.\n */\nexport const Section = (props: SectionProps) => {\n const summary = resolveChildren(() => props.summary);\n return (\n <section class=\"k2-sec\" data-k2-part=\"Section\" aria-label={props.title}>\n <div class=\"k2-sh\">\n <Show when={props.icon}>\n {(name) => (\n <Show when={props.color} fallback={<Icon name={name()} />}>\n <span class=\"k2-stile\" style={custom({ \"--k2-c\": props.color })}>\n <Icon name={name()} />\n </span>\n </Show>\n )}\n </Show>\n <h3>{props.title}</h3>\n <Show when={props.count !== undefined}>\n <span class=\"k2-sh-count\">{props.count}</span>\n </Show>\n <Show when={props.actions?.length}>\n <span class=\"k2-sh-end\">\n <HeadActions actions={props.actions} />\n </span>\n </Show>\n </div>\n <Show when={summary() !== undefined}>\n <p class=\"k2-sec-summary\">{summary()}</p>\n </Show>\n {props.children}\n <Show when={props.more}>\n {(more) => (\n // One link: a quiet text button at the end of a section; a row with its summary in a side column.\n <Dynamic\n component={more().href !== undefined ? \"a\" : \"button\"}\n type={more().href !== undefined ? undefined : \"button\"}\n class=\"k2-sec-link\"\n href={more().href}\n onClick={() => more().onClick?.()}\n >\n <b>{more().label}</b>\n <Show when={more().meta}>\n <span class=\"k2-sec-link-meta\">{more().meta}</span>\n </Show>\n <Icon name=\"chevron-right\" />\n </Dynamic>\n )}\n </Show>\n </section>\n );\n};\n\nexport type GroupProps = {\n icon?: string;\n color?: string;\n title: string;\n count?: number | string;\n /** A quiet line under the title; the head grows from 40 to 56 px. */\n meta?: JSX.Element;\n /** A state at the end of the head, such as `<Text weight=\"medium\"><Icon name=\"gavel\" /> Läuft</Text>` or an amount. */\n state?: JSX.Element;\n /** More deeds of the group behind one \"…\" button. (The menu opens with the behaviour layer.) */\n menu?: Action;\n /** At most two text buttons at the end of the head; more deeds go into `menu`. */\n actions?: TwoActions;\n /**\n * Only the head with its result; the content is hidden, and a chevron at the end opens it. (Opening comes with the\n * behaviour layer.)\n */\n folded?: boolean;\n children?: JSX.Element;\n};\n\n/**\n * The one framed group: what belongs together (a delivery, the items of one consignor, a thread). A square frame of\n * one hairline, a tinted head, and no line inside: entries are told apart by spacing alone. Never nested.\n */\nexport const Group = (props: GroupProps) => {\n // parts passed as JSX are made once and read from here\n const meta = resolveChildren(() => props.meta);\n const state = resolveChildren(() => props.state);\n return (\n <section class=\"k2-group\" data-k2-part=\"Group\" aria-label={props.title} data-folded={props.folded ? \"\" : undefined}>\n <div class=\"k2-gh\" data-meta={meta() !== undefined ? \"\" : undefined}>\n <Show when={props.icon} fallback={<span />}>\n {(name) => (\n <Show when={props.color} fallback={<Icon name={name()} />}>\n <span class=\"k2-stile\" style={custom({ \"--k2-c\": props.color })}>\n <Icon name={name()} />\n </span>\n </Show>\n )}\n </Show>\n <span class=\"k2-gh-title\">\n {props.title}\n <Show when={props.count !== undefined}>\n <span class=\"k2-gh-count\">{props.count}</span>\n </Show>\n </span>\n <Show when={meta() !== undefined}>\n <span class=\"k2-gh-meta\">{meta()}</span>\n </Show>\n <Show when={state() !== undefined || props.actions?.length || props.menu || props.folded}>\n <span class=\"k2-gh-end\">\n {state()}\n <Show when={props.menu}>\n {(menu) => <Button variant=\"ghost\" icon={menu().icon ?? \"dots\"} label={menu().label} onClick={() => menu().onClick?.()} />}\n </Show>\n <HeadActions actions={props.actions} />\n <Show when={props.folded}>\n <Button variant=\"ghost\" icon=\"chevron-down\" label={props.title} />\n </Show>\n </span>\n </Show>\n </div>\n <Show when={!props.folded}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AAA;MAAA,+BAEnF,KAAK,CAAC,CAAC,8BACP,IAAI;QAAA,IAAC,IAAI;UAAA,OAAE,KAAK,CAAC,IAAI;QAAA;QAAA,UAClB,IAAI,sBAAM,MAAM;UAAC,OAAO;UAAA,IAAS,IAAI;YAAA,OAAE,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,MAAM;UAAA;UAAA,IAAE,KAAK;YAAA,OAAE,IAAI,CAAC,CAAC,CAAC,KAAK;UAAA;UAAE,OAAO,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC,OAAO,GAAG;QAAC;MAAI,gCAE3H,WAAW;QAAA,IAAC,OAAO;UAAA,OAAE,KAAK,CAAC,OAAO;QAAA;MAAA,gCAClC,IAAI;QAAA,IAAC,IAAI;UAAA,OAAE,KAAK,CAAC,MAAM;QAAA;QAAA;UAAA,yBACrB,MAAM;YAAC,OAAO;YAAS,IAAI;YAAA,IAAgB,KAAK;cAAA,OAAE,KAAK,CAAC,KAAK;YAAA;UAAA;QAAA;MAAA;IAAA;EAAA,gCAKrE,IAAI;IAAA,IAAC,IAAI;MAAA,OAAE,CAAC,KAAK,CAAC,MAAM;IAAA;IAAA;MAAA,OAAG,KAAK,CAAC,QAAQ;IAAA;EAAA;AAGhD,CAAC","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * `@k2b/ui/v2/testing`: check a v2 screen in a Playwright test the same way @k2b/ui checks its own primitives.
3
+ *
4
+ * - `measureV2Layout(page)`: edges, double lines, type roles and grips as numbers; `problems` is empty when the page
5
+ * keeps the v2 rules.
6
+ * - `describeV2Page(page)`: the text outline of `describeV2` from a laid-out page, with hidden parts and dropped
7
+ * columns at the page's width.
8
+ * - `settled(page)`: waits for fonts, layout and finite animations before anything is read.
9
+ *
10
+ * Needs Playwright in the consumer (an optional peer dependency); nothing here is part of the main export.
11
+ */
12
+
13
+ import { describeV2 } from "../describe";
14
+ export { measureV2Layout } from "./measure-v2-layout";
15
+ export { settled } from "./settled";
16
+
17
+ /** The `describeV2` outline of a laid-out page, from `root` (the whole body by default). */
18
+ export const describeV2Page = async (page, root = "body") => {
19
+ const outline = await page.evaluate(`(() => { const root = document.querySelector(${JSON.stringify(root)}); return root ? (${describeV2})(root, { layout: true }) : null; })()`);
20
+ if (outline === null) throw new Error(`describeV2Page: no element matches ${root}`);
21
+ return outline;
22
+ };
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["v2/testing/index.ts"],"sourcesContent":["/**\n * `@k2b/ui/v2/testing`: check a v2 screen in a Playwright test the same way @k2b/ui checks its own primitives.\n *\n * - `measureV2Layout(page)`: edges, double lines, type roles and grips as numbers; `problems` is empty when the page\n * keeps the v2 rules.\n * - `describeV2Page(page)`: the text outline of `describeV2` from a laid-out page, with hidden parts and dropped\n * columns at the page's width.\n * - `settled(page)`: waits for fonts, layout and finite animations before anything is read.\n *\n * Needs Playwright in the consumer (an optional peer dependency); nothing here is part of the main export.\n */\nimport type { Page } from \"playwright\";\nimport { describeV2 } from \"../describe\";\n\nexport { measureV2Layout, type V2GripMeasure, type V2Layout, type V2LayoutOptions } from \"./measure-v2-layout\";\nexport { settled } from \"./settled\";\n\n/** The `describeV2` outline of a laid-out page, from `root` (the whole body by default). */\nexport const describeV2Page = async (page: Page, root = \"body\"): Promise<string> => {\n const outline = (await page.evaluate(\n `(() => { const root = document.querySelector(${JSON.stringify(root)}); return root ? (${describeV2})(root, { layout: true }) : null; })()`,\n )) as string | null;\n if (outline === null) throw new Error(`describeV2Page: no element matches ${root}`);\n return outline;\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAAS,UAAU,QAAQ,aAAa;AAExC,SAAS,eAAe,QAAiE,qBAAqB;AAC9G,SAAS,OAAO,QAAQ,WAAW;;AAEnC;AACA,OAAO,MAAM,cAAc,GAAG,OAAO,IAAU,EAAE,IAAI,GAAG,MAAM,KAAsB;EAClF,MAAM,OAAO,GAAI,MAAM,IAAI,CAAC,QAAQ,CAClC,gDAAgD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,qBAAqB,UAAU,wCACrG,CAAmB;EACnB,IAAI,OAAO,KAAK,IAAI,EAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,IAAI,EAAE,CAAC;EACnF,OAAO,OAAO;AAChB,CAAC","ignoreList":[]}