@gjermundgaraba-designs/pixel-paper 0.22.2 → 0.23.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 (160) hide show
  1. package/DESIGN.md +13 -13
  2. package/dist/src/adapters/mermaid.d.ts.map +1 -1
  3. package/dist/src/adapters/mermaid.js +0 -24
  4. package/dist/src/announcer/announcer.d.ts.map +1 -1
  5. package/dist/src/announcer/announcer.js +12 -12
  6. package/dist/src/board/board.d.ts +0 -10
  7. package/dist/src/board/board.d.ts.map +1 -1
  8. package/dist/src/board/board.js +36 -64
  9. package/dist/src/board/index.d.ts +2 -1
  10. package/dist/src/board/index.d.ts.map +1 -1
  11. package/dist/src/board/index.js +2 -1
  12. package/dist/src/button/button.d.ts +1 -1
  13. package/dist/src/button/button.d.ts.map +1 -1
  14. package/dist/src/commandPalette/commandPalette.d.ts.map +1 -1
  15. package/dist/src/commandPalette/commandPalette.js +78 -83
  16. package/dist/src/commandPalette/keys.d.ts +2 -2
  17. package/dist/src/commandPalette/keys.d.ts.map +1 -1
  18. package/dist/src/commandPalette/keys.js +2 -4
  19. package/dist/src/commandPalette/match.d.ts.map +1 -1
  20. package/dist/src/commandPalette/match.js +2 -2
  21. package/dist/src/confirmDialog/confirmDialog.d.ts.map +1 -1
  22. package/dist/src/confirmDialog/confirmDialog.js +1 -2
  23. package/dist/src/copyButton/copyButton.d.ts +0 -5
  24. package/dist/src/copyButton/copyButton.d.ts.map +1 -1
  25. package/dist/src/copyButton/copyButton.js +2 -2
  26. package/dist/src/crumbs/crumbs.d.ts +0 -2
  27. package/dist/src/crumbs/crumbs.d.ts.map +1 -1
  28. package/dist/src/crumbs/crumbs.js +2 -2
  29. package/dist/src/dialog/dialog.d.ts +2 -0
  30. package/dist/src/dialog/dialog.d.ts.map +1 -1
  31. package/dist/src/dialog/dialog.js +3 -2
  32. package/dist/src/drag/drag.d.ts +28 -0
  33. package/dist/src/drag/drag.d.ts.map +1 -1
  34. package/dist/src/drag/drag.js +39 -17
  35. package/dist/src/editableTitle/editableTitle.d.ts +4 -4
  36. package/dist/src/field/field.d.ts +7 -1
  37. package/dist/src/field/field.d.ts.map +1 -1
  38. package/dist/src/field/field.js +14 -6
  39. package/dist/src/fieldset/fieldset.d.ts.map +1 -1
  40. package/dist/src/fieldset/fieldset.js +2 -4
  41. package/dist/src/fileTree/fileTree.d.ts.map +1 -1
  42. package/dist/src/fileTree/fileTree.js +16 -16
  43. package/dist/src/inlineInput/inlineInput.d.ts +4 -0
  44. package/dist/src/inlineInput/inlineInput.d.ts.map +1 -1
  45. package/dist/src/inlineInput/inlineInput.js +9 -6
  46. package/dist/src/keyHelp/index.d.ts +1 -1
  47. package/dist/src/keyHelp/index.d.ts.map +1 -1
  48. package/dist/src/keyHelp/index.js +1 -1
  49. package/dist/src/keyHelp/keyHelp.d.ts +1 -3
  50. package/dist/src/keyHelp/keyHelp.d.ts.map +1 -1
  51. package/dist/src/keyHelp/keyHelp.js +3 -6
  52. package/dist/src/keyHint/keyLabel.d.ts +2 -0
  53. package/dist/src/keyHint/keyLabel.d.ts.map +1 -1
  54. package/dist/src/keyHint/keyLabel.js +3 -2
  55. package/dist/src/lineDiff/diff.d.ts +6 -3
  56. package/dist/src/lineDiff/diff.d.ts.map +1 -1
  57. package/dist/src/lineDiff/diff.js +40 -28
  58. package/dist/src/lineDiff/patch.d.ts.map +1 -1
  59. package/dist/src/lineDiff/patch.js +18 -13
  60. package/dist/src/linkState/linkState.d.ts.map +1 -1
  61. package/dist/src/linkState/linkState.js +1 -7
  62. package/dist/src/menu/slip.js +2 -2
  63. package/dist/src/meter/meter.d.ts.map +1 -1
  64. package/dist/src/meter/meter.js +22 -17
  65. package/dist/src/notice/notice.d.ts +2 -0
  66. package/dist/src/notice/notice.d.ts.map +1 -1
  67. package/dist/src/notice/notice.js +2 -1
  68. package/dist/src/passwordField/passwordField.d.ts.map +1 -1
  69. package/dist/src/passwordField/passwordField.js +3 -7
  70. package/dist/src/rail/rail.d.ts +17 -3
  71. package/dist/src/rail/rail.d.ts.map +1 -1
  72. package/dist/src/rail/rail.js +6 -6
  73. package/dist/src/reel/layout.d.ts +9 -5
  74. package/dist/src/reel/layout.d.ts.map +1 -1
  75. package/dist/src/reel/layout.js +11 -5
  76. package/dist/src/reel/reel.d.ts.map +1 -1
  77. package/dist/src/reel/reel.js +122 -68
  78. package/dist/src/scheme/scheme.d.ts +1 -1
  79. package/dist/src/scheme/scheme.d.ts.map +1 -1
  80. package/dist/src/segmented/segmented.d.ts +0 -3
  81. package/dist/src/segmented/segmented.d.ts.map +1 -1
  82. package/dist/src/segmented/segmented.js +1 -6
  83. package/dist/src/selectField/selectField.d.ts.map +1 -1
  84. package/dist/src/selectField/selectField.js +3 -10
  85. package/dist/src/sortable/index.d.ts +1 -1
  86. package/dist/src/sortable/index.d.ts.map +1 -1
  87. package/dist/src/sortable/index.js +1 -1
  88. package/dist/src/sortable/sortable.d.ts +39 -40
  89. package/dist/src/sortable/sortable.d.ts.map +1 -1
  90. package/dist/src/sortable/sortable.js +14 -31
  91. package/dist/src/stack/stack.d.ts +1 -1
  92. package/dist/src/stack/stack.d.ts.map +1 -1
  93. package/dist/src/stack/stack.js +1 -1
  94. package/dist/src/tabs/tabs.d.ts +1 -1
  95. package/dist/src/tabs/tabs.d.ts.map +1 -1
  96. package/dist/src/tabs/tabs.js +1 -1
  97. package/dist/src/textareaField/textareaField.d.ts.map +1 -1
  98. package/dist/src/textareaField/textareaField.js +3 -7
  99. package/dist/src/time/time.d.ts.map +1 -1
  100. package/dist/src/time/time.js +4 -2
  101. package/dist/src/tips/index.d.ts +1 -1
  102. package/dist/src/tips/index.d.ts.map +1 -1
  103. package/dist/src/toast/index.d.ts +1 -1
  104. package/dist/src/toast/index.d.ts.map +1 -1
  105. package/dist/src/toast/toast.d.ts +5 -5
  106. package/dist/src/toast/toast.d.ts.map +1 -1
  107. package/dist/src/toast/toast.js +1 -6
  108. package/dist/src/toolbar/toolbar.d.ts +0 -3
  109. package/dist/src/toolbar/toolbar.d.ts.map +1 -1
  110. package/dist/src/toolbar/toolbar.js +1 -2
  111. package/package.json +1 -1
  112. package/src/adapters/mermaid.ts +0 -24
  113. package/src/announcer/announcer.ts +13 -17
  114. package/src/board/board.ts +32 -80
  115. package/src/board/index.ts +1 -1
  116. package/src/button/button.ts +1 -1
  117. package/src/commandPalette/commandPalette.ts +21 -38
  118. package/src/commandPalette/keys.ts +2 -4
  119. package/src/commandPalette/match.ts +3 -3
  120. package/src/confirmDialog/confirmDialog.ts +5 -3
  121. package/src/copyButton/copyButton.ts +2 -5
  122. package/src/crumbs/crumbs.ts +2 -4
  123. package/src/dialog/dialog.ts +3 -2
  124. package/src/drag/drag.ts +54 -5
  125. package/src/field/field.ts +29 -7
  126. package/src/fieldset/fieldset.ts +2 -4
  127. package/src/fileTree/fileTree.ts +10 -12
  128. package/src/inlineInput/inlineInput.ts +11 -2
  129. package/src/keyHelp/index.ts +0 -1
  130. package/src/keyHelp/keyHelp.ts +3 -9
  131. package/src/keyHint/keyLabel.ts +5 -2
  132. package/src/lineDiff/diff.ts +70 -54
  133. package/src/lineDiff/patch.ts +27 -14
  134. package/src/linkState/linkState.ts +1 -8
  135. package/src/menu/slip.ts +2 -2
  136. package/src/meter/meter.ts +25 -15
  137. package/src/notice/notice.ts +2 -1
  138. package/src/passwordField/passwordField.ts +3 -7
  139. package/src/pixel-paper.css +82 -131
  140. package/src/rail/rail.ts +8 -6
  141. package/src/reel/layout.ts +14 -7
  142. package/src/reel/reel.ts +132 -63
  143. package/src/scheme/scheme.ts +1 -1
  144. package/src/segmented/segmented.ts +1 -9
  145. package/src/selectField/selectField.ts +3 -10
  146. package/src/sortable/index.ts +0 -1
  147. package/src/sortable/sortable.ts +35 -54
  148. package/src/stack/stack.ts +1 -1
  149. package/src/tabs/tabs.ts +1 -1
  150. package/src/textareaField/textareaField.ts +3 -7
  151. package/src/time/time.ts +6 -7
  152. package/src/tips/index.ts +1 -1
  153. package/src/toast/index.ts +1 -1
  154. package/src/toast/toast.ts +2 -8
  155. package/src/tokens.css +6 -0
  156. package/src/toolbar/toolbar.ts +0 -5
  157. package/dist/src/inlineInput/inline.d.ts +0 -6
  158. package/dist/src/inlineInput/inline.d.ts.map +0 -1
  159. package/dist/src/inlineInput/inline.js +0 -7
  160. package/src/inlineInput/inline.ts +0 -13
package/src/tabs/tabs.ts CHANGED
@@ -40,7 +40,7 @@ export type OutMessage = typeof OutMessage.Type;
40
40
  * document; each tab's and panel's id derives from it. */
41
41
  export type InitConfig = Readonly<{ id: string }>;
42
42
 
43
- /** Creates a tab strip. Arrows select as they move, as the strip has always done. */
43
+ /** Creates a tab strip. Arrows select as they move. */
44
44
  export const init = (config: InitConfig): Model => ({
45
45
  tabs: UiTabs.init({ id: config.id, activationMode: "Automatic" }),
46
46
  });
@@ -1,7 +1,7 @@
1
1
  import { Textarea as UiTextarea } from "@foldkit/ui";
2
2
  import type { ChildAttribute, Html, HtmlBuilder, TextareaAttribute } from "foldkit/html";
3
3
 
4
- import { describedByError, errorView } from "../field/field.ts";
4
+ import { controlAttributes, errorView, helpView } from "../field/field.ts";
5
5
 
6
6
  // VIEW
7
7
 
@@ -59,17 +59,13 @@ export const view = <Message>(config: ViewConfig<Message>, h: HtmlBuilder<Messag
59
59
  [h.Class(`field${isMono ? " mono" : ""}`)],
60
60
  [
61
61
  h.label(groups.label, [label]),
62
- // NOTE: @foldkit/ui gap: Textarea has no required option, so the wrapper says it.
63
62
  h.textarea([
64
63
  ...textareaAttributes,
65
64
  ...groups.textarea,
66
- ...describedByError(id, error, help !== undefined, h),
67
- ...(isRequired ? [h.AriaRequired(true)] : []),
65
+ ...controlAttributes(id, error, help, isRequired, h),
68
66
  ]),
69
67
  ...errorView(id, error, h),
70
- ...(help === undefined
71
- ? []
72
- : [h.p([...groups.description, h.Class("field-help")], [help])]),
68
+ ...helpView(help, groups.description, h),
73
69
  ],
74
70
  ),
75
71
  },
package/src/time/time.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Clock, Duration, Effect, Match, Option, Schedule, Schema, Stream } from "effect";
1
+ import { Clock, Duration, Match, Option, Schedule, Schema, Stream } from "effect";
2
2
  import type { Html, HtmlBuilder } from "foldkit/html";
3
3
  import type { EntryWithoutKeepAlive } from "foldkit/subscription";
4
4
 
@@ -127,10 +127,9 @@ export const clockEntry = <Model, Message>(
127
127
  dependenciesSchema: Schema.Struct({ isActive: Schema.Boolean }),
128
128
  modelToDependencies: (model) => ({ isActive: config.isActive(model) }),
129
129
  dependenciesToStream: ({ isActive }) =>
130
- Stream.when(
131
- Stream.fromEffectSchedule(Clock.currentTimeMillis, Schedule.spaced(TICK)).pipe(
132
- Stream.map(config.toMessage),
133
- ),
134
- Effect.sync(() => isActive),
135
- ),
130
+ isActive
131
+ ? Stream.fromEffectSchedule(Clock.currentTimeMillis, Schedule.spaced(TICK)).pipe(
132
+ Stream.map(config.toMessage),
133
+ )
134
+ : Stream.empty,
136
135
  });
package/src/tips/index.ts CHANGED
@@ -12,4 +12,4 @@ export {
12
12
  update,
13
13
  view,
14
14
  } from "./tips.ts";
15
- export type { InitConfig, Trigger } from "./tips.ts";
15
+ export type { InitConfig } from "./tips.ts";
@@ -13,6 +13,6 @@ export {
13
13
  update,
14
14
  view,
15
15
  } from "./toast.ts";
16
- export type { InitConfig, ShowConfig, ShowReturn } from "./toast.ts";
16
+ export type { InitConfig, ShowConfig } from "./toast.ts";
17
17
  export type { Action, Tone } from "./stack.ts";
18
18
  export { Focus } from "../focus/focus.ts";
@@ -295,7 +295,7 @@ const oldestCalm = (model: Model): Option.Option<Stack.Entry> => {
295
295
 
296
296
  /** What `show` returns: the next Model and Commands, and the new slip's id, to take it back
297
297
  * with `dismiss`. */
298
- export type ShowReturn = Update.Return<Model, Message> & Readonly<{ entryId: string }>;
298
+ type ShowReturn = Update.Return<Model, Message> & Readonly<{ entryId: string }>;
299
299
 
300
300
  const spoken = (config: ShowConfig): string =>
301
301
  config.body === undefined ? `${config.title}.` : `${config.title}. ${config.body}`;
@@ -350,17 +350,11 @@ export const dismiss = (model: Model, entryId: string): StepReturn =>
350
350
 
351
351
  // VIEW
352
352
 
353
- const TONE_CLASS: Record<Tone, string> = {
354
- Ok: "notice toast ok",
355
- Error: "notice toast error",
356
- Quiet: "notice toast quiet",
357
- };
358
-
359
353
  const slipView = (entry: Stack.Entry, h: HtmlBuilder<Message>): Html => {
360
354
  const { tone, title, maybeBody, maybeAction } = entry.payload;
361
355
 
362
356
  return h.div(
363
- [h.Class(TONE_CLASS[tone])],
357
+ [h.Class(`notice toast${Notice.TONE_CLASS[tone]}`)],
364
358
  [
365
359
  Notice.toneGlyphView({ tone }, h),
366
360
  h.div([], [h.strong([], [title]), ...Option.toArray(maybeBody)]),
package/src/tokens.css CHANGED
@@ -81,6 +81,11 @@
81
81
  conic-gradient(at 1px 1px, #0000 75%, var(--dither-dot) 0) 0 0 / 4px 4px,
82
82
  conic-gradient(at 1px 1px, #0000 75%, var(--dither-dot) 0) 2px 2px / 4px 4px, var(--dither-base);
83
83
 
84
+ /* ---------- colour: fades ---------- */
85
+ --fade-on-ink: 0.75; /* what prints muted on paper, printed in paper on an inverted fill */
86
+ --fade-held: 0.6; /* a held control on an ink title bar */
87
+ --fade-dragged: 0.4; /* a held item, dimmed in place while its copy follows the pointer */
88
+
84
89
  /* ---------- type: three families ---------- */
85
90
  --font-px: "Departure Mono", ui-monospace, Menlo, Monaco, monospace;
86
91
  --font-body: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
@@ -147,6 +152,7 @@
147
152
 
148
153
  /* ---------- the bench: a page whose work is the window ---------- */
149
154
  --bench-work-min: 152px; /* the least of its height the work keeps: a 120px pane, 16px gutters */
155
+ --bench-head-min: 64px; /* the least of its head a short window keeps: its padding and a small button */
150
156
 
151
157
  /* ---------- charts ---------- */
152
158
  --chart-plot: 160px; /* a line chart's plot, between its top line and its axis */
@@ -4,7 +4,6 @@ import type { Html, HtmlBuilder } from "foldkit/html";
4
4
  import { defineMessageUnion } from "foldkit/message";
5
5
  import * as Mount from "foldkit/mount";
6
6
 
7
- import type { Attributes } from "../attributes/attributes.ts";
8
7
  import { isPlain } from "../keys/keys.ts";
9
8
 
10
9
  // MODEL
@@ -172,8 +171,6 @@ export type ViewConfig<ParentMessage> = Readonly<{
172
171
  * Scene, resolve the Mount by name with the lifted Message:
173
172
  * `Scene.Mount.resolve({ name: Toolbar.BindToolKeys.name }, toParentMessage(Toolbar.Message.MovedToolFocus({ move })))`. */
174
173
  toParentMessage: (message: Message) => ParentMessage;
175
- /** Further attributes for the toolbar, never a class. */
176
- attributes?: Attributes<ParentMessage>;
177
174
  }>;
178
175
 
179
176
  /** A strip of tools that is one stop for Tab (`role="toolbar"`, named by its label, with its
@@ -189,12 +186,10 @@ export const view = <ParentMessage>(
189
186
  orientation = "Horizontal",
190
187
  isFloating = false,
191
188
  toParentMessage,
192
- attributes = [],
193
189
  } = config;
194
190
 
195
191
  return h.div(
196
192
  [
197
- ...attributes,
198
193
  h.Role("toolbar"),
199
194
  h.AriaLabel(label),
200
195
  h.AriaOrientation(orientation === "Vertical" ? "vertical" : "horizontal"),
@@ -1,6 +0,0 @@
1
- import { Option } from "effect";
2
- /** What Enter or leaving an inline field writes: the draft trimmed, or none (an untouched
3
- * draft, so an edit made elsewhere to `value` is never overwritten; an empty one; or the
4
- * text it replaces). */
5
- export declare const toWrite: (maybeDraft: Option.Option<string>, value: string) => Option.Option<string>;
6
- //# sourceMappingURL=inline.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../../src/inlineInput/inline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgB,MAAM,QAAQ,CAAC;AAI9C;;yBAEyB;AACzB,eAAO,MAAM,OAAO,eAAgB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAK5F,CAAC"}
@@ -1,7 +0,0 @@
1
- import { brandViewResult as __foldkitBrandViewResult } from 'foldkit/brand'
2
- import { Option, String, pipe } from "effect";
3
- // RULES
4
- /** What Enter or leaving an inline field writes: the draft trimmed, or none (an untouched
5
- * draft, so an edit made elsewhere to `value` is never overwritten; an empty one; or the
6
- * text it replaces). */
7
- export const toWrite = (maybeDraft, value) => __foldkitBrandViewResult((pipe(maybeDraft, Option.map(String.trim), Option.filter((text) => __foldkitBrandViewResult((String.isNonEmpty(text) && text !== value), "@gjermundgaraba-designs/pixel-paper/src/inlineInput/inline.js#anonymous")))), "@gjermundgaraba-designs/pixel-paper/src/inlineInput/inline.js#toWrite");
@@ -1,13 +0,0 @@
1
- import { Option, String, pipe } from "effect";
2
-
3
- // RULES
4
-
5
- /** What Enter or leaving an inline field writes: the draft trimmed, or none (an untouched
6
- * draft, so an edit made elsewhere to `value` is never overwritten; an empty one; or the
7
- * text it replaces). */
8
- export const toWrite = (maybeDraft: Option.Option<string>, value: string): Option.Option<string> =>
9
- pipe(
10
- maybeDraft,
11
- Option.map(String.trim),
12
- Option.filter((text) => String.isNonEmpty(text) && text !== value),
13
- );