@wildix/uikit-handlebars 0.0.2

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 (57) hide show
  1. package/dist/components/input.d.ts +18 -0
  2. package/dist/components/input.d.ts.map +1 -0
  3. package/dist/components/input.js +90 -0
  4. package/dist/components/input.js.map +1 -0
  5. package/dist/components/lexical/context.d.ts +15 -0
  6. package/dist/components/lexical/context.d.ts.map +1 -0
  7. package/dist/components/lexical/context.js +10 -0
  8. package/dist/components/lexical/context.js.map +1 -0
  9. package/dist/components/lexical/extensions/HandlebarsDefaultsExtension.d.ts +4 -0
  10. package/dist/components/lexical/extensions/HandlebarsDefaultsExtension.d.ts.map +1 -0
  11. package/dist/components/lexical/extensions/HandlebarsDefaultsExtension.js +45 -0
  12. package/dist/components/lexical/extensions/HandlebarsDefaultsExtension.js.map +1 -0
  13. package/dist/components/lexical/extensions/HandlebarsSuggestionsExtension.d.ts +10 -0
  14. package/dist/components/lexical/extensions/HandlebarsSuggestionsExtension.d.ts.map +1 -0
  15. package/dist/components/lexical/extensions/HandlebarsSuggestionsExtension.js +352 -0
  16. package/dist/components/lexical/extensions/HandlebarsSuggestionsExtension.js.map +1 -0
  17. package/dist/components/lexical/extensions/HandlebarsVariableHighlightExtension.d.ts +10 -0
  18. package/dist/components/lexical/extensions/HandlebarsVariableHighlightExtension.d.ts.map +1 -0
  19. package/dist/components/lexical/extensions/HandlebarsVariableHighlightExtension.js +201 -0
  20. package/dist/components/lexical/extensions/HandlebarsVariableHighlightExtension.js.map +1 -0
  21. package/dist/components/lexical/handlebarsUtils.d.ts +22 -0
  22. package/dist/components/lexical/handlebarsUtils.d.ts.map +1 -0
  23. package/dist/components/lexical/handlebarsUtils.js +126 -0
  24. package/dist/components/lexical/handlebarsUtils.js.map +1 -0
  25. package/dist/components/lexical/helpers/setEditorText.d.ts +2 -0
  26. package/dist/components/lexical/helpers/setEditorText.d.ts.map +1 -0
  27. package/dist/components/lexical/helpers/setEditorText.js +10 -0
  28. package/dist/components/lexical/helpers/setEditorText.js.map +1 -0
  29. package/dist/components/lexical/nodes/HandlebarsHelperNode.d.ts +30 -0
  30. package/dist/components/lexical/nodes/HandlebarsHelperNode.d.ts.map +1 -0
  31. package/dist/components/lexical/nodes/HandlebarsHelperNode.js +89 -0
  32. package/dist/components/lexical/nodes/HandlebarsHelperNode.js.map +1 -0
  33. package/dist/components/lexical/nodes/HandlebarsVariableNode.d.ts +24 -0
  34. package/dist/components/lexical/nodes/HandlebarsVariableNode.d.ts.map +1 -0
  35. package/dist/components/lexical/nodes/HandlebarsVariableNode.js +61 -0
  36. package/dist/components/lexical/nodes/HandlebarsVariableNode.js.map +1 -0
  37. package/dist/components/lexical/plugins/AutoFocusPlugin.d.ts +2 -0
  38. package/dist/components/lexical/plugins/AutoFocusPlugin.d.ts.map +1 -0
  39. package/dist/components/lexical/plugins/AutoFocusPlugin.js +10 -0
  40. package/dist/components/lexical/plugins/AutoFocusPlugin.js.map +1 -0
  41. package/dist/components/lexical/plugins/ControlledValuePlugin.d.ts +7 -0
  42. package/dist/components/lexical/plugins/ControlledValuePlugin.d.ts.map +1 -0
  43. package/dist/components/lexical/plugins/ControlledValuePlugin.js +22 -0
  44. package/dist/components/lexical/plugins/ControlledValuePlugin.js.map +1 -0
  45. package/dist/components/lexical/plugins/DisabledValuePlugin.d.ts +6 -0
  46. package/dist/components/lexical/plugins/DisabledValuePlugin.d.ts.map +1 -0
  47. package/dist/components/lexical/plugins/DisabledValuePlugin.js +13 -0
  48. package/dist/components/lexical/plugins/DisabledValuePlugin.js.map +1 -0
  49. package/dist/components/textarea.d.ts +19 -0
  50. package/dist/components/textarea.d.ts.map +1 -0
  51. package/dist/components/textarea.js +83 -0
  52. package/dist/components/textarea.js.map +1 -0
  53. package/dist/index.d.ts +3 -0
  54. package/dist/index.d.ts.map +1 -0
  55. package/dist/index.js +8 -0
  56. package/dist/index.js.map +1 -0
  57. package/package.json +63 -0
@@ -0,0 +1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{"version":3,"file":"AutoFocusPlugin.d.ts","sourceRoot":"","sources":["../../../../src/components/lexical/plugins/AutoFocusPlugin.ts"],"names":[],"mappings":"AAIA,wBAAgB,eAAe,SAQ9B"}
@@ -0,0 +1,10 @@
1
+ import { useLayoutEffect } from 'react';
2
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
3
+ export function AutoFocusPlugin() {
4
+ const [editor] = useLexicalComposerContext();
5
+ useLayoutEffect(() => {
6
+ editor.focus();
7
+ }, []);
8
+ return null;
9
+ }
10
+ //# sourceMappingURL=AutoFocusPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AutoFocusPlugin.js","sourceRoot":"","sources":["../../../../src/components/lexical/plugins/AutoFocusPlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAC,yBAAyB,EAAC,MAAM,uCAAuC,CAAC;AAEhF,MAAM,UAAU,eAAe;IAC7B,MAAM,CAAC,MAAM,CAAC,GAAG,yBAAyB,EAAE,CAAC;IAE7C,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare function ControlledValuePlugin({ initialValue, editorValue, currentValue, controlled, }: {
2
+ initialValue?: string;
3
+ editorValue?: string;
4
+ currentValue?: string;
5
+ controlled: boolean;
6
+ }): null;
7
+ //# sourceMappingURL=ControlledValuePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ControlledValuePlugin.d.ts","sourceRoot":"","sources":["../../../../src/components/lexical/plugins/ControlledValuePlugin.ts"],"names":[],"mappings":"AAMA,wBAAgB,qBAAqB,CAAC,EACpC,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,GACX,EAAE;IACD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;CACrB,QAoBA"}
@@ -0,0 +1,22 @@
1
+ import { useLayoutEffect } from 'react';
2
+ import setEditorText from '../helpers/setEditorText';
3
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
4
+ export function ControlledValuePlugin({ initialValue, editorValue, currentValue, controlled, }) {
5
+ const [editor] = useLexicalComposerContext();
6
+ useLayoutEffect(() => {
7
+ editor.update(() => {
8
+ if (initialValue) {
9
+ setEditorText(initialValue || '');
10
+ }
11
+ });
12
+ }, [initialValue]);
13
+ useLayoutEffect(() => {
14
+ if (controlled && currentValue !== undefined && editorValue !== undefined && currentValue !== editorValue) {
15
+ editor.update(() => {
16
+ setEditorText(currentValue || '');
17
+ });
18
+ }
19
+ }, [currentValue, editorValue]);
20
+ return null;
21
+ }
22
+ //# sourceMappingURL=ControlledValuePlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ControlledValuePlugin.js","sourceRoot":"","sources":["../../../../src/components/lexical/plugins/ControlledValuePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,OAAO,CAAC;AAEtC,OAAO,aAAa,MAAM,0BAA0B,CAAC;AAErD,OAAO,EAAC,yBAAyB,EAAC,MAAM,uCAAuC,CAAC;AAEhF,MAAM,UAAU,qBAAqB,CAAC,EACpC,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,GAMX;IACC,MAAM,CAAC,MAAM,CAAC,GAAG,yBAAyB,EAAE,CAAC;IAE7C,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACjB,IAAI,YAAY,EAAE,CAAC;gBACjB,aAAa,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;YACpC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,eAAe,CAAC,GAAG,EAAE;QACnB,IAAI,UAAU,IAAI,YAAY,KAAK,SAAS,IAAI,WAAW,KAAK,SAAS,IAAI,YAAY,KAAK,WAAW,EAAE,CAAC;YAC1G,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE;gBACjB,aAAa,CAAC,YAAY,IAAI,EAAE,CAAC,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;IAEhC,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,6 @@
1
+ interface DisabledValuePluginProps {
2
+ disabled?: boolean;
3
+ }
4
+ export declare function DisabledValuePlugin({ disabled }: DisabledValuePluginProps): null;
5
+ export {};
6
+ //# sourceMappingURL=DisabledValuePlugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisabledValuePlugin.d.ts","sourceRoot":"","sources":["../../../../src/components/lexical/plugins/DisabledValuePlugin.ts"],"names":[],"mappings":"AAEA,UAAU,wBAAwB;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,wBAAgB,mBAAmB,CAAC,EAAC,QAAQ,EAAC,EAAE,wBAAwB,QAWvE"}
@@ -0,0 +1,13 @@
1
+ import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
2
+ export function DisabledValuePlugin({ disabled }) {
3
+ const [editor] = useLexicalComposerContext();
4
+ const editable = editor.isEditable();
5
+ if (editable && disabled) {
6
+ editor.setEditable(false);
7
+ }
8
+ else if (!editable && !disabled) {
9
+ editor.setEditable(true);
10
+ }
11
+ return null;
12
+ }
13
+ //# sourceMappingURL=DisabledValuePlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisabledValuePlugin.js","sourceRoot":"","sources":["../../../../src/components/lexical/plugins/DisabledValuePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,yBAAyB,EAAC,MAAM,uCAAuC,CAAC;AAMhF,MAAM,UAAU,mBAAmB,CAAC,EAAC,QAAQ,EAA2B;IACtE,MAAM,CAAC,MAAM,CAAC,GAAG,yBAAyB,EAAE,CAAC;IAC7C,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;IAErC,IAAI,QAAQ,IAAI,QAAQ,EAAE,CAAC;QACzB,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;SAAM,IAAI,CAAC,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export type TextareaHandlebarsProps = {
3
+ size?: 'sm' | 'default' | 'lg';
4
+ className?: string;
5
+ value?: string;
6
+ onChange?: (value: string) => void;
7
+ placeholder?: string;
8
+ disabled?: boolean;
9
+ autoFocus?: boolean;
10
+ onFocus?: React.FocusEventHandler;
11
+ onBlur?: React.FocusEventHandler;
12
+ variables?: string[];
13
+ helpers?: Record<string, {
14
+ description?: string;
15
+ }>;
16
+ };
17
+ export declare function TextareaHandlebars(props: TextareaHandlebarsProps): import("react/jsx-runtime").JSX.Element;
18
+ export default TextareaHandlebars;
19
+ //# sourceMappingURL=textarea.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../src/components/textarea.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqC,MAAM,OAAO,CAAC;AAqB1D,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IAClC,MAAM,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC,CAAC;CAClD,CAAC;AA8CF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,2CA0FhE;AAED,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,83 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useMemo, useRef } from 'react';
4
+ import { cn } from '@wildix/uikit';
5
+ import { cva } from 'class-variance-authority';
6
+ import { $getRoot, defineExtension } from 'lexical';
7
+ import { HandlebarsDefaultsExtension } from './lexical/extensions/HandlebarsDefaultsExtension';
8
+ import { HandlebarsSuggestionsExtension } from './lexical/extensions/HandlebarsSuggestionsExtension';
9
+ import { HandlebarsVariableHighlightExtension } from './lexical/extensions/HandlebarsVariableHighlightExtension';
10
+ import { AutoFocusPlugin } from './lexical/plugins/AutoFocusPlugin';
11
+ import { ControlledValuePlugin } from './lexical/plugins/ControlledValuePlugin';
12
+ import { DisabledValuePlugin } from './lexical/plugins/DisabledValuePlugin';
13
+ import { CodeExtension } from '@lexical/code';
14
+ import { HistoryExtension } from '@lexical/history';
15
+ import { PlainTextExtension } from '@lexical/plain-text';
16
+ import { ContentEditable } from '@lexical/react/LexicalContentEditable';
17
+ import { LexicalExtensionComposer } from '@lexical/react/LexicalExtensionComposer';
18
+ import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
19
+ const textareaControlVariants = cva('relative inline-flex w-full rounded-lg border border-input bg-background bg-clip-padding text-base shadow-xs ring-ring/24 transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] has-focus-visible:border-ring has-focus-visible:ring-[3px] has-disabled:opacity-64 has-aria-invalid:border-destructive/36 has-focus-visible:has-aria-invalid:border-destructive/64 has-focus-visible:has-aria-invalid:ring-destructive/16 has-[:disabled,:focus-visible,[aria-invalid]]:shadow-none sm:text-sm dark:bg-input/32 dark:bg-clip-border dark:not-has-disabled:has-not-focus-visible:not-has-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/8%)] dark:has-aria-invalid:ring-destructive/24');
20
+ const textareaEditableVariants = cva('field-sizing-content min-h-17.5 w-full rounded-[inherit] px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)] outline-none max-sm:min-h-20.5 overflow-auto [&>code]:block [&>code]:w-max [&>code]:font-sans no-scrollbar', {
21
+ variants: {
22
+ size: {
23
+ sm: 'min-h-16.5 px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)] max-sm:min-h-19.5',
24
+ default: '',
25
+ lg: 'min-h-18.5 py-[calc(--spacing(2)-1px)] max-sm:min-h-21.5',
26
+ },
27
+ disabled: {
28
+ true: 'opacity-50',
29
+ false: '',
30
+ },
31
+ },
32
+ defaultVariants: { size: 'default', disabled: false },
33
+ });
34
+ const placeholderVariants = cva('pointer-events-none absolute inset-0 flex items-start text-muted-foreground/64', {
35
+ variants: {
36
+ size: {
37
+ sm: 'px-[calc(--spacing(2.5)-1px)] py-[calc(--spacing(1)-1px)]',
38
+ default: 'px-[calc(--spacing(3)-1px)] py-[calc(--spacing(1.5)-1px)]',
39
+ lg: 'px-[calc(--spacing(3)-1px)] py-[calc(--spacing(2)-1px)]',
40
+ },
41
+ },
42
+ defaultVariants: {
43
+ size: 'default',
44
+ },
45
+ });
46
+ function TextareaPlaceholder({ size, text }) {
47
+ return _jsx("div", { className: placeholderVariants({ size }), children: text });
48
+ }
49
+ export function TextareaHandlebars(props) {
50
+ const { className, size = 'default', value, placeholder, disabled, autoFocus, onChange, onFocus, onBlur, variables, helpers, } = props;
51
+ const valueRef = useRef(value);
52
+ valueRef.current = value;
53
+ const initialValueRef = useRef(value);
54
+ const editorValueRef = useRef(value);
55
+ const controlled = Boolean(onChange);
56
+ const rootExtension = useMemo(() => defineExtension({
57
+ name: '[uikit-handlebars-root]',
58
+ dependencies: [
59
+ PlainTextExtension,
60
+ HistoryExtension,
61
+ CodeExtension,
62
+ HandlebarsDefaultsExtension,
63
+ HandlebarsSuggestionsExtension({ variables, helpers }),
64
+ HandlebarsVariableHighlightExtension({ variables, helpers, multiline: true }),
65
+ ],
66
+ editable: disabled !== true,
67
+ }), [disabled, variables, helpers]);
68
+ const handleChange = useCallback((editorState, editor) => {
69
+ if (controlled) {
70
+ editor.read(() => {
71
+ const text = $getRoot().getTextContent();
72
+ editorValueRef.current = text;
73
+ if (valueRef.current !== text) {
74
+ onChange?.(text);
75
+ }
76
+ });
77
+ }
78
+ }, [onChange]);
79
+ const contentEditable = useMemo(() => (_jsx(ContentEditable, { "data-slot": "textarea", className: textareaEditableVariants({ size, disabled }), role: "textbox", placeholder: () => (placeholder ? _jsx(TextareaPlaceholder, { size: size, text: placeholder }) : null), spellCheck: false, "aria-disabled": disabled || undefined, "aria-placeholder": placeholder || '', "aria-multiline": "true", disabled: disabled, onFocus: props.onFocus, onBlur: props.onBlur })), [disabled, placeholder, size, onFocus, onBlur]);
80
+ return (_jsx("span", { "data-slot": "textarea-control", "data-size": size, className: cn(textareaControlVariants(), className), children: _jsxs(LexicalExtensionComposer, { extension: rootExtension, contentEditable: contentEditable, children: [_jsx(ControlledValuePlugin, { initialValue: initialValueRef.current, editorValue: editorValueRef.current, currentValue: valueRef.current, controlled: controlled }), _jsx(DisabledValuePlugin, { disabled: disabled }), _jsx(OnChangePlugin, { onChange: handleChange }), autoFocus && _jsx(AutoFocusPlugin, {})] }) }));
81
+ }
82
+ export default TextareaHandlebars;
83
+ //# sourceMappingURL=textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../src/components/textarea.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAC,WAAW,EAAE,OAAO,EAAE,MAAM,EAAC,MAAM,OAAO,CAAC;AAE1D,OAAO,EAAC,EAAE,EAAC,MAAM,eAAe,CAAC;AAEjC,OAAO,EAAC,GAAG,EAAC,MAAM,0BAA0B,CAAC;AAC7C,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAuC,MAAM,SAAS,CAAC;AAExF,OAAO,EAAC,2BAA2B,EAAC,MAAM,kDAAkD,CAAC;AAC7F,OAAO,EAAC,8BAA8B,EAAC,MAAM,qDAAqD,CAAC;AACnG,OAAO,EAAC,oCAAoC,EAAC,MAAM,2DAA2D,CAAC;AAC/G,OAAO,EAAC,eAAe,EAAC,MAAM,mCAAmC,CAAC;AAClE,OAAO,EAAC,qBAAqB,EAAC,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAC,mBAAmB,EAAC,MAAM,uCAAuC,CAAC;AAE1E,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAC,kBAAkB,EAAC,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAC,eAAe,EAAC,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAC,wBAAwB,EAAC,MAAM,yCAAyC,CAAC;AACjF,OAAO,EAAC,cAAc,EAAC,MAAM,sCAAsC,CAAC;AAgBpE,MAAM,uBAAuB,GAAG,GAAG,CACjC,+0BAA+0B,CACh1B,CAAC;AAEF,MAAM,wBAAwB,GAAG,GAAG,CAClC,+NAA+N,EAC/N;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,EAAE,EAAE,wFAAwF;YAC5F,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C7B,MAAM,EAAE,KAAK,CAAC,MAAa,GAC3B,CACH,EACD,CAAC,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAC/C,CAAC;IAEF,OAAO,CACL,4BAAgB,kBAAkB,eAAY,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE,EAAE,SAAS,CAAC,YACrG,MAAC,wBAAwB,IAAC,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,aAClF,KAAC,qBAAqB,IACpB,YAAY,EAAE,eAAe,CAAC,OAAO,EACrC,WAAW,EAAE,cAAc,CAAC,OAAO,EACnC,YAAY,EAAE,QAAQ,CAAC,OAAO,EAC9B,UAAU,EAAE,UAAU,GACtB,EACF,KAAC,mBAAmB,IAAC,QAAQ,EAAE,QAAQ,GAAI,EAC3C,KAAC,cAAc,IAAC,QAAQ,EAAE,YAAY,GAAI,EACzC,SAAS,IAAI,KAAC,eAAe,KAAG,IACR,GACtB,CACR,CAAC;AACJ,CAAC;AAED,eAAe,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './components/input';
2
+ export * from './components/textarea';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,8 @@
1
+ // Export all components
2
+ export * from './components/input';
3
+ export * from './components/textarea';
4
+ // export * from './components/lexical/context';
5
+ // export * from '@wildix/uikit/components/lexical/nodes/HandlebarsVariableNode';
6
+ // export * from '@wildix/uikit/components/lexical/plugins/HandlebarsVariableAutocompletePlugin';
7
+ // export * from '@wildix/uikit/components/lexical/plugins/HandlebarsVariableTransformPlugin';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,wBAAwB;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,gDAAgD;AAChD,iFAAiF;AACjF,iGAAiG;AACjG,8FAA8F"}
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@wildix/uikit-handlebars",
3
+ "version": "0.0.2",
4
+ "type": "module",
5
+ "description": "Wildix UI component library",
6
+ "main": "./dist/index.js",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "bun run clean && tsc --project tsconfig.build.json",
14
+ "clean": "rimraf --glob './dist' '*.tsbuildinfo'",
15
+ "lint": "eslint . --max-warnings 0"
16
+ },
17
+ "dependencies": {
18
+ "@lexical/react": "^0.38.2",
19
+ "@lexical/code": "^0.38.2",
20
+ "@lexical/code-shiki": "^0.38.2",
21
+ "handlebars": "^4.7.8",
22
+ "lexical": "^0.38.2"
23
+ },
24
+ "peerDependencies": {
25
+ "@wildix/uikit": "*",
26
+ "react": "^19",
27
+ "react-dom": "^19"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^20.19.9",
31
+ "@types/react": "^19.1.9",
32
+ "@types/react-dom": "^19.1.7",
33
+ "@types/react-syntax-highlighter": "^15.5.13",
34
+ "@wildix/eslint-config-style-guide": "^1.2.2",
35
+ "eslint": "^8",
36
+ "react": "^19",
37
+ "react-dom": "^19",
38
+ "rimraf": "^5.0.5",
39
+ "tailwindcss": "^4.1.11",
40
+ "typescript": "^5.9.2"
41
+ },
42
+ "exports": {
43
+ ".": {
44
+ "types": "./dist/index.d.ts",
45
+ "import": "./dist/index.js"
46
+ },
47
+ "./lib/*": {
48
+ "types": "./dist/lib/*.d.ts",
49
+ "import": "./dist/lib/*.js"
50
+ },
51
+ "./components/*": {
52
+ "types": "./dist/components/*.d.ts",
53
+ "import": "./dist/components/*.js"
54
+ },
55
+ "./hooks/*": {
56
+ "types": "./dist/hooks/*.d.ts",
57
+ "import": "./dist/hooks/*.js"
58
+ }
59
+ },
60
+ "publishConfig": {
61
+ "access": "public"
62
+ }
63
+ }