@w6w/ui 0.2.62 → 0.2.63

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 (38) hide show
  1. package/dist/{CodeBlock-CPKXSNEs.js → CodeBlock-Bp0SGY1m.js} +82 -57
  2. package/dist/{CodeBlock-CPKXSNEs.js.map → CodeBlock-Bp0SGY1m.js.map} +1 -1
  3. package/dist/{CodeBlock-BSX1pi6W.cjs → CodeBlock-a2aIm-0b.cjs} +5 -5
  4. package/dist/{CodeBlock-BSX1pi6W.cjs.map → CodeBlock-a2aIm-0b.cjs.map} +1 -1
  5. package/dist/EditConnectionModal.d.ts +1 -1
  6. package/dist/code.cjs +1 -1
  7. package/dist/code.mjs +1 -1
  8. package/dist/components/CallableBindingSetup.d.ts +15 -0
  9. package/dist/components/ConnectionList.d.ts +1 -1
  10. package/dist/components/DataStoreList.d.ts +1 -1
  11. package/dist/components/DataTable.d.ts +6 -0
  12. package/dist/components/IconButton.d.ts +4 -0
  13. package/dist/components/RunCallable.d.ts +52 -0
  14. package/dist/components/expression-authoring.d.ts +3 -2
  15. package/dist/components/expression-dom.d.ts +30 -0
  16. package/dist/components/icons.d.ts +1 -1
  17. package/dist/{connection-app-meta-CIfXp2O-.js → connection-app-meta-HBKXI0nk.js} +2720 -2659
  18. package/dist/connection-app-meta-HBKXI0nk.js.map +1 -0
  19. package/dist/connection-app-meta-pnATcKeZ.cjs +26 -0
  20. package/dist/connection-app-meta-pnATcKeZ.cjs.map +1 -0
  21. package/dist/flow.cjs +1 -1
  22. package/dist/flow.mjs +3 -3
  23. package/dist/index.cjs +2 -2
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.ts +5 -1
  26. package/dist/index.mjs +1696 -1284
  27. package/dist/index.mjs.map +1 -1
  28. package/dist/provider.d.ts +29 -0
  29. package/dist/run-callable.d.ts +50 -0
  30. package/dist/types.d.ts +4 -0
  31. package/package.json +2 -2
  32. package/src/styles/_connections.scss +1 -0
  33. package/src/styles/_data-stores.scss +26 -3
  34. package/src/styles/_data-table.scss +38 -1
  35. package/src/styles.css +74 -4
  36. package/dist/connection-app-meta-CIfXp2O-.js.map +0 -1
  37. package/dist/connection-app-meta-Cn39S3ED.cjs +0 -24
  38. package/dist/connection-app-meta-Cn39S3ED.cjs.map +0 -1
@@ -174,6 +174,21 @@ export interface DataStoreEntryOptions {
174
174
  /** True when further matching entries exist past this page. */
175
175
  more?: boolean;
176
176
  }
177
+ /** What a callable is, for the RunCallable components (plan P3). */
178
+ export type CallableKind = "workflow" | "function" | "endpoint";
179
+ export interface CallableRef {
180
+ kind: CallableKind;
181
+ id: string;
182
+ name: string;
183
+ tags: string[];
184
+ }
185
+ /** An explicit host-key binding: where the host's data goes when its button is pressed. */
186
+ export interface CallableBinding {
187
+ kind: CallableKind;
188
+ callableId: string;
189
+ entry?: string;
190
+ field: string;
191
+ }
177
192
  export interface W6WApi {
178
193
  /** Host route for opening a callable in a new tab. */
179
194
  callableHref?(kind: "function" | "workflow", id: string): string;
@@ -519,6 +534,20 @@ export interface W6WApi {
519
534
  * OPTIONAL, like `listTestRuns?` above.
520
535
  */
521
536
  listTriggerApps?(): Promise<AppSummary[]>;
537
+ /**
538
+ * OPTIONAL. List callables (workflows, functions, endpoints) carrying `tag` or a dotted
539
+ * descendant of it; an empty tag lists all. Drives `RunCallables` / `CallableBindingSetup`.
540
+ * GETs each kind's list with `?tag=`.
541
+ */
542
+ listCallables?(opts: {
543
+ tag: string;
544
+ }): Promise<CallableRef[]>;
545
+ /** OPTIONAL. Run an endpoint by id or key with `input`; resolves its raw output. */
546
+ invokeEndpoint?(idOrKey: string, input: Record<string, unknown>): Promise<unknown>;
547
+ /** OPTIONAL. Read the binding saved under a host key (`null` when none). */
548
+ getCallableBinding?(hostKey: string): Promise<CallableBinding | null>;
549
+ /** OPTIONAL. Create or replace the binding saved under a host key. */
550
+ saveCallableBinding?(hostKey: string, binding: CallableBinding): Promise<void>;
522
551
  /**
523
552
  * List one app's declared triggers. GETs `/apps/:id/triggers`.
524
553
  */
@@ -0,0 +1,50 @@
1
+ import { CallableBinding, CallableKind, CallableRef, W6WApi } from './provider.tsx';
2
+ import { TriggerFieldDef } from './trigger-fields.ts';
3
+ import { WorkflowDetail } from './types.ts';
4
+ /**
5
+ * Pure decisions behind the RunCallable components (plan.md P4). No JSX, no React: the
6
+ * components are thin over these so each rule is testable on its own.
7
+ */
8
+ /** Why a run could not be attempted (as opposed to the callable itself failing). */
9
+ export type CallableRunErrorCode = "unsupported" | "unbound" | "stale" | "no-trigger" | "failed";
10
+ export declare class CallableRunError extends Error {
11
+ readonly code: CallableRunErrorCode;
12
+ constructor(code: CallableRunErrorCode, message: string);
13
+ }
14
+ /** The property name the host data travels under: `as`, else the prefix's last segment. */
15
+ export declare function tagProp(prefix: string, as?: string): string;
16
+ /**
17
+ * The preselected callable: the first one carrying a tag EXACTLY equal to
18
+ * `<prefix>.<defaultAction>` (never a deeper `….send_confirmation.x`), else null.
19
+ */
20
+ export declare function defaultCallable(refs: CallableRef[], prefix: string, defaultAction?: string): CallableRef | null;
21
+ export interface ManualTrigger {
22
+ id: string;
23
+ fields: TriggerFieldDef[];
24
+ }
25
+ /** The definition's `@w6w/trigger`/`manual` nodes in definition order, with declared fields. */
26
+ export declare function manualTriggers(definition: WorkflowDetail): ManualTrigger[];
27
+ export interface RunPlan {
28
+ kind: CallableKind;
29
+ id: string;
30
+ entry?: string;
31
+ input: Record<string, unknown>;
32
+ }
33
+ /**
34
+ * Build the one call P4 prescribes. Tag mode (a `CallableRef`): `{[prop]: data}`, a workflow's
35
+ * entry being its FIRST manual trigger. Explicit mode (a `CallableBinding`): `{[field]: data}`
36
+ * to the bound `entry`. A workflow ref needs its `definition`.
37
+ */
38
+ export declare function buildRun(target: CallableRef | CallableBinding, data: unknown, prop: string, definition?: WorkflowDetail): RunPlan;
39
+ /** Issue exactly the call a plan names. Returns the callable's output. */
40
+ export declare function dispatchRun(api: W6WApi, plan: RunPlan): Promise<unknown>;
41
+ /** Tag-mode run: resolve a workflow's definition (for its entry), build, dispatch. */
42
+ export declare function runRef(api: W6WApi, ref: CallableRef, data: unknown, prop: string, extra?: Record<string, unknown>): Promise<unknown>;
43
+ /**
44
+ * Whether a saved binding still points at something runnable. Returns a reason, or null when
45
+ * fine. A workflow must still exist AND still carry the bound entry as a manual trigger; a
46
+ * function must still exist (endpoints have no detail read, so a missing one surfaces on run).
47
+ */
48
+ export declare function staleReason(api: W6WApi, binding: CallableBinding): Promise<string | null>;
49
+ /** Explicit-mode run: read the binding, verify it is not stale, send `{[field]: data}`. */
50
+ export declare function runBound(api: W6WApi, hostKey: string, data: unknown): Promise<unknown>;
package/dist/types.d.ts CHANGED
@@ -401,6 +401,8 @@ export interface CredentialSummary {
401
401
  /** Non-secret display values (e.g. the service account's email). */
402
402
  display: Record<string, string>;
403
403
  private: boolean;
404
+ /** Who may use it: `"user"` = only its creator. Absent (an older server) means the account. */
405
+ accessScope?: "account" | "user";
404
406
  connectionCount: number;
405
407
  createdAt: string;
406
408
  updatedAt: string;
@@ -501,6 +503,8 @@ export interface ConnectionSummary {
501
503
  authKey: string;
502
504
  /** The stored credential this connection uses, when it has one. */
503
505
  credentialId?: string | null;
506
+ /** Who may use it: `"user"` = only its creator. Absent (an older server) means the account. */
507
+ accessScope?: "account" | "user";
504
508
  /** The owning tenant. The server sends `tenant`/`subject`, never `owner`. */
505
509
  tenant?: string;
506
510
  /** The owning subject (the partner's user id). */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@w6w/ui",
3
- "version": "0.2.62",
3
+ "version": "0.2.63",
4
4
  "description": "React components for w6w — central API management. Build plugins, apps and integrations on them.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://w6w.io",
@@ -72,7 +72,7 @@
72
72
  "@codemirror/state": "^6.5.0",
73
73
  "@codemirror/view": "^6.35.0",
74
74
  "@uiw/react-codemirror": "^4.23.7",
75
- "@w6w/expr": "^0.1.3",
75
+ "@w6w/expr": "^0.1.4",
76
76
  "@xyflow/react": "^12.3.6",
77
77
  "prism-react-renderer": "^2.4.1",
78
78
  "react-markdown": "^10.1.0",
@@ -21,6 +21,7 @@
21
21
  .w6w-connection-cell-name {
22
22
  display: inline-flex;
23
23
  align-items: center;
24
+ flex-wrap: wrap;
24
25
  gap: var(--w6w-sp-2);
25
26
  }
26
27
  .w6w-connection-row-actions {
@@ -44,7 +44,7 @@
44
44
  }
45
45
  .w6w-data-columns-colhead {
46
46
  font-size: var(--w6w-fs-xs);
47
- font-weight: 500;
47
+ font-weight: var(--w6w-fw-medium);
48
48
  color: var(--w6w-muted);
49
49
  }
50
50
  .w6w-data-columns-error {
@@ -58,11 +58,13 @@
58
58
  .w6w-data-entries-toolbar {
59
59
  display: flex;
60
60
  align-items: center;
61
+ flex-wrap: wrap;
61
62
  gap: var(--w6w-sp-2);
62
- margin: var(--w6w-sp-3) 0;
63
+ margin: var(--w6w-sp-4) 0;
63
64
  }
64
65
  .w6w-data-entries-toolbar input[type="search"] {
65
66
  flex: 1;
67
+ min-width: 8rem;
66
68
  max-width: 20rem;
67
69
  /* Same box as `.w6w-field` inputs — no host page styles a bare search input. */
68
70
  background: var(--w6w-panel-2);
@@ -77,12 +79,29 @@
77
79
  outline: none;
78
80
  border-color: var(--w6w-accent);
79
81
  }
82
+ .w6w-data-entry-new {
83
+ margin-inline-start: auto;
84
+ }
80
85
  /* Entries open a viewer. Keep the list quiet and bounded, even for long keys or JSON. */
81
86
  .w6w-data-entry-list {
82
87
  table-layout: fixed;
83
88
  }
84
- .w6w-data-entry-key,
89
+ .w6w-data-entry-list td {
90
+ vertical-align: top;
91
+ padding-block: var(--w6w-sp-3);
92
+ }
85
93
  .w6w-data-entry-preview {
94
+ display: -webkit-box;
95
+ -webkit-box-orient: vertical;
96
+ -webkit-line-clamp: 4;
97
+ overflow: hidden;
98
+ white-space: pre-wrap;
99
+ overflow-wrap: anywhere;
100
+ font-family: var(--w6w-font-mono);
101
+ font-size: var(--w6w-fs-sm);
102
+ line-height: var(--w6w-lh-normal);
103
+ }
104
+ .w6w-data-entry-key {
86
105
  display: block;
87
106
  width: 100%;
88
107
  overflow: hidden;
@@ -100,6 +119,10 @@
100
119
  text-align: left;
101
120
  cursor: pointer;
102
121
  }
122
+ .w6w-data-entry-key:hover {
123
+ color: var(--w6w-accent);
124
+ text-decoration: underline;
125
+ }
103
126
  .w6w-data-entry-key:focus-visible {
104
127
  outline: 2px solid var(--w6w-accent);
105
128
  outline-offset: 2px;
@@ -21,7 +21,8 @@
21
21
  .w6w-data-table td {
22
22
  border-right: 1px solid var(--w6w-border);
23
23
  border-bottom: 1px solid var(--w6w-border);
24
- padding: var(--w6w-sp-2) var(--w6w-sp-3);
24
+ padding: var(--w6w-sp-1-5) var(--w6w-sp-2-5);
25
+ line-height: 1.35;
25
26
  text-align: left;
26
27
  vertical-align: middle;
27
28
  }
@@ -45,8 +46,44 @@
45
46
  .w6w-data-table:not(:has(tbody tr)) th {
46
47
  border-bottom: 0;
47
48
  }
49
+ /* Density: cells use the scale's small step, the header a muted label one step smaller, and the
50
+ meta lines inside a cell (`.small`, `.muted.small`, `.w6w-small`) one step smaller than the cell.
51
+ One padding rule for th and td (above) keeps the rhythm uniform. */
52
+ .w6w-data-table td {
53
+ font-size: var(--w6w-fs-sm);
54
+ }
48
55
  .w6w-data-table th {
49
56
  color: var(--w6w-muted);
57
+ font-size: var(--w6w-fs-xs);
58
+ font-weight: 500;
59
+ }
60
+ .w6w-data-table td .small,
61
+ .w6w-data-table td .w6w-small,
62
+ .w6w-data-table td small {
63
+ font-size: var(--w6w-fs-xs);
64
+ }
65
+ /* Actions column (`DataTableColumn.actions`): as narrow as its buttons, never wrapping, right-aligned
66
+ and vertically centred. `width: 1%` makes the auto-layout column shrink to its content. */
67
+ .w6w-data-table th.w6w-data-table-actions,
68
+ .w6w-data-table td.w6w-data-table-actions {
69
+ width: 1%;
70
+ white-space: nowrap;
71
+ text-align: right;
72
+ vertical-align: middle;
73
+ padding-top: var(--w6w-sp-1);
74
+ padding-bottom: var(--w6w-sp-1);
75
+ }
76
+ .w6w-data-table-actions-row {
77
+ display: flex;
78
+ align-items: center;
79
+ justify-content: flex-end;
80
+ gap: var(--w6w-sp-1-5);
81
+ }
82
+ /* A message inside the actions cell (a row's conflict or error) still wraps, at a readable width. */
83
+ .w6w-data-table td.w6w-data-table-actions .w6w-error {
84
+ white-space: normal;
85
+ text-align: left;
86
+ min-width: 14rem;
50
87
  }
51
88
  .w6w-data-table-row-clickable {
52
89
  cursor: pointer;
package/src/styles.css CHANGED
@@ -6622,7 +6622,8 @@ button.w6w-rel-open:focus-visible strong {
6622
6622
  .w6w-data-table td {
6623
6623
  border-right: 1px solid var(--w6w-border);
6624
6624
  border-bottom: 1px solid var(--w6w-border);
6625
- padding: var(--w6w-sp-2) var(--w6w-sp-3);
6625
+ padding: var(--w6w-sp-1-5) var(--w6w-sp-2-5);
6626
+ line-height: 1.35;
6626
6627
  text-align: left;
6627
6628
  vertical-align: middle;
6628
6629
  }
@@ -6651,8 +6652,49 @@ button.w6w-rel-open:focus-visible strong {
6651
6652
  border-bottom: 0;
6652
6653
  }
6653
6654
 
6655
+ /* Density: cells use the scale's small step, the header a muted label one step smaller, and the
6656
+ meta lines inside a cell (`.small`, `.muted.small`, `.w6w-small`) one step smaller than the cell.
6657
+ One padding rule for th and td (above) keeps the rhythm uniform. */
6658
+ .w6w-data-table td {
6659
+ font-size: var(--w6w-fs-sm);
6660
+ }
6661
+
6654
6662
  .w6w-data-table th {
6655
6663
  color: var(--w6w-muted);
6664
+ font-size: var(--w6w-fs-xs);
6665
+ font-weight: 500;
6666
+ }
6667
+
6668
+ .w6w-data-table td .small,
6669
+ .w6w-data-table td .w6w-small,
6670
+ .w6w-data-table td small {
6671
+ font-size: var(--w6w-fs-xs);
6672
+ }
6673
+
6674
+ /* Actions column (`DataTableColumn.actions`): as narrow as its buttons, never wrapping, right-aligned
6675
+ and vertically centred. `width: 1%` makes the auto-layout column shrink to its content. */
6676
+ .w6w-data-table th.w6w-data-table-actions,
6677
+ .w6w-data-table td.w6w-data-table-actions {
6678
+ width: 1%;
6679
+ white-space: nowrap;
6680
+ text-align: right;
6681
+ vertical-align: middle;
6682
+ padding-top: var(--w6w-sp-1);
6683
+ padding-bottom: var(--w6w-sp-1);
6684
+ }
6685
+
6686
+ .w6w-data-table-actions-row {
6687
+ display: flex;
6688
+ align-items: center;
6689
+ justify-content: flex-end;
6690
+ gap: var(--w6w-sp-1-5);
6691
+ }
6692
+
6693
+ /* A message inside the actions cell (a row's conflict or error) still wraps, at a readable width. */
6694
+ .w6w-data-table td.w6w-data-table-actions .w6w-error {
6695
+ white-space: normal;
6696
+ text-align: left;
6697
+ min-width: 14rem;
6656
6698
  }
6657
6699
 
6658
6700
  .w6w-data-table-row-clickable {
@@ -6696,6 +6738,7 @@ button.w6w-rel-open:focus-visible strong {
6696
6738
  .w6w-connection-cell-name {
6697
6739
  display: inline-flex;
6698
6740
  align-items: center;
6741
+ flex-wrap: wrap;
6699
6742
  gap: var(--w6w-sp-2);
6700
6743
  }
6701
6744
 
@@ -7031,7 +7074,7 @@ button.w6w-rel-open:focus-visible strong {
7031
7074
 
7032
7075
  .w6w-data-columns-colhead {
7033
7076
  font-size: var(--w6w-fs-xs);
7034
- font-weight: 500;
7077
+ font-weight: var(--w6w-fw-medium);
7035
7078
  color: var(--w6w-muted);
7036
7079
  }
7037
7080
 
@@ -7048,12 +7091,14 @@ button.w6w-rel-open:focus-visible strong {
7048
7091
  .w6w-data-entries-toolbar {
7049
7092
  display: flex;
7050
7093
  align-items: center;
7094
+ flex-wrap: wrap;
7051
7095
  gap: var(--w6w-sp-2);
7052
- margin: var(--w6w-sp-3) 0;
7096
+ margin: var(--w6w-sp-4) 0;
7053
7097
  }
7054
7098
 
7055
7099
  .w6w-data-entries-toolbar input[type=search] {
7056
7100
  flex: 1;
7101
+ min-width: 8rem;
7057
7102
  max-width: 20rem;
7058
7103
  /* Same box as `.w6w-field` inputs — no host page styles a bare search input. */
7059
7104
  background: var(--w6w-panel-2);
@@ -7070,13 +7115,33 @@ button.w6w-rel-open:focus-visible strong {
7070
7115
  border-color: var(--w6w-accent);
7071
7116
  }
7072
7117
 
7118
+ .w6w-data-entry-new {
7119
+ margin-inline-start: auto;
7120
+ }
7121
+
7073
7122
  /* Entries open a viewer. Keep the list quiet and bounded, even for long keys or JSON. */
7074
7123
  .w6w-data-entry-list {
7075
7124
  table-layout: fixed;
7076
7125
  }
7077
7126
 
7078
- .w6w-data-entry-key,
7127
+ .w6w-data-entry-list td {
7128
+ vertical-align: top;
7129
+ padding-block: var(--w6w-sp-3);
7130
+ }
7131
+
7079
7132
  .w6w-data-entry-preview {
7133
+ display: -webkit-box;
7134
+ -webkit-box-orient: vertical;
7135
+ -webkit-line-clamp: 4;
7136
+ overflow: hidden;
7137
+ white-space: pre-wrap;
7138
+ overflow-wrap: anywhere;
7139
+ font-family: var(--w6w-font-mono);
7140
+ font-size: var(--w6w-fs-sm);
7141
+ line-height: var(--w6w-lh-normal);
7142
+ }
7143
+
7144
+ .w6w-data-entry-key {
7080
7145
  display: block;
7081
7146
  width: 100%;
7082
7147
  overflow: hidden;
@@ -7096,6 +7161,11 @@ button.w6w-rel-open:focus-visible strong {
7096
7161
  cursor: pointer;
7097
7162
  }
7098
7163
 
7164
+ .w6w-data-entry-key:hover {
7165
+ color: var(--w6w-accent);
7166
+ text-decoration: underline;
7167
+ }
7168
+
7099
7169
  .w6w-data-entry-key:focus-visible {
7100
7170
  outline: 2px solid var(--w6w-accent);
7101
7171
  outline-offset: 2px;