@krak-stack/registry 0.11.1 → 0.11.3
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/CHANGELOG.md +14 -0
- package/README.md +22 -0
- package/dist/components/agent/react.js +29 -183
- package/dist/components/animated-list/html.js +1 -105
- package/dist/components/animated-list/react.js +16 -168
- package/dist/components/animated-number/react.js +8 -162
- package/dist/components/app-switcher/html.js +1 -103
- package/dist/components/async-action-button/html.js +1 -101
- package/dist/components/async-action-button/react.js +10 -164
- package/dist/components/audit-log-table/react.js +59 -213
- package/dist/components/bulk-list-input/html.js +2 -102
- package/dist/components/choice-cards/html.js +1 -101
- package/dist/components/code-block/html.js +1 -101
- package/dist/components/code-block/react.js +10 -164
- package/dist/components/copy-button/html.d.ts +2 -2
- package/dist/components/copy-button/html.js +1 -101
- package/dist/components/copy-button/react.js +10 -164
- package/dist/components/copy-value/html.js +6 -105
- package/dist/components/copy-value/react.js +20 -172
- package/dist/components/danger-confirmation/react.js +13 -167
- package/dist/components/data-table/html.d.ts +51 -51
- package/dist/components/data-table/html.js +28 -101
- package/dist/components/data-table/react.js +59 -213
- package/dist/components/date-input/html.js +2 -105
- package/dist/components/editable-text/html.d.ts +2 -2
- package/dist/components/editable-text/html.js +4 -102
- package/dist/components/editable-text/react.js +14 -168
- package/dist/components/editing-locale-switcher/html.js +2 -102
- package/dist/components/email-composer/react.js +25 -174
- package/dist/components/email-editor/html.js +8 -107
- package/dist/components/email-editor/react.js +34 -186
- package/dist/components/error-component/html.d.ts +4 -4
- package/dist/components/error-component/html.js +10 -107
- package/dist/components/error-component/react.js +15 -169
- package/dist/components/file-input/html.js +6 -106
- package/dist/components/icon-input/html.js +3 -103
- package/dist/components/icon-input/react.js +7 -161
- package/dist/components/image-crop-editor/html.js +1 -101
- package/dist/components/image-crop-editor/react.js +19 -173
- package/dist/components/loading/html.js +1 -101
- package/dist/components/locale-switcher/html.js +1 -103
- package/dist/components/map-menu/html.d.ts +8 -8
- package/dist/components/map-menu/html.js +7 -106
- package/dist/components/markdown/html.js +1 -101
- package/dist/components/markdown/react.js +10 -164
- package/dist/components/notification-menu/html.js +7 -114
- package/dist/components/pagination/html.js +5 -100
- package/dist/components/presence-transition/react.js +9 -163
- package/dist/components/registry-previews/component-example.js +10 -164
- package/dist/components/rich-text-editor/html.js +14 -108
- package/dist/components/rich-text-editor/react.js +9 -161
- package/dist/components/search-menu/html.js +1 -103
- package/dist/components/search-menu/react.js +11 -165
- package/dist/components/sidebar-layout/html.js +2 -102
- package/dist/components/sidebar-layout/react.js +3 -157
- package/dist/components/stepper/html.js +4 -102
- package/dist/components/support/html.js +1 -101
- package/dist/components/support/react.js +14 -168
- package/dist/components/theme-switcher/html.js +4 -105
- package/dist/components/time-input/html.d.ts +2 -2
- package/dist/components/time-input/html.js +1 -103
- package/dist/components/timezone-input/react.js +9 -163
- package/dist/components/toast/html.js +11 -104
- package/dist/components/upload-attachment/html.d.ts +4 -4
- package/dist/components/upload-attachment/html.js +7 -102
- package/dist/components/webhook-delivery-table/html.js +28 -101
- package/dist/components/webhook-delivery-table/react.js +74 -226
- package/dist/lib/docs.integrations.server.js +16 -35
- package/dist/lib/docs.js +31 -183
- package/dist/lib/docs.server.js +16 -35
- package/dist/lib/documentation-toolkit.js +19 -38
- package/dist/lib/effect-ui-adapter/use-model.js +158 -0
- package/dist/lib/lucide-effect.d.ts +2432 -0
- package/dist/lib/lucide-effect.js +7428 -0
- package/dist/services/agent/client/index.js +29 -183
- package/package.json +10 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// ../../src/components/locale-switcher/html.ts
|
|
2
2
|
import { Html } from "effect/ui/html";
|
|
3
3
|
import { Menu } from "effect/ui/kit";
|
|
4
|
-
import { Languages } from "lucide";
|
|
5
4
|
|
|
6
5
|
// ../../src/lib/utils.ts
|
|
7
6
|
import { cn } from "cn";
|
|
@@ -59,107 +58,7 @@ var MenuLabel = (h, menu, options) => menu.groupLabel({
|
|
|
59
58
|
|
|
60
59
|
// ../../src/components/locale-switcher/html.ts
|
|
61
60
|
import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
|
|
62
|
-
|
|
63
|
-
// ../../src/lib/lucide-effect.ts
|
|
64
|
-
import {
|
|
65
|
-
ArrowDown as arrowDown,
|
|
66
|
-
ArrowUp as arrowUp,
|
|
67
|
-
ListFilter as listFilter,
|
|
68
|
-
Check as check,
|
|
69
|
-
ChevronLeft as chevronLeft,
|
|
70
|
-
ChevronDown as chevronDown,
|
|
71
|
-
ChevronRight as chevronRight,
|
|
72
|
-
ChevronsLeft as chevronsLeft,
|
|
73
|
-
ChevronsRight as chevronsRight,
|
|
74
|
-
ChevronsUpDown as chevronsUpDown,
|
|
75
|
-
Copy as copy,
|
|
76
|
-
Download as download,
|
|
77
|
-
Eye as eye,
|
|
78
|
-
EyeOff as eyeOff,
|
|
79
|
-
Ellipsis as ellipsis,
|
|
80
|
-
FileJson as fileJson,
|
|
81
|
-
FileText as fileText,
|
|
82
|
-
GripVertical as gripVertical,
|
|
83
|
-
Image as image,
|
|
84
|
-
LayoutGrid as layoutGrid,
|
|
85
|
-
LoaderCircle as loaderCircle,
|
|
86
|
-
Mail as mail,
|
|
87
|
-
Paperclip as paperclip,
|
|
88
|
-
RefreshCw as refreshCw,
|
|
89
|
-
RotateCcw as rotateCcw,
|
|
90
|
-
Rows3 as rows3,
|
|
91
|
-
Search as search,
|
|
92
|
-
Settings2 as settings2,
|
|
93
|
-
TriangleAlert as triangleAlert,
|
|
94
|
-
X as x
|
|
95
|
-
} from "lucide";
|
|
96
|
-
var createLucideIcon = (icon) => (h, {
|
|
97
|
-
size = 24,
|
|
98
|
-
color = "currentColor",
|
|
99
|
-
strokeWidth = 2,
|
|
100
|
-
className
|
|
101
|
-
} = {}) => h.svg.attrs({
|
|
102
|
-
class: className,
|
|
103
|
-
width: String(size),
|
|
104
|
-
height: String(size),
|
|
105
|
-
viewBox: "0 0 24 24",
|
|
106
|
-
fill: "none",
|
|
107
|
-
stroke: color,
|
|
108
|
-
"stroke-width": String(strokeWidth),
|
|
109
|
-
"stroke-linecap": "round",
|
|
110
|
-
"stroke-linejoin": "round",
|
|
111
|
-
"aria-hidden": "true"
|
|
112
|
-
}).children(...icon.map(([tag, attributes]) => {
|
|
113
|
-
const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
|
|
114
|
-
switch (tag) {
|
|
115
|
-
case "path":
|
|
116
|
-
return h.path.attrs(attrs);
|
|
117
|
-
case "circle":
|
|
118
|
-
return h.circle.attrs(attrs);
|
|
119
|
-
case "ellipse":
|
|
120
|
-
return h.ellipse.attrs(attrs);
|
|
121
|
-
case "line":
|
|
122
|
-
return h.line.attrs(attrs);
|
|
123
|
-
case "polyline":
|
|
124
|
-
return h.polyline.attrs(attrs);
|
|
125
|
-
case "polygon":
|
|
126
|
-
return h.polygon.attrs(attrs);
|
|
127
|
-
case "rect":
|
|
128
|
-
return h.rect.attrs(attrs);
|
|
129
|
-
default:
|
|
130
|
-
throw new Error(`Unsupported Lucide SVG element: ${tag}`);
|
|
131
|
-
}
|
|
132
|
-
}));
|
|
133
|
-
var Check = createLucideIcon(check);
|
|
134
|
-
var ArrowDown = createLucideIcon(arrowDown);
|
|
135
|
-
var ArrowUp = createLucideIcon(arrowUp);
|
|
136
|
-
var ListFilter = createLucideIcon(listFilter);
|
|
137
|
-
var ChevronLeft = createLucideIcon(chevronLeft);
|
|
138
|
-
var ChevronDown = createLucideIcon(chevronDown);
|
|
139
|
-
var ChevronRight = createLucideIcon(chevronRight);
|
|
140
|
-
var ChevronsLeft = createLucideIcon(chevronsLeft);
|
|
141
|
-
var ChevronsRight = createLucideIcon(chevronsRight);
|
|
142
|
-
var ChevronsUpDown = createLucideIcon(chevronsUpDown);
|
|
143
|
-
var Copy = createLucideIcon(copy);
|
|
144
|
-
var Download = createLucideIcon(download);
|
|
145
|
-
var Eye = createLucideIcon(eye);
|
|
146
|
-
var EyeOff = createLucideIcon(eyeOff);
|
|
147
|
-
var Ellipsis = createLucideIcon(ellipsis);
|
|
148
|
-
var FileJson = createLucideIcon(fileJson);
|
|
149
|
-
var FileText = createLucideIcon(fileText);
|
|
150
|
-
var GripVertical = createLucideIcon(gripVertical);
|
|
151
|
-
var Image = createLucideIcon(image);
|
|
152
|
-
var LayoutGrid = createLucideIcon(layoutGrid);
|
|
153
|
-
var LoaderCircle = createLucideIcon(loaderCircle);
|
|
154
|
-
var Mail = createLucideIcon(mail);
|
|
155
|
-
var Paperclip = createLucideIcon(paperclip);
|
|
156
|
-
var RefreshCw = createLucideIcon(refreshCw);
|
|
157
|
-
var RotateCcw = createLucideIcon(rotateCcw);
|
|
158
|
-
var Rows3 = createLucideIcon(rows3);
|
|
159
|
-
var Search = createLucideIcon(search);
|
|
160
|
-
var Settings2 = createLucideIcon(settings2);
|
|
161
|
-
var TriangleAlert = createLucideIcon(triangleAlert);
|
|
162
|
-
var X = createLucideIcon(x);
|
|
61
|
+
import { Languages as LanguagesIcon } from "@krak-stack/registry/lucide-effect";
|
|
163
62
|
|
|
164
63
|
// ../../src/components/locale-switcher/index.ts
|
|
165
64
|
import { Schema as Schema2 } from "effect";
|
|
@@ -219,7 +118,6 @@ var localeSwitcherBehaviours = {
|
|
|
219
118
|
};
|
|
220
119
|
|
|
221
120
|
// ../../src/components/locale-switcher/html.ts
|
|
222
|
-
var LanguagesIcon = createLucideIcon(Languages);
|
|
223
121
|
var LocaleSwitcher = Html.component({
|
|
224
122
|
...localeSwitcherOptions,
|
|
225
123
|
reads: { localeConfig: krakstackLocaleRead }
|
|
@@ -81,10 +81,10 @@ export declare const makeMapMenu: (viewportHost?: MapViewportHost) => import("ef
|
|
|
81
81
|
readonly revision: number;
|
|
82
82
|
} | null;
|
|
83
83
|
}, {
|
|
84
|
+
readonly _tag: "Cancel";
|
|
85
|
+
} | {
|
|
84
86
|
readonly _tag: "CameraRequested";
|
|
85
87
|
readonly action: "fit" | "in" | "out";
|
|
86
|
-
} | {
|
|
87
|
-
readonly _tag: "Cancel";
|
|
88
88
|
} | {
|
|
89
89
|
readonly _tag: "Confirm";
|
|
90
90
|
} | {
|
|
@@ -112,9 +112,9 @@ export declare const makeMapMenu: (viewportHost?: MapViewportHost) => import("ef
|
|
|
112
112
|
readonly _tag: "ZoomChanged";
|
|
113
113
|
readonly zoom: number;
|
|
114
114
|
}, {
|
|
115
|
-
readonly _tag: "Confirmed";
|
|
116
|
-
} | {
|
|
117
115
|
readonly _tag: "Cancelled";
|
|
116
|
+
} | {
|
|
117
|
+
readonly _tag: "Confirmed";
|
|
118
118
|
} | {
|
|
119
119
|
readonly _tag: "CurrentLocationRequested";
|
|
120
120
|
} | {
|
|
@@ -214,10 +214,10 @@ export declare const MapMenu: import("effect/ui/Component").Component<"MapMenu",
|
|
|
214
214
|
readonly revision: number;
|
|
215
215
|
} | null;
|
|
216
216
|
}, {
|
|
217
|
+
readonly _tag: "Cancel";
|
|
218
|
+
} | {
|
|
217
219
|
readonly _tag: "CameraRequested";
|
|
218
220
|
readonly action: "fit" | "in" | "out";
|
|
219
|
-
} | {
|
|
220
|
-
readonly _tag: "Cancel";
|
|
221
221
|
} | {
|
|
222
222
|
readonly _tag: "Confirm";
|
|
223
223
|
} | {
|
|
@@ -245,9 +245,9 @@ export declare const MapMenu: import("effect/ui/Component").Component<"MapMenu",
|
|
|
245
245
|
readonly _tag: "ZoomChanged";
|
|
246
246
|
readonly zoom: number;
|
|
247
247
|
}, {
|
|
248
|
-
readonly _tag: "Confirmed";
|
|
249
|
-
} | {
|
|
250
248
|
readonly _tag: "Cancelled";
|
|
249
|
+
} | {
|
|
250
|
+
readonly _tag: "Confirmed";
|
|
251
251
|
} | {
|
|
252
252
|
readonly _tag: "CurrentLocationRequested";
|
|
253
253
|
} | {
|
|
@@ -3,7 +3,6 @@ import { Effect as Effect3, Redacted as Redacted2, Schema as Schema3, Stream as
|
|
|
3
3
|
import { Mount } from "effect/ui";
|
|
4
4
|
import { Html } from "effect/ui/html";
|
|
5
5
|
import { Combobox, Dialog } from "effect/ui/kit";
|
|
6
|
-
import { LocateFixed, MapPin, Minus, Plus, Search as Search2 } from "lucide";
|
|
7
6
|
|
|
8
7
|
// ../../src/components/effectcn/button.ts
|
|
9
8
|
import {
|
|
@@ -79,107 +78,14 @@ var DialogTitle = (h, dialog, options = {}) => dialog.title(h.h2.class(cn("m-0 b
|
|
|
79
78
|
|
|
80
79
|
// ../../src/components/map-menu/html.ts
|
|
81
80
|
import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
|
|
82
|
-
|
|
83
|
-
// ../../src/lib/lucide-effect.ts
|
|
84
81
|
import {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
ChevronsLeft as chevronsLeft,
|
|
93
|
-
ChevronsRight as chevronsRight,
|
|
94
|
-
ChevronsUpDown as chevronsUpDown,
|
|
95
|
-
Copy as copy,
|
|
96
|
-
Download as download,
|
|
97
|
-
Eye as eye,
|
|
98
|
-
EyeOff as eyeOff,
|
|
99
|
-
Ellipsis as ellipsis,
|
|
100
|
-
FileJson as fileJson,
|
|
101
|
-
FileText as fileText,
|
|
102
|
-
GripVertical as gripVertical,
|
|
103
|
-
Image as image,
|
|
104
|
-
LayoutGrid as layoutGrid,
|
|
105
|
-
LoaderCircle as loaderCircle,
|
|
106
|
-
Mail as mail,
|
|
107
|
-
Paperclip as paperclip,
|
|
108
|
-
RefreshCw as refreshCw,
|
|
109
|
-
RotateCcw as rotateCcw,
|
|
110
|
-
Rows3 as rows3,
|
|
111
|
-
Search as search,
|
|
112
|
-
Settings2 as settings2,
|
|
113
|
-
TriangleAlert as triangleAlert,
|
|
114
|
-
X as x
|
|
115
|
-
} from "lucide";
|
|
116
|
-
var createLucideIcon = (icon) => (h, {
|
|
117
|
-
size = 24,
|
|
118
|
-
color = "currentColor",
|
|
119
|
-
strokeWidth = 2,
|
|
120
|
-
className
|
|
121
|
-
} = {}) => h.svg.attrs({
|
|
122
|
-
class: className,
|
|
123
|
-
width: String(size),
|
|
124
|
-
height: String(size),
|
|
125
|
-
viewBox: "0 0 24 24",
|
|
126
|
-
fill: "none",
|
|
127
|
-
stroke: color,
|
|
128
|
-
"stroke-width": String(strokeWidth),
|
|
129
|
-
"stroke-linecap": "round",
|
|
130
|
-
"stroke-linejoin": "round",
|
|
131
|
-
"aria-hidden": "true"
|
|
132
|
-
}).children(...icon.map(([tag, attributes]) => {
|
|
133
|
-
const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
|
|
134
|
-
switch (tag) {
|
|
135
|
-
case "path":
|
|
136
|
-
return h.path.attrs(attrs);
|
|
137
|
-
case "circle":
|
|
138
|
-
return h.circle.attrs(attrs);
|
|
139
|
-
case "ellipse":
|
|
140
|
-
return h.ellipse.attrs(attrs);
|
|
141
|
-
case "line":
|
|
142
|
-
return h.line.attrs(attrs);
|
|
143
|
-
case "polyline":
|
|
144
|
-
return h.polyline.attrs(attrs);
|
|
145
|
-
case "polygon":
|
|
146
|
-
return h.polygon.attrs(attrs);
|
|
147
|
-
case "rect":
|
|
148
|
-
return h.rect.attrs(attrs);
|
|
149
|
-
default:
|
|
150
|
-
throw new Error(`Unsupported Lucide SVG element: ${tag}`);
|
|
151
|
-
}
|
|
152
|
-
}));
|
|
153
|
-
var Check = createLucideIcon(check);
|
|
154
|
-
var ArrowDown = createLucideIcon(arrowDown);
|
|
155
|
-
var ArrowUp = createLucideIcon(arrowUp);
|
|
156
|
-
var ListFilter = createLucideIcon(listFilter);
|
|
157
|
-
var ChevronLeft = createLucideIcon(chevronLeft);
|
|
158
|
-
var ChevronDown = createLucideIcon(chevronDown);
|
|
159
|
-
var ChevronRight = createLucideIcon(chevronRight);
|
|
160
|
-
var ChevronsLeft = createLucideIcon(chevronsLeft);
|
|
161
|
-
var ChevronsRight = createLucideIcon(chevronsRight);
|
|
162
|
-
var ChevronsUpDown = createLucideIcon(chevronsUpDown);
|
|
163
|
-
var Copy = createLucideIcon(copy);
|
|
164
|
-
var Download = createLucideIcon(download);
|
|
165
|
-
var Eye = createLucideIcon(eye);
|
|
166
|
-
var EyeOff = createLucideIcon(eyeOff);
|
|
167
|
-
var Ellipsis = createLucideIcon(ellipsis);
|
|
168
|
-
var FileJson = createLucideIcon(fileJson);
|
|
169
|
-
var FileText = createLucideIcon(fileText);
|
|
170
|
-
var GripVertical = createLucideIcon(gripVertical);
|
|
171
|
-
var Image = createLucideIcon(image);
|
|
172
|
-
var LayoutGrid = createLucideIcon(layoutGrid);
|
|
173
|
-
var LoaderCircle = createLucideIcon(loaderCircle);
|
|
174
|
-
var Mail = createLucideIcon(mail);
|
|
175
|
-
var Paperclip = createLucideIcon(paperclip);
|
|
176
|
-
var RefreshCw = createLucideIcon(refreshCw);
|
|
177
|
-
var RotateCcw = createLucideIcon(rotateCcw);
|
|
178
|
-
var Rows3 = createLucideIcon(rows3);
|
|
179
|
-
var Search = createLucideIcon(search);
|
|
180
|
-
var Settings2 = createLucideIcon(settings2);
|
|
181
|
-
var TriangleAlert = createLucideIcon(triangleAlert);
|
|
182
|
-
var X = createLucideIcon(x);
|
|
82
|
+
LocateFixed as LocateIcon,
|
|
83
|
+
MapPin as Pin,
|
|
84
|
+
Minus as ZoomOut,
|
|
85
|
+
Plus as ZoomIn,
|
|
86
|
+
Search as SearchIcon,
|
|
87
|
+
X
|
|
88
|
+
} from "@krak-stack/registry/lucide-effect";
|
|
183
89
|
|
|
184
90
|
// ../../src/components/map-menu/classes.ts
|
|
185
91
|
var mapMenuClasses = {
|
|
@@ -697,11 +603,6 @@ var mapMenuBehaviours = {
|
|
|
697
603
|
};
|
|
698
604
|
|
|
699
605
|
// ../../src/components/map-menu/html.ts
|
|
700
|
-
var LocateIcon = createLucideIcon(LocateFixed);
|
|
701
|
-
var Pin = createLucideIcon(MapPin);
|
|
702
|
-
var ZoomIn = createLucideIcon(Plus);
|
|
703
|
-
var ZoomOut = createLucideIcon(Minus);
|
|
704
|
-
var SearchIcon = createLucideIcon(Search2);
|
|
705
606
|
var isOptionId = Schema3.is(Schema3.String);
|
|
706
607
|
var PreventSearchSubmit = Mount.make("MapMenu/PreventSearchSubmit", {}, (node) => {
|
|
707
608
|
const prevent = (event) => {
|
|
@@ -49,107 +49,7 @@ var Button = (h, options = {}) => KitButton(h, {
|
|
|
49
49
|
|
|
50
50
|
// ../../src/components/copy-button/html.ts
|
|
51
51
|
import { krakstackLocaleRead } from "@krak-stack/registry/krakstack-provider/html";
|
|
52
|
-
|
|
53
|
-
// ../../src/lib/lucide-effect.ts
|
|
54
|
-
import {
|
|
55
|
-
ArrowDown as arrowDown,
|
|
56
|
-
ArrowUp as arrowUp,
|
|
57
|
-
ListFilter as listFilter,
|
|
58
|
-
Check as check,
|
|
59
|
-
ChevronLeft as chevronLeft,
|
|
60
|
-
ChevronDown as chevronDown,
|
|
61
|
-
ChevronRight as chevronRight,
|
|
62
|
-
ChevronsLeft as chevronsLeft,
|
|
63
|
-
ChevronsRight as chevronsRight,
|
|
64
|
-
ChevronsUpDown as chevronsUpDown,
|
|
65
|
-
Copy as copy,
|
|
66
|
-
Download as download,
|
|
67
|
-
Eye as eye,
|
|
68
|
-
EyeOff as eyeOff,
|
|
69
|
-
Ellipsis as ellipsis,
|
|
70
|
-
FileJson as fileJson,
|
|
71
|
-
FileText as fileText,
|
|
72
|
-
GripVertical as gripVertical,
|
|
73
|
-
Image as image,
|
|
74
|
-
LayoutGrid as layoutGrid,
|
|
75
|
-
LoaderCircle as loaderCircle,
|
|
76
|
-
Mail as mail,
|
|
77
|
-
Paperclip as paperclip,
|
|
78
|
-
RefreshCw as refreshCw,
|
|
79
|
-
RotateCcw as rotateCcw,
|
|
80
|
-
Rows3 as rows3,
|
|
81
|
-
Search as search,
|
|
82
|
-
Settings2 as settings2,
|
|
83
|
-
TriangleAlert as triangleAlert,
|
|
84
|
-
X as x
|
|
85
|
-
} from "lucide";
|
|
86
|
-
var createLucideIcon = (icon) => (h, {
|
|
87
|
-
size = 24,
|
|
88
|
-
color = "currentColor",
|
|
89
|
-
strokeWidth = 2,
|
|
90
|
-
className
|
|
91
|
-
} = {}) => h.svg.attrs({
|
|
92
|
-
class: className,
|
|
93
|
-
width: String(size),
|
|
94
|
-
height: String(size),
|
|
95
|
-
viewBox: "0 0 24 24",
|
|
96
|
-
fill: "none",
|
|
97
|
-
stroke: color,
|
|
98
|
-
"stroke-width": String(strokeWidth),
|
|
99
|
-
"stroke-linecap": "round",
|
|
100
|
-
"stroke-linejoin": "round",
|
|
101
|
-
"aria-hidden": "true"
|
|
102
|
-
}).children(...icon.map(([tag, attributes]) => {
|
|
103
|
-
const attrs = Object.fromEntries(Object.entries(attributes).flatMap(([name, value]) => value === undefined ? [] : [[name, String(value)]]));
|
|
104
|
-
switch (tag) {
|
|
105
|
-
case "path":
|
|
106
|
-
return h.path.attrs(attrs);
|
|
107
|
-
case "circle":
|
|
108
|
-
return h.circle.attrs(attrs);
|
|
109
|
-
case "ellipse":
|
|
110
|
-
return h.ellipse.attrs(attrs);
|
|
111
|
-
case "line":
|
|
112
|
-
return h.line.attrs(attrs);
|
|
113
|
-
case "polyline":
|
|
114
|
-
return h.polyline.attrs(attrs);
|
|
115
|
-
case "polygon":
|
|
116
|
-
return h.polygon.attrs(attrs);
|
|
117
|
-
case "rect":
|
|
118
|
-
return h.rect.attrs(attrs);
|
|
119
|
-
default:
|
|
120
|
-
throw new Error(`Unsupported Lucide SVG element: ${tag}`);
|
|
121
|
-
}
|
|
122
|
-
}));
|
|
123
|
-
var Check = createLucideIcon(check);
|
|
124
|
-
var ArrowDown = createLucideIcon(arrowDown);
|
|
125
|
-
var ArrowUp = createLucideIcon(arrowUp);
|
|
126
|
-
var ListFilter = createLucideIcon(listFilter);
|
|
127
|
-
var ChevronLeft = createLucideIcon(chevronLeft);
|
|
128
|
-
var ChevronDown = createLucideIcon(chevronDown);
|
|
129
|
-
var ChevronRight = createLucideIcon(chevronRight);
|
|
130
|
-
var ChevronsLeft = createLucideIcon(chevronsLeft);
|
|
131
|
-
var ChevronsRight = createLucideIcon(chevronsRight);
|
|
132
|
-
var ChevronsUpDown = createLucideIcon(chevronsUpDown);
|
|
133
|
-
var Copy = createLucideIcon(copy);
|
|
134
|
-
var Download = createLucideIcon(download);
|
|
135
|
-
var Eye = createLucideIcon(eye);
|
|
136
|
-
var EyeOff = createLucideIcon(eyeOff);
|
|
137
|
-
var Ellipsis = createLucideIcon(ellipsis);
|
|
138
|
-
var FileJson = createLucideIcon(fileJson);
|
|
139
|
-
var FileText = createLucideIcon(fileText);
|
|
140
|
-
var GripVertical = createLucideIcon(gripVertical);
|
|
141
|
-
var Image = createLucideIcon(image);
|
|
142
|
-
var LayoutGrid = createLucideIcon(layoutGrid);
|
|
143
|
-
var LoaderCircle = createLucideIcon(loaderCircle);
|
|
144
|
-
var Mail = createLucideIcon(mail);
|
|
145
|
-
var Paperclip = createLucideIcon(paperclip);
|
|
146
|
-
var RefreshCw = createLucideIcon(refreshCw);
|
|
147
|
-
var RotateCcw = createLucideIcon(rotateCcw);
|
|
148
|
-
var Rows3 = createLucideIcon(rows3);
|
|
149
|
-
var Search = createLucideIcon(search);
|
|
150
|
-
var Settings2 = createLucideIcon(settings2);
|
|
151
|
-
var TriangleAlert = createLucideIcon(triangleAlert);
|
|
152
|
-
var X = createLucideIcon(x);
|
|
52
|
+
import { Check, Copy, TriangleAlert } from "@krak-stack/registry/lucide-effect";
|
|
153
53
|
|
|
154
54
|
// ../../src/components/copy-button/index.ts
|
|
155
55
|
import { Effect, Redacted, Schema as Schema2 } from "effect";
|
|
@@ -50,167 +50,13 @@ function Button({
|
|
|
50
50
|
import { Check, Copy, TriangleAlert } from "lucide-react";
|
|
51
51
|
import { Redacted as Redacted2 } from "effect";
|
|
52
52
|
import { Component as Component2 } from "effect/ui";
|
|
53
|
-
import { useLayoutEffect
|
|
53
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
54
54
|
import { useKrakstackLocale } from "@krak-stack/registry/krakstack-provider/react";
|
|
55
|
-
|
|
56
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
57
|
-
import { MessageLog as MessageLog2 } from "effect/ui";
|
|
58
|
-
import {
|
|
59
|
-
createContext,
|
|
60
|
-
useCallback,
|
|
61
|
-
useContext,
|
|
62
|
-
useEffect,
|
|
63
|
-
useLayoutEffect,
|
|
64
|
-
useRef,
|
|
65
|
-
useState,
|
|
66
|
-
useSyncExternalStore
|
|
67
|
-
} from "react";
|
|
68
|
-
|
|
69
|
-
// ../../src/lib/effect-ui-adapter/model-runtime.ts
|
|
70
|
-
import { MessageLog, Renderer, View } from "effect/ui";
|
|
71
|
-
import { BrowserHost, Html } from "effect/ui/html";
|
|
72
|
-
import { Cause, Effect, Fiber } from "effect";
|
|
73
|
-
var node = () => ({ children: [] });
|
|
74
|
-
var modelHost = (commit) => {
|
|
75
|
-
const remove = (child) => {
|
|
76
|
-
if (!child.parent)
|
|
77
|
-
return;
|
|
78
|
-
child.parent.children.splice(child.parent.children.indexOf(child), 1);
|
|
79
|
-
delete child.parent;
|
|
80
|
-
};
|
|
81
|
-
return {
|
|
82
|
-
createElement: node,
|
|
83
|
-
createText: node,
|
|
84
|
-
setText: () => {},
|
|
85
|
-
setAttr: () => {},
|
|
86
|
-
setProp: () => {},
|
|
87
|
-
setEvents: () => {},
|
|
88
|
-
insertBefore: (parent, child, before) => {
|
|
89
|
-
if (child === before)
|
|
90
|
-
return;
|
|
91
|
-
remove(child);
|
|
92
|
-
const index = before ? parent.children.indexOf(before) : parent.children.length;
|
|
93
|
-
parent.children.splice(index, 0, child);
|
|
94
|
-
child.parent = parent;
|
|
95
|
-
},
|
|
96
|
-
remove,
|
|
97
|
-
parentOf: (child) => child.parent,
|
|
98
|
-
nextOf: (child) => child.parent?.children[child.parent.children.indexOf(child) + 1],
|
|
99
|
-
elements: ["html"],
|
|
100
|
-
controlled: new Set,
|
|
101
|
-
runsMounts: false,
|
|
102
|
-
commit
|
|
103
|
-
};
|
|
104
|
-
};
|
|
105
|
-
var mountModel = (component, props, publishSnapshot, messageLog, onEmit) => {
|
|
106
|
-
let currentProps = props;
|
|
107
|
-
let root;
|
|
108
|
-
let active = true;
|
|
109
|
-
let failure;
|
|
110
|
-
const publish = () => {
|
|
111
|
-
if (!active)
|
|
112
|
-
return;
|
|
113
|
-
if (failure) {
|
|
114
|
-
publishSnapshot({ error: failure });
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const current = root?.model();
|
|
118
|
-
if (current !== undefined)
|
|
119
|
-
publishSnapshot({ model: current });
|
|
120
|
-
};
|
|
121
|
-
const fiber = Effect.runFork(Effect.scoped(Effect.gen(function* () {
|
|
122
|
-
const mounted = yield* Renderer.mount(component, Effect.succeed(props), node(), {
|
|
123
|
-
head: false,
|
|
124
|
-
onEmit,
|
|
125
|
-
fallback: ({ cause }) => {
|
|
126
|
-
failure = new Error("Effect UI root failed", {
|
|
127
|
-
cause: Cause.squash(cause)
|
|
128
|
-
});
|
|
129
|
-
return View.text("");
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
if (!active)
|
|
133
|
-
return;
|
|
134
|
-
root = mounted;
|
|
135
|
-
if (props !== currentProps)
|
|
136
|
-
mounted.setProps(currentProps);
|
|
137
|
-
publish();
|
|
138
|
-
return yield* Effect.never;
|
|
139
|
-
}).pipe(Effect.provide(Renderer.layer(modelHost(publish))), Effect.provideService(Html.Host, BrowserHost.htmlHost), Effect.provideService(MessageLog.MessageLog, messageLog))));
|
|
140
|
-
return {
|
|
141
|
-
send: (message) => {
|
|
142
|
-
root?.send(message);
|
|
143
|
-
publish();
|
|
144
|
-
},
|
|
145
|
-
setProps: (next) => {
|
|
146
|
-
currentProps = next;
|
|
147
|
-
root?.setProps(next);
|
|
148
|
-
},
|
|
149
|
-
dispose: () => {
|
|
150
|
-
active = false;
|
|
151
|
-
root = undefined;
|
|
152
|
-
Effect.runFork(Fiber.interrupt(fiber));
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
// ../../src/lib/effect-ui-adapter/use-model.ts
|
|
158
|
-
"use client";
|
|
159
|
-
var ModelMessageLogContext = createContext(undefined);
|
|
160
|
-
var useModel = (component, props, options = {}) => {
|
|
161
|
-
const contextLog = useContext(ModelMessageLogContext);
|
|
162
|
-
const messageLog = options.messageLog ?? (contextLog === undefined ? MessageLog2.noop : contextLog);
|
|
163
|
-
const [store] = useState(() => {
|
|
164
|
-
const initial = { model: component.init(props).model };
|
|
165
|
-
let snapshot = initial;
|
|
166
|
-
const listeners = new Set;
|
|
167
|
-
return {
|
|
168
|
-
subscribe: (listener) => {
|
|
169
|
-
listeners.add(listener);
|
|
170
|
-
return () => {
|
|
171
|
-
listeners.delete(listener);
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
getSnapshot: () => snapshot,
|
|
175
|
-
getServerSnapshot: () => initial,
|
|
176
|
-
publish: (next) => {
|
|
177
|
-
if ("model" in snapshot && "model" in next && Object.is(snapshot.model, next.model))
|
|
178
|
-
return;
|
|
179
|
-
if ("error" in snapshot && "error" in next && snapshot.error === next.error)
|
|
180
|
-
return;
|
|
181
|
-
snapshot = next;
|
|
182
|
-
listeners.forEach((listener) => listener());
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
});
|
|
186
|
-
const snapshot = useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
187
|
-
const committed = useRef(props);
|
|
188
|
-
const onEmit = useRef(options.onEmit);
|
|
189
|
-
const runtime = useRef(undefined);
|
|
190
|
-
const send = useCallback((message) => runtime.current?.send(message), []);
|
|
191
|
-
useLayoutEffect(() => {
|
|
192
|
-
onEmit.current = options.onEmit;
|
|
193
|
-
committed.current = props;
|
|
194
|
-
runtime.current?.setProps(props);
|
|
195
|
-
}, [props, options.onEmit]);
|
|
196
|
-
useEffect(() => {
|
|
197
|
-
if (messageLog === null)
|
|
198
|
-
return;
|
|
199
|
-
const mounted = mountModel(component, committed.current, store.publish, messageLog, (event) => onEmit.current?.(event));
|
|
200
|
-
runtime.current = mounted;
|
|
201
|
-
return () => {
|
|
202
|
-
runtime.current = undefined;
|
|
203
|
-
mounted.dispose();
|
|
204
|
-
};
|
|
205
|
-
}, [component, messageLog, store]);
|
|
206
|
-
if ("error" in snapshot)
|
|
207
|
-
throw snapshot.error;
|
|
208
|
-
return { model: snapshot.model, send };
|
|
209
|
-
};
|
|
55
|
+
import { useModel } from "@krak-stack/registry/effect-ui-adapter/react";
|
|
210
56
|
|
|
211
57
|
// ../../src/components/copy-button/index.ts
|
|
212
|
-
import { Effect
|
|
213
|
-
import { Command, Component, UiSchema, View
|
|
58
|
+
import { Effect, Redacted, Schema as Schema2 } from "effect";
|
|
59
|
+
import { Command, Component, UiSchema, View } from "effect/ui";
|
|
214
60
|
|
|
215
61
|
// ../../src/components/copy-button/schema.ts
|
|
216
62
|
import { Schema } from "effect";
|
|
@@ -265,13 +111,13 @@ class WriteClipboard extends Command.Service()("copy-button/WriteClipboard", {
|
|
|
265
111
|
},
|
|
266
112
|
success: CopyButtonMessage
|
|
267
113
|
}) {
|
|
268
|
-
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) =>
|
|
114
|
+
static layerFromWrite = (write) => WriteClipboard.toLayer(({ value }) => Effect.tryPromise(() => write(Redacted.value(value))).pipe(Effect.match({
|
|
269
115
|
onSuccess: () => CopyButtonMessage.Finished({ success: true }),
|
|
270
116
|
onFailure: () => CopyButtonMessage.Finished({ success: false })
|
|
271
117
|
})));
|
|
272
118
|
static browser = WriteClipboard.layerFromWrite((value) => navigator.clipboard.writeText(value));
|
|
273
119
|
}
|
|
274
|
-
var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema2.Number }, mode: "switch" }, ({ delay }) =>
|
|
120
|
+
var ResetClipboardFeedback = Command.make("copy-button/ResetFeedback", { args: { delay: Schema2.Number }, mode: "switch" }, ({ delay }) => Effect.sleep(Math.max(0, delay)).pipe(Effect.as(CopyButtonMessage.Reset())));
|
|
275
121
|
var copyButtonOptions = {
|
|
276
122
|
name: "CopyButton",
|
|
277
123
|
props: CopyButtonModelProps,
|
|
@@ -293,7 +139,7 @@ var copyButtonBehaviours = {
|
|
|
293
139
|
};
|
|
294
140
|
var CopyButtonModel = Definition.make({
|
|
295
141
|
...copyButtonBehaviours,
|
|
296
|
-
view: () =>
|
|
142
|
+
view: () => View.text("")
|
|
297
143
|
});
|
|
298
144
|
var copyButtonStatus = (status, copy, description) => {
|
|
299
145
|
if (status === "idle")
|
|
@@ -321,19 +167,19 @@ function CopyButton({
|
|
|
321
167
|
}) {
|
|
322
168
|
const locale = useKrakstackLocale(localeOverride);
|
|
323
169
|
const labels = copyButtonMessages(locale, messages);
|
|
324
|
-
const callbacks =
|
|
170
|
+
const callbacks = useRef({
|
|
325
171
|
onCopied,
|
|
326
172
|
onCopyError,
|
|
327
173
|
failureLabel: labels.copyFailed
|
|
328
174
|
});
|
|
329
|
-
|
|
175
|
+
useLayoutEffect(() => {
|
|
330
176
|
callbacks.current = {
|
|
331
177
|
onCopied,
|
|
332
178
|
onCopyError,
|
|
333
179
|
failureLabel: labels.copyFailed
|
|
334
180
|
};
|
|
335
181
|
}, [onCopied, onCopyError, labels.copyFailed]);
|
|
336
|
-
const [component] =
|
|
182
|
+
const [component] = useState(() => CopyButtonModel.pipe(Component2.provide(WriteClipboard.layerFromWrite(async (text) => {
|
|
337
183
|
const { onCopied, onCopyError, failureLabel } = callbacks.current;
|
|
338
184
|
try {
|
|
339
185
|
await navigator.clipboard.writeText(text);
|