@code0-tech/pictor 0.3.0 → 0.4.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.
- package/dist/_virtual/compiler-runtime.js +5 -0
- package/dist/_virtual/compiler-runtime2.js +4 -0
- package/dist/_virtual/react-compiler-runtime.development.js +4 -0
- package/dist/_virtual/react-compiler-runtime.production.js +4 -0
- package/dist/assets/components/alert/Alert.style.css +1 -0
- package/dist/assets/components/aurora/Aurora.style.css +1 -0
- package/dist/assets/components/avatar/Avatar.style.css +1 -0
- package/dist/assets/components/badge/Badge.style.css +1 -0
- package/dist/assets/components/breadcrumb/Breadcrumb.style.css +1 -0
- package/dist/assets/components/button/Button.style.css +1 -0
- package/dist/assets/components/button-group/ButtonGroup.style.css +1 -0
- package/dist/assets/components/card/Card.style.css +1 -0
- package/dist/assets/components/col/Col.style.css +1 -0
- package/dist/assets/components/command/Command.style.css +1 -0
- package/dist/assets/components/container/Container.style.css +1 -0
- package/dist/assets/components/context-menu/ContextMenu.style.css +1 -0
- package/dist/assets/components/data-table/DataTable.style.css +1 -0
- package/dist/assets/components/dialog/Dialog.style.css +1 -0
- package/dist/assets/components/editor/Editor.styles.css +1 -0
- package/dist/assets/components/file-tabs/FileTabs.style.css +1 -0
- package/dist/assets/components/flex/Flex.style.css +1 -0
- package/dist/assets/components/form/Input.style.css +1 -0
- package/dist/assets/components/fullscreen/FullScreen.style.css +1 -0
- package/dist/assets/components/layout/Layout.style.css +1 -0
- package/dist/assets/components/menu/Menu.style.css +1 -0
- package/dist/assets/components/quote/Quote.style.css +1 -0
- package/dist/assets/components/resizable/Resizable.style.css +1 -0
- package/dist/assets/components/row/Row.style.css +1 -0
- package/dist/assets/components/scroll-area/ScrollArea.style.css +1 -0
- package/dist/assets/components/segmented-control/SegmentedControl.style.css +1 -0
- package/dist/assets/components/spacing/Spacing.style.css +1 -0
- package/dist/assets/components/tab/Tab.style.css +1 -0
- package/dist/assets/components/text/Text.style.css +1 -0
- package/dist/assets/components/toast/Toast.style.css +1 -0
- package/dist/assets/components/tooltip/Tooltip.style.css +1 -0
- package/dist/components/alert/Alert.d.ts +7 -0
- package/dist/components/alert/Alert.js +39 -0
- package/dist/components/aurora/Aurora.d.ts +5 -0
- package/dist/components/aurora/Aurora.js +23 -0
- package/dist/components/avatar/Avatar.d.ts +10 -0
- package/dist/components/avatar/Avatar.js +53 -0
- package/dist/components/badge/Badge.d.ts +8 -0
- package/dist/components/badge/Badge.js +63 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +7 -0
- package/dist/components/breadcrumb/Breadcrumb.js +19 -0
- package/dist/components/button/Button.d.ts +11 -0
- package/dist/components/button/Button.js +31 -0
- package/dist/components/button-group/ButtonGroup.d.ts +8 -0
- package/dist/components/button-group/ButtonGroup.js +28 -0
- package/dist/components/card/Card.d.ts +15 -0
- package/dist/components/card/Card.js +42 -0
- package/dist/components/card/CardSection.d.ts +10 -0
- package/dist/components/card/CardSection.js +28 -0
- package/dist/{esm/components → components}/col/Col.d.ts +3 -5
- package/dist/components/col/Col.js +27 -0
- package/dist/components/command/Command.d.ts +30 -0
- package/dist/components/command/Command.js +103 -0
- package/dist/components/container/Container.d.ts +6 -0
- package/dist/components/container/Container.js +21 -0
- package/dist/components/context-menu/ContextMenu.d.ts +31 -0
- package/dist/components/context-menu/ContextMenu.js +106 -0
- package/dist/components/data-table/DataTable.d.ts +23 -0
- package/dist/components/data-table/DataTable.js +41 -0
- package/dist/components/data-table/DataTableColumn.d.ts +6 -0
- package/dist/components/data-table/DataTableColumn.js +22 -0
- package/dist/components/data-table/DataTableFilterInput.d.ts +18 -0
- package/dist/components/data-table/DataTableFilterInput.js +212 -0
- package/dist/components/data-table/DataTableFilterSuggestionMenu.d.ts +7 -0
- package/dist/components/data-table/DataTableFilterSuggestionMenu.js +53 -0
- package/dist/components/data-table/index.d.ts +4 -0
- package/dist/components/data-table/index.js +11 -0
- package/dist/components/dialog/Dialog.d.ts +29 -0
- package/dist/components/dialog/Dialog.js +102 -0
- package/dist/components/editor/Editor.d.ts +29 -0
- package/dist/components/editor/Editor.js +337 -0
- package/dist/components/file-tabs/FileTabs.d.ts +17 -0
- package/dist/components/file-tabs/FileTabs.js +71 -0
- package/dist/components/file-tabs/FileTabs.service.d.ts +17 -0
- package/dist/components/file-tabs/FileTabs.service.js +88 -0
- package/dist/components/file-tabs/FileTabs.view.d.ts +10 -0
- package/dist/components/file-tabs/FileTabs.view.js +1 -0
- package/dist/components/file-tabs/index.d.ts +3 -0
- package/dist/components/file-tabs/index.js +9 -0
- package/dist/components/flex/Flex.d.ts +7 -0
- package/dist/components/flex/Flex.js +21 -0
- package/dist/components/form/CheckboxInput.d.ts +5 -0
- package/dist/components/form/CheckboxInput.js +76 -0
- package/dist/components/form/EmailInput.d.ts +8 -0
- package/dist/components/form/EmailInput.js +21 -0
- package/dist/components/form/Input.d.ts +35 -0
- package/dist/components/form/Input.js +434 -0
- package/dist/components/form/Input.syntax.hook.d.ts +10 -0
- package/dist/components/form/Input.syntax.hook.js +14 -0
- package/dist/components/form/Input.utils.d.ts +10 -0
- package/dist/components/form/Input.utils.js +38 -0
- package/dist/components/form/InputContentEditable.hook.d.ts +52 -0
- package/dist/components/form/InputContentEditable.hook.js +449 -0
- package/dist/components/form/InputDescription.d.ts +5 -0
- package/dist/components/form/InputDescription.js +12 -0
- package/dist/components/form/InputLabel.d.ts +5 -0
- package/dist/components/form/InputLabel.js +12 -0
- package/dist/components/form/InputMessage.d.ts +5 -0
- package/dist/components/form/InputMessage.js +18 -0
- package/dist/components/form/InputSuggestion.d.ts +27 -0
- package/dist/components/form/InputSuggestion.js +218 -0
- package/dist/components/form/NumberInput.d.ts +6 -0
- package/dist/components/form/NumberInput.js +20 -0
- package/dist/components/form/PasswordInput.d.ts +8 -0
- package/dist/components/form/PasswordInput.js +19 -0
- package/dist/components/form/PinInput.d.ts +11 -0
- package/dist/components/form/PinInput.js +66 -0
- package/dist/components/form/RadioGroup.d.ts +5 -0
- package/dist/components/form/RadioGroup.js +48 -0
- package/dist/components/form/RadioInput.d.ts +7 -0
- package/dist/components/form/RadioInput.js +27 -0
- package/dist/components/form/SwitchInput.d.ts +6 -0
- package/dist/components/form/SwitchInput.js +19 -0
- package/dist/components/form/TextAreaInput.d.ts +7 -0
- package/dist/components/form/TextAreaInput.js +20 -0
- package/dist/components/form/TextInput.d.ts +7 -0
- package/dist/components/form/TextInput.js +20 -0
- package/dist/components/form/index.d.ts +17 -0
- package/dist/components/form/index.js +40 -0
- package/dist/components/form/useForm.d.ts +30 -0
- package/dist/components/form/useForm.js +78 -0
- package/dist/components/fullscreen/FullScreen.d.ts +6 -0
- package/dist/components/fullscreen/FullScreen.js +26 -0
- package/dist/components/layout/Layout.d.ts +12 -0
- package/dist/components/layout/Layout.js +75 -0
- package/dist/components/menu/Menu.d.ts +35 -0
- package/dist/components/menu/Menu.js +120 -0
- package/dist/components/quote/Quote.d.ts +10 -0
- package/dist/components/quote/Quote.js +44 -0
- package/dist/components/resizable/Resizable.d.ts +12 -0
- package/dist/components/resizable/Resizable.js +34 -0
- package/dist/components/row/Row.d.ts +6 -0
- package/dist/components/row/Row.js +21 -0
- package/dist/components/scroll-area/ScrollArea.d.ts +13 -0
- package/dist/components/scroll-area/ScrollArea.js +43 -0
- package/dist/components/segmented-control/SegmentedControl.d.ts +10 -0
- package/dist/components/segmented-control/SegmentedControl.js +26 -0
- package/dist/components/spacing/Spacing.d.ts +6 -0
- package/dist/components/spacing/Spacing.js +23 -0
- package/dist/components/tab/Tab.d.ts +11 -0
- package/dist/components/tab/Tab.js +40 -0
- package/dist/components/text/Text.d.ts +8 -0
- package/dist/components/text/Text.js +23 -0
- package/dist/components/toast/Toast.d.ts +13 -0
- package/dist/components/toast/Toast.js +66 -0
- package/dist/components/tooltip/Tooltip.d.ts +17 -0
- package/dist/components/tooltip/Tooltip.js +48 -0
- package/dist/index.d.ts +33 -305
- package/dist/index.js +191 -0
- package/dist/node_modules/@lezer/common/dist/index.js +146 -0
- package/dist/node_modules/@lezer/highlight/dist/index.js +543 -0
- package/dist/node_modules/prettier/plugins/babel.js +7157 -0
- package/dist/node_modules/prettier/plugins/estree.js +4453 -0
- package/dist/node_modules/prettier/standalone.js +2429 -0
- package/dist/node_modules/react/cjs/react-compiler-runtime.development.js +21 -0
- package/dist/node_modules/react/cjs/react-compiler-runtime.production.js +14 -0
- package/dist/node_modules/react/compiler-runtime.js +10 -0
- package/dist/utils/arrayService.d.ts +10 -0
- package/dist/utils/arrayService.js +1 -0
- package/dist/utils/contextStore.d.ts +62 -0
- package/dist/utils/contextStore.js +60 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +25 -0
- package/dist/utils/inspection.d.ts +15 -0
- package/dist/utils/inspection.js +29 -0
- package/dist/utils/nonReactiveArrayService.d.ts +19 -0
- package/dist/utils/nonReactiveArrayService.js +54 -0
- package/dist/utils/objectStore.d.ts +12 -0
- package/dist/utils/objectStore.js +34 -0
- package/dist/utils/reactiveArrayService.d.ts +23 -0
- package/dist/utils/reactiveArrayService.js +90 -0
- package/dist/{cjs/utils → utils}/types.d.ts +4 -4
- package/dist/utils/types.js +4 -0
- package/dist/utils/utils.d.ts +55 -0
- package/dist/utils/utils.js +159 -0
- package/dist/utils/view.d.ts +8 -0
- package/dist/utils/view.js +28 -0
- package/package.json +130 -54
- package/dist/cjs/components/Text/Text.d.ts +0 -10
- package/dist/cjs/components/alert/Alert.d.ts +0 -16
- package/dist/cjs/components/badge/Badge.d.ts +0 -9
- package/dist/cjs/components/button/Button.d.ts +0 -17
- package/dist/cjs/components/button-group/ButtonGroup.d.ts +0 -9
- package/dist/cjs/components/card/Card.d.ts +0 -20
- package/dist/cjs/components/col/Col.d.ts +0 -15
- package/dist/cjs/components/container/Container.d.ts +0 -8
- package/dist/cjs/components/dropdown/Dropdown.d.ts +0 -24
- package/dist/cjs/components/dropdown/DropdownFooter.d.ts +0 -13
- package/dist/cjs/components/dropdown/DropdownHeader.d.ts +0 -13
- package/dist/cjs/components/dropdown/DropdownItem.d.ts +0 -12
- package/dist/cjs/components/dropdown/DropdownItemGroup.d.ts +0 -12
- package/dist/cjs/components/flex/Flex.d.ts +0 -8
- package/dist/cjs/components/input/Input.d.ts +0 -37
- package/dist/cjs/components/list-group/ListGroup.d.ts +0 -12
- package/dist/cjs/components/menu/InternalMenu.d.ts +0 -4
- package/dist/cjs/components/menu/Menu.d.ts +0 -41
- package/dist/cjs/components/popover/InternalPopover.d.ts +0 -10
- package/dist/cjs/components/popover/Popover.d.ts +0 -16
- package/dist/cjs/components/quote/Quote.d.ts +0 -12
- package/dist/cjs/components/row/Row.d.ts +0 -8
- package/dist/cjs/components/tooltip/Tooltip.d.ts +0 -18
- package/dist/cjs/index.d.ts +0 -17
- package/dist/cjs/index.js +0 -9284
- package/dist/cjs/utils/utils.d.ts +0 -18
- package/dist/esm/components/Text/Text.d.ts +0 -10
- package/dist/esm/components/alert/Alert.d.ts +0 -16
- package/dist/esm/components/badge/Badge.d.ts +0 -9
- package/dist/esm/components/button/Button.d.ts +0 -17
- package/dist/esm/components/button-group/ButtonGroup.d.ts +0 -9
- package/dist/esm/components/card/Card.d.ts +0 -20
- package/dist/esm/components/container/Container.d.ts +0 -8
- package/dist/esm/components/dropdown/Dropdown.d.ts +0 -24
- package/dist/esm/components/dropdown/DropdownFooter.d.ts +0 -13
- package/dist/esm/components/dropdown/DropdownHeader.d.ts +0 -13
- package/dist/esm/components/dropdown/DropdownItem.d.ts +0 -12
- package/dist/esm/components/dropdown/DropdownItemGroup.d.ts +0 -12
- package/dist/esm/components/flex/Flex.d.ts +0 -8
- package/dist/esm/components/input/Input.d.ts +0 -37
- package/dist/esm/components/list-group/ListGroup.d.ts +0 -12
- package/dist/esm/components/menu/InternalMenu.d.ts +0 -4
- package/dist/esm/components/menu/Menu.d.ts +0 -41
- package/dist/esm/components/popover/InternalPopover.d.ts +0 -10
- package/dist/esm/components/popover/Popover.d.ts +0 -16
- package/dist/esm/components/quote/Quote.d.ts +0 -12
- package/dist/esm/components/row/Row.d.ts +0 -8
- package/dist/esm/components/tooltip/Tooltip.d.ts +0 -18
- package/dist/esm/index.d.ts +0 -17
- package/dist/esm/index.js +0 -9259
- package/dist/esm/utils/types.d.ts +0 -57
- package/dist/esm/utils/utils.d.ts +0 -18
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __exports as e } from "../../../_virtual/react-compiler-runtime.development.js";
|
|
2
|
+
import a from "react";
|
|
3
|
+
var n;
|
|
4
|
+
function s() {
|
|
5
|
+
return n ? e : (n = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
6
|
+
var t = a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
7
|
+
e.c = function(r) {
|
|
8
|
+
var o = t.H;
|
|
9
|
+
return o === null && console.error(
|
|
10
|
+
`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
11
|
+
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
12
|
+
2. You might be breaking the Rules of Hooks
|
|
13
|
+
3. You might have more than one copy of React in the same app
|
|
14
|
+
See https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem.`
|
|
15
|
+
), o.useMemoCache(r);
|
|
16
|
+
};
|
|
17
|
+
})(), e);
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
s as __require
|
|
21
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __exports as r } from "../../../_virtual/react-compiler-runtime.production.js";
|
|
2
|
+
import o from "react";
|
|
3
|
+
var e;
|
|
4
|
+
function u() {
|
|
5
|
+
if (e) return r;
|
|
6
|
+
e = 1;
|
|
7
|
+
var t = o.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;
|
|
8
|
+
return r.c = function(_) {
|
|
9
|
+
return t.H.useMemoCache(_);
|
|
10
|
+
}, r;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
u as __require
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { __module as e } from "../../_virtual/compiler-runtime2.js";
|
|
2
|
+
import { __require as i } from "./cjs/react-compiler-runtime.production.js";
|
|
3
|
+
import { __require as o } from "./cjs/react-compiler-runtime.development.js";
|
|
4
|
+
var r;
|
|
5
|
+
function p() {
|
|
6
|
+
return r ? e.exports : (r = 1, process.env.NODE_ENV === "production" ? e.exports = i() : e.exports = o(), e.exports);
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
p as __require
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ArrayService<I, R, D = Record<string, any>> {
|
|
2
|
+
delete(index: number): void;
|
|
3
|
+
add(index: I): void;
|
|
4
|
+
set(index: number, value: I): void;
|
|
5
|
+
has(index: number): boolean;
|
|
6
|
+
get(index: number): R;
|
|
7
|
+
values(dependencies?: D): R[];
|
|
8
|
+
update(): void;
|
|
9
|
+
clear(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { default as React, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Type representing a concrete class constructor.
|
|
4
|
+
*/
|
|
5
|
+
export type ConcreteCtor<T> = new (...args: any[]) => T;
|
|
6
|
+
/**
|
|
7
|
+
* Type representing an abstract class constructor.
|
|
8
|
+
*/
|
|
9
|
+
export type AbstractCtor<T> = abstract new (...args: any[]) => T;
|
|
10
|
+
/**
|
|
11
|
+
* A class constructor type that can be either concrete or abstract.
|
|
12
|
+
*/
|
|
13
|
+
export type ServiceClass<T> = ConcreteCtor<T> | AbstractCtor<T>;
|
|
14
|
+
/**
|
|
15
|
+
* Tuple representing a service entry: [store, service].
|
|
16
|
+
*/
|
|
17
|
+
export type ServiceEntry<T = any> = [any, T];
|
|
18
|
+
/**
|
|
19
|
+
* Map storing service entries, keyed by their (abstract or concrete) class constructor.
|
|
20
|
+
*/
|
|
21
|
+
export type ServiceMap = Map<Function, ServiceEntry>;
|
|
22
|
+
/**
|
|
23
|
+
* React Context for providing and consuming registered services and stores.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ContextStore: React.Context<ServiceMap | null>;
|
|
26
|
+
/**
|
|
27
|
+
* Props for the ContextStoreProvider component.
|
|
28
|
+
* @property services - Array of [store, service] tuples to register.
|
|
29
|
+
* @property children - React children to render within the provider.
|
|
30
|
+
*/
|
|
31
|
+
export type ContextStoreProviderProps = {
|
|
32
|
+
services: ServiceEntry[];
|
|
33
|
+
children: ReactNode;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* ContextStoreProvider
|
|
37
|
+
*
|
|
38
|
+
* Registers all given services and their associated stores in a shared context.
|
|
39
|
+
*
|
|
40
|
+
* Each service is indexed by both its concrete constructor and all abstract or
|
|
41
|
+
* base class constructors in its prototype chain.
|
|
42
|
+
*
|
|
43
|
+
* If multiple services share the same base class, the first one wins (no overwriting).
|
|
44
|
+
*/
|
|
45
|
+
export declare const ContextStoreProvider: React.FC<ContextStoreProviderProps>;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves a service instance from the ContextStore by its class.
|
|
48
|
+
* Works with both concrete classes and abstract base classes.
|
|
49
|
+
*
|
|
50
|
+
* @param ServiceClass - The (abstract or concrete) class of the desired service.
|
|
51
|
+
* @returns The matching service instance.
|
|
52
|
+
* @throws If the context or service cannot be found.
|
|
53
|
+
*/
|
|
54
|
+
export declare const useService: <T>(ServiceClass: ServiceClass<T>) => T;
|
|
55
|
+
/**
|
|
56
|
+
* Retrieves the store associated with a (concrete or abstract) service class.
|
|
57
|
+
*
|
|
58
|
+
* @param ServiceClass - The (abstract or concrete) class whose store should be retrieved.
|
|
59
|
+
* @returns The store instance associated with the given service.
|
|
60
|
+
* @throws If the context or store cannot be found.
|
|
61
|
+
*/
|
|
62
|
+
export declare const useStore: <T>(ServiceClass: ServiceClass<T>) => any;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
2
|
+
import { c as i } from "../_virtual/compiler-runtime.js";
|
|
3
|
+
import { createContext as d, useContext as a } from "react";
|
|
4
|
+
const u = d(null);
|
|
5
|
+
function C(n) {
|
|
6
|
+
const t = [];
|
|
7
|
+
let o = Object.getPrototypeOf(n);
|
|
8
|
+
for (; o && o.constructor && o !== Object.prototype; ) {
|
|
9
|
+
const e = o.constructor;
|
|
10
|
+
t.push(e), o = Object.getPrototypeOf(o);
|
|
11
|
+
}
|
|
12
|
+
return t;
|
|
13
|
+
}
|
|
14
|
+
const g = (n) => {
|
|
15
|
+
const t = i.c(5), {
|
|
16
|
+
services: o,
|
|
17
|
+
children: e
|
|
18
|
+
} = n;
|
|
19
|
+
let r;
|
|
20
|
+
t[0] !== o ? (r = /* @__PURE__ */ new Map(), o.forEach((h) => {
|
|
21
|
+
const [p, f] = h, m = f.constructor;
|
|
22
|
+
r.has(m) || r.set(m, [p, f]);
|
|
23
|
+
const l = C(f);
|
|
24
|
+
for (const w of l)
|
|
25
|
+
r.has(w) || r.set(w, [p, f]);
|
|
26
|
+
}), t[0] = o, t[1] = r) : r = t[1];
|
|
27
|
+
const c = r;
|
|
28
|
+
let s;
|
|
29
|
+
return t[2] !== e || t[3] !== c ? (s = /* @__PURE__ */ x(u.Provider, { value: c, children: e }), t[2] = e, t[3] = c, t[4] = s) : s = t[4], s;
|
|
30
|
+
}, O = (n) => {
|
|
31
|
+
const t = i.c(3), o = a(u);
|
|
32
|
+
if (!o)
|
|
33
|
+
throw new Error("ContextStore not found");
|
|
34
|
+
let e;
|
|
35
|
+
t[0] !== n || t[1] !== o ? (e = o.get(n), t[0] = n, t[1] = o, t[2] = e) : e = t[2];
|
|
36
|
+
const r = e;
|
|
37
|
+
if (!r) {
|
|
38
|
+
const c = n?.name ?? "UnknownServiceClass";
|
|
39
|
+
throw new Error(`Service not found for ${c}`);
|
|
40
|
+
}
|
|
41
|
+
return r[1];
|
|
42
|
+
}, P = (n) => {
|
|
43
|
+
const t = i.c(3), o = a(u);
|
|
44
|
+
if (!o)
|
|
45
|
+
throw new Error("ContextStore not found");
|
|
46
|
+
let e;
|
|
47
|
+
t[0] !== n || t[1] !== o ? (e = o.get(n), t[0] = n, t[1] = o, t[2] = e) : e = t[2];
|
|
48
|
+
const r = e;
|
|
49
|
+
if (!r) {
|
|
50
|
+
const c = n?.name ?? "UnknownServiceClass";
|
|
51
|
+
throw new Error(`Store not found for ${c}`);
|
|
52
|
+
}
|
|
53
|
+
return r[0];
|
|
54
|
+
};
|
|
55
|
+
export {
|
|
56
|
+
u as ContextStore,
|
|
57
|
+
g as ContextStoreProvider,
|
|
58
|
+
O as useService,
|
|
59
|
+
P as useStore
|
|
60
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './arrayService';
|
|
2
|
+
export * from './contextStore';
|
|
3
|
+
export * from './inspection';
|
|
4
|
+
export * from './nonReactiveArrayService';
|
|
5
|
+
export * from './objectStore';
|
|
6
|
+
export * from './reactiveArrayService';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export * from './utils';
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ContextStore as o, ContextStoreProvider as t, useService as i, useStore as c } from "./contextStore.js";
|
|
2
|
+
import { InspectionSeverity as S, underlineBySeverity as a } from "./inspection.js";
|
|
3
|
+
import { NonReactiveArrayService as p, createNonReactiveArrayService as x } from "./nonReactiveArrayService.js";
|
|
4
|
+
import { ObjectService as f, createObjectService as s } from "./objectStore.js";
|
|
5
|
+
import { ReactiveArrayService as C, useReactiveArrayService as d } from "./reactiveArrayService.js";
|
|
6
|
+
import { Colors as A } from "./types.js";
|
|
7
|
+
import { getDOMSizeFromCodeZeroSize as l, hashToColor as O, mergeCode0Props as b } from "./utils.js";
|
|
8
|
+
export {
|
|
9
|
+
A as Colors,
|
|
10
|
+
o as ContextStore,
|
|
11
|
+
t as ContextStoreProvider,
|
|
12
|
+
S as InspectionSeverity,
|
|
13
|
+
p as NonReactiveArrayService,
|
|
14
|
+
f as ObjectService,
|
|
15
|
+
C as ReactiveArrayService,
|
|
16
|
+
x as createNonReactiveArrayService,
|
|
17
|
+
s as createObjectService,
|
|
18
|
+
l as getDOMSizeFromCodeZeroSize,
|
|
19
|
+
O as hashToColor,
|
|
20
|
+
b as mergeCode0Props,
|
|
21
|
+
a as underlineBySeverity,
|
|
22
|
+
d as useReactiveArrayService,
|
|
23
|
+
i as useService,
|
|
24
|
+
c as useStore
|
|
25
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NodeParameter, Translation } from '@code0-tech/sagittarius-graphql-types';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
export declare enum InspectionSeverity {
|
|
4
|
+
TYPO = 0,
|
|
5
|
+
GRAMMAR = 1,
|
|
6
|
+
WEAK = 2,
|
|
7
|
+
WARNING = 3,
|
|
8
|
+
ERROR = 4
|
|
9
|
+
}
|
|
10
|
+
export interface ValidationResult {
|
|
11
|
+
parameterId: NodeParameter['id'];
|
|
12
|
+
type: InspectionSeverity;
|
|
13
|
+
message: Array<Translation>;
|
|
14
|
+
}
|
|
15
|
+
export declare const underlineBySeverity: Record<InspectionSeverity, CSSProperties>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
var r = /* @__PURE__ */ ((d) => (d[d.TYPO = 0] = "TYPO", d[d.GRAMMAR = 1] = "GRAMMAR", d[d.WEAK = 2] = "WEAK", d[d.WARNING = 3] = "WARNING", d[d.ERROR = 4] = "ERROR", d))(r || {});
|
|
2
|
+
const o = (d, a = "5px 4px") => ({
|
|
3
|
+
paddingBottom: "0.2rem",
|
|
4
|
+
backgroundRepeat: "repeat-x",
|
|
5
|
+
backgroundPosition: "left bottom",
|
|
6
|
+
backgroundSize: a,
|
|
7
|
+
backgroundImage: `url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='6' viewBox='0 0 12 6'> <path d='M0 3 Q3 0 6 3 T12 3' fill='none' stroke='${d}' stroke-width='2'/></svg>")`
|
|
8
|
+
}), g = {
|
|
9
|
+
0: {
|
|
10
|
+
borderBottom: "1px dotted #3b82f6"
|
|
11
|
+
// blue
|
|
12
|
+
},
|
|
13
|
+
1: {
|
|
14
|
+
borderBottom: "1px dashed #8b5cf6"
|
|
15
|
+
// violet
|
|
16
|
+
},
|
|
17
|
+
2: {
|
|
18
|
+
borderBottom: "3px double #9ca3af"
|
|
19
|
+
// gray
|
|
20
|
+
},
|
|
21
|
+
3: o("orange"),
|
|
22
|
+
// amber
|
|
23
|
+
4: o("red")
|
|
24
|
+
// already yours
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
r as InspectionSeverity,
|
|
28
|
+
g as underlineBySeverity
|
|
29
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ArrayService } from './arrayService';
|
|
2
|
+
/**
|
|
3
|
+
* using a React ref as a store in combination with a map
|
|
4
|
+
* to be able to access and modify the store easily
|
|
5
|
+
*/
|
|
6
|
+
export type NonReactiveArrayStore<K> = K[];
|
|
7
|
+
export declare class NonReactiveArrayService<T> implements ArrayService<T, T> {
|
|
8
|
+
protected store: NonReactiveArrayStore<T>;
|
|
9
|
+
constructor(store: NonReactiveArrayStore<T>);
|
|
10
|
+
delete(index: number): void;
|
|
11
|
+
add(value: T): void;
|
|
12
|
+
set(index: number, value: T): void;
|
|
13
|
+
has(index: number): boolean;
|
|
14
|
+
get(index: number): T;
|
|
15
|
+
values(): NonReactiveArrayStore<T>;
|
|
16
|
+
update(): void;
|
|
17
|
+
clear(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare const createNonReactiveArrayService: <K, T extends ArrayService<K>>(service: typeof T, callback?: (store: NonReactiveArrayStore<K>) => T) => [K[] | undefined, T];
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
function o(t, e, r) {
|
|
2
|
+
return (e = s(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
|
|
3
|
+
}
|
|
4
|
+
function s(t) {
|
|
5
|
+
var e = n(t, "string");
|
|
6
|
+
return typeof e == "symbol" ? e : e + "";
|
|
7
|
+
}
|
|
8
|
+
function n(t, e) {
|
|
9
|
+
if (typeof t != "object" || !t) return t;
|
|
10
|
+
var r = t[Symbol.toPrimitive];
|
|
11
|
+
if (r !== void 0) {
|
|
12
|
+
var i = r.call(t, e);
|
|
13
|
+
if (typeof i != "object") return i;
|
|
14
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
15
|
+
}
|
|
16
|
+
return (e === "string" ? String : Number)(t);
|
|
17
|
+
}
|
|
18
|
+
class u {
|
|
19
|
+
constructor(e) {
|
|
20
|
+
o(this, "store", void 0), this.store = e;
|
|
21
|
+
}
|
|
22
|
+
delete(e) {
|
|
23
|
+
delete this.store[e];
|
|
24
|
+
}
|
|
25
|
+
add(e) {
|
|
26
|
+
this.store.push(e);
|
|
27
|
+
}
|
|
28
|
+
set(e, r) {
|
|
29
|
+
this.store[e] = r;
|
|
30
|
+
}
|
|
31
|
+
has(e) {
|
|
32
|
+
return !!this.store[e];
|
|
33
|
+
}
|
|
34
|
+
get(e) {
|
|
35
|
+
return this.store[e];
|
|
36
|
+
}
|
|
37
|
+
values() {
|
|
38
|
+
return this.store;
|
|
39
|
+
}
|
|
40
|
+
update() {
|
|
41
|
+
this.store = [...this.store];
|
|
42
|
+
}
|
|
43
|
+
clear() {
|
|
44
|
+
this.store = [];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const a = (t, e) => {
|
|
48
|
+
const r = [];
|
|
49
|
+
return [r, e ? e(r) : new t(r)];
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
u as NonReactiveArrayService,
|
|
53
|
+
a as createNonReactiveArrayService
|
|
54
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* using a React ref as a store in combination with a map
|
|
4
|
+
* to be able to access and modify the store easily
|
|
5
|
+
*/
|
|
6
|
+
export type ObjectStore<K> = [K | undefined, React.Dispatch<React.SetStateAction<K>>];
|
|
7
|
+
export declare class ObjectService<K> {
|
|
8
|
+
protected readonly store: ObjectStore<K>;
|
|
9
|
+
constructor(store: ObjectStore<K>);
|
|
10
|
+
object(): K | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare const createObjectService: <K, T extends ObjectService<K>>(service: typeof T, callback?: (store: ObjectStore<K>) => T, initial?: K) => [K | undefined, T];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import o from "react";
|
|
2
|
+
function n(e, r, t) {
|
|
3
|
+
return (r = u(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e;
|
|
4
|
+
}
|
|
5
|
+
function u(e) {
|
|
6
|
+
var r = c(e, "string");
|
|
7
|
+
return typeof r == "symbol" ? r : r + "";
|
|
8
|
+
}
|
|
9
|
+
function c(e, r) {
|
|
10
|
+
if (typeof e != "object" || !e) return e;
|
|
11
|
+
var t = e[Symbol.toPrimitive];
|
|
12
|
+
if (t !== void 0) {
|
|
13
|
+
var i = t.call(e, r);
|
|
14
|
+
if (typeof i != "object") return i;
|
|
15
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
16
|
+
}
|
|
17
|
+
return (r === "string" ? String : Number)(e);
|
|
18
|
+
}
|
|
19
|
+
class f {
|
|
20
|
+
constructor(r) {
|
|
21
|
+
n(this, "store", void 0), this.store = r;
|
|
22
|
+
}
|
|
23
|
+
object() {
|
|
24
|
+
return this.store[0];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const v = (e, r, t) => {
|
|
28
|
+
const i = o.useState(t);
|
|
29
|
+
return [i[0], r ? r(i) : new e(i)];
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
f as ObjectService,
|
|
33
|
+
v as createObjectService
|
|
34
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { ArrayService } from './arrayService';
|
|
3
|
+
import { Payload, View } from './view';
|
|
4
|
+
export type ReactiveArrayStore<T> = {
|
|
5
|
+
getState: () => T[];
|
|
6
|
+
setState: React.Dispatch<React.SetStateAction<T[]>>;
|
|
7
|
+
};
|
|
8
|
+
export declare class ReactiveArrayService<T extends Payload, D = Record<string, any>> implements ArrayService<View<T>, T, D> {
|
|
9
|
+
protected readonly access: ReactiveArrayStore<View<T>>;
|
|
10
|
+
constructor(access: ReactiveArrayStore<View<T>>);
|
|
11
|
+
delete(index: number): void;
|
|
12
|
+
add(value: View<T>): void;
|
|
13
|
+
set(index: number, value: View<T>): void;
|
|
14
|
+
has(index: number): boolean;
|
|
15
|
+
get(index: number): T;
|
|
16
|
+
values(_dependencies?: D): T[];
|
|
17
|
+
update(): void;
|
|
18
|
+
clear(): void;
|
|
19
|
+
}
|
|
20
|
+
type ArrayServiceCtor<I, R, S extends ArrayService<I, R>> = new (access: ReactiveArrayStore<I>) => S;
|
|
21
|
+
type InitialArg<R> = R[];
|
|
22
|
+
export declare function useReactiveArrayService<R extends Payload, S extends ArrayService<View<R>, R>>(Ctor: ArrayServiceCtor<View<R>, R, S> | ((store: ReactiveArrayStore<View<R>>) => S), initial?: InitialArg<R>): [View<R>[], S];
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import a, { startTransition as i } from "react";
|
|
2
|
+
import { View as h } from "./view.js";
|
|
3
|
+
function p(t, e, r) {
|
|
4
|
+
return (e = y(e)) in t ? Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = r, t;
|
|
5
|
+
}
|
|
6
|
+
function y(t) {
|
|
7
|
+
var e = m(t, "string");
|
|
8
|
+
return typeof e == "symbol" ? e : e + "";
|
|
9
|
+
}
|
|
10
|
+
function m(t, e) {
|
|
11
|
+
if (typeof t != "object" || !t) return t;
|
|
12
|
+
var r = t[Symbol.toPrimitive];
|
|
13
|
+
if (r !== void 0) {
|
|
14
|
+
var s = r.call(t, e);
|
|
15
|
+
if (typeof s != "object") return s;
|
|
16
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
17
|
+
}
|
|
18
|
+
return (e === "string" ? String : Number)(t);
|
|
19
|
+
}
|
|
20
|
+
class w {
|
|
21
|
+
constructor(e) {
|
|
22
|
+
p(this, "access", void 0), this.access = e;
|
|
23
|
+
}
|
|
24
|
+
delete(e) {
|
|
25
|
+
i(() => {
|
|
26
|
+
this.access.setState((r) => r.filter((s, c) => c !== e));
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
add(e) {
|
|
30
|
+
i(() => {
|
|
31
|
+
this.access.setState((r) => [...r, e]);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
set(e, r) {
|
|
35
|
+
i(() => {
|
|
36
|
+
this.access.setState((s) => {
|
|
37
|
+
const c = s.slice();
|
|
38
|
+
return c[e] = r, c;
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
has(e) {
|
|
43
|
+
const r = this.access.getState();
|
|
44
|
+
return e >= 0 && e < r.length;
|
|
45
|
+
}
|
|
46
|
+
get(e) {
|
|
47
|
+
return this.access.getState()[e]?.payload;
|
|
48
|
+
}
|
|
49
|
+
values(e) {
|
|
50
|
+
return this.access.getState().map((r) => r.payload);
|
|
51
|
+
}
|
|
52
|
+
update() {
|
|
53
|
+
i(() => {
|
|
54
|
+
this.access.setState((e) => [...e]);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
clear() {
|
|
58
|
+
i(() => {
|
|
59
|
+
this.access.setState(() => []);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function P(t, e = []) {
|
|
64
|
+
const [r, s] = a.useState([]), c = a.useRef([]);
|
|
65
|
+
c.current = r;
|
|
66
|
+
const u = a.useCallback(() => c.current, []), o = a.useMemo(() => {
|
|
67
|
+
const n = {
|
|
68
|
+
getState: u,
|
|
69
|
+
setState: s
|
|
70
|
+
}, v = {
|
|
71
|
+
construct: () => v
|
|
72
|
+
};
|
|
73
|
+
return ((d) => {
|
|
74
|
+
try {
|
|
75
|
+
return !!new new Proxy(d, v)();
|
|
76
|
+
} catch {
|
|
77
|
+
return !1;
|
|
78
|
+
}
|
|
79
|
+
})(t) ? new t(n) : t(n);
|
|
80
|
+
}, [t, u]), f = a.useCallback((n) => new h(n), []), l = a.useRef(!1);
|
|
81
|
+
return a.useEffect(() => {
|
|
82
|
+
l.current || (l.current = !0, o.clear(), e.forEach((n) => {
|
|
83
|
+
o.add(f(n));
|
|
84
|
+
}));
|
|
85
|
+
}, [o, e, f]), [r, o];
|
|
86
|
+
}
|
|
87
|
+
export {
|
|
88
|
+
w as ReactiveArrayService,
|
|
89
|
+
P as useReactiveArrayService
|
|
90
|
+
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React,
|
|
2
|
-
export type Color = "primary" | "secondary" | "info" | "success" | "warning" | "error";
|
|
1
|
+
import { default as React, HTMLProps } from 'react';
|
|
2
|
+
export type Color = "primary" | "secondary" | "tertiary" | "info" | "success" | "warning" | "error";
|
|
3
3
|
export declare const Colors: Color[];
|
|
4
|
-
export type Code0Sizes = "xs" | "sm" | "md" | "lg" | "xl";
|
|
5
|
-
export type Code0FontSizes = "0.
|
|
4
|
+
export type Code0Sizes = "xxs" | "xs" | "sm" | "md" | "lg" | "xl";
|
|
5
|
+
export type Code0FontSizes = "0.35" | "0.7" | "0.8" | "1" | "1.2" | "1.3";
|
|
6
6
|
export type StyleProp<Value> = Value;
|
|
7
7
|
export interface Code0ComponentProps {
|
|
8
8
|
m?: StyleProp<number | `${number}`>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { CSSProperties } from 'react';
|
|
2
|
+
import { Code0Sizes } from './types';
|
|
3
|
+
export declare const mergeCode0Props: (cn: string, rest: object) => {
|
|
4
|
+
m?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
5
|
+
my?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
6
|
+
mx?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
7
|
+
mt?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
8
|
+
mb?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
9
|
+
ml?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
10
|
+
mr?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
11
|
+
p?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
12
|
+
py?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
13
|
+
px?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
14
|
+
pt?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
15
|
+
pb?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
16
|
+
pl?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
17
|
+
pr?: import('./types').StyleProp<number | `${number}`> | undefined;
|
|
18
|
+
bg?: import("csstype").Property.BackgroundColor | undefined;
|
|
19
|
+
c?: import("csstype").Property.Color | undefined;
|
|
20
|
+
opacity?: import("csstype").Property.Opacity | undefined;
|
|
21
|
+
ff?: import('./types').StyleProp<"mono" | "text" | "heading" | (string & {})> | undefined;
|
|
22
|
+
fz?: import('./types').StyleProp<import('./types').Code0FontSizes | number | `${number}`> | undefined;
|
|
23
|
+
fw?: import("csstype").Property.FontWeight | undefined;
|
|
24
|
+
lts?: import("csstype").Property.LetterSpacing<string | number> | undefined;
|
|
25
|
+
ta?: import("csstype").Property.TextAlign | undefined;
|
|
26
|
+
lh?: import('./types').StyleProp<number | (string & {})> | undefined;
|
|
27
|
+
fs?: import("csstype").Property.FontStyle | undefined;
|
|
28
|
+
tt?: import("csstype").Property.TextTransform | undefined;
|
|
29
|
+
td?: import("csstype").Property.TextDecoration<string | number> | undefined;
|
|
30
|
+
w?: import("csstype").Property.Width<string | number> | undefined;
|
|
31
|
+
miw?: import("csstype").Property.MinWidth<string | number> | undefined;
|
|
32
|
+
maw?: import("csstype").Property.MaxWidth<string | number> | undefined;
|
|
33
|
+
h?: import("csstype").Property.Height<string | number> | undefined;
|
|
34
|
+
mih?: import("csstype").Property.MinHeight<string | number> | undefined;
|
|
35
|
+
mah?: import("csstype").Property.MaxHeight<string | number> | undefined;
|
|
36
|
+
bgsz?: import("csstype").Property.BackgroundSize<string | number> | undefined;
|
|
37
|
+
bgp?: import("csstype").Property.BackgroundPosition<string | number> | undefined;
|
|
38
|
+
bgr?: import("csstype").Property.BackgroundRepeat | undefined;
|
|
39
|
+
bga?: import("csstype").Property.BackgroundAttachment | undefined;
|
|
40
|
+
pos?: import("csstype").Property.Position | undefined;
|
|
41
|
+
top?: import("csstype").Property.Top<string | number> | undefined;
|
|
42
|
+
left?: import("csstype").Property.Left<string | number> | undefined;
|
|
43
|
+
bottom?: import("csstype").Property.Bottom<string | number> | undefined;
|
|
44
|
+
right?: import("csstype").Property.Right<string | number> | undefined;
|
|
45
|
+
inset?: import("csstype").Property.Inset<string | number> | undefined;
|
|
46
|
+
display?: import("csstype").Property.Display | undefined;
|
|
47
|
+
flex?: import("csstype").Property.Flex<string | number> | undefined;
|
|
48
|
+
align?: import("csstype").Property.AlignItems | undefined;
|
|
49
|
+
justify?: import("csstype").Property.JustifyContent | undefined;
|
|
50
|
+
tf?: import("csstype").Property.Transform | undefined;
|
|
51
|
+
style?: CSSProperties | undefined;
|
|
52
|
+
className: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const getDOMSizeFromCodeZeroSize: (size: Code0Sizes | CSSProperties["x"]) => CSSProperties["x"];
|
|
55
|
+
export declare const hashToColor: (s: string, from?: number, to?: number) => string;
|