@kingsimba/nc-ui 0.1.42 → 0.1.44
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/README.md +28 -27
- package/dist/GeneratedIcons-CGjL38ny.cjs +0 -1
- package/dist/GeneratedIcons-HFZmBTBT.js +0 -1
- package/dist/clsx-C11secjj.cjs +0 -1
- package/dist/clsx-OuTLNxxd.js +0 -1
- package/dist/code-editor.cjs +35 -0
- package/dist/code-editor.d.ts +34 -0
- package/dist/code-editor.js +265 -0
- package/dist/icons.cjs +0 -1
- package/dist/icons.js +0 -1
- package/dist/index-BZJJwrMY.js +3088 -0
- package/dist/index-Isl3QL-U.cjs +46 -0
- package/dist/index.cjs +0 -1
- package/dist/index.js +0 -1
- package/dist/style.css +1 -1
- package/dist/yaml.cjs +111 -157
- package/dist/yaml.js +1840 -4921
- package/package.json +6 -1
- package/dist/GeneratedIcons-CGjL38ny.cjs.map +0 -1
- package/dist/GeneratedIcons-HFZmBTBT.js.map +0 -1
- package/dist/clsx-C11secjj.cjs.map +0 -1
- package/dist/clsx-OuTLNxxd.js.map +0 -1
- package/dist/icons.cjs.map +0 -1
- package/dist/icons.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/yaml.cjs.map +0 -1
- package/dist/yaml.js.map +0 -1
package/README.md
CHANGED
|
@@ -70,33 +70,34 @@ function MyComponent() {
|
|
|
70
70
|
|
|
71
71
|
nc-ui provides 23+ ready-to-use components. Click any component to see it in the interactive demo:
|
|
72
72
|
|
|
73
|
-
| Component | Description
|
|
74
|
-
| ---------------------------------------------------------------------------------------- |
|
|
75
|
-
| [ActivityIndicator](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=activity) | Loading spinner with size variants and overlay mode
|
|
76
|
-
| [Alert](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=alert) | Status banners with simple content, optional dismissal, and legacy code/text support
|
|
77
|
-
| [AppDialog](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=app-dialog) | Render any registered app inside a dialog overlay
|
|
78
|
-
| [Battery](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=battery) | Visual battery level indicator
|
|
79
|
-
| [Button](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=buttons) | Primary action button with variants, sizes, and loading states
|
|
80
|
-
| [ButtonGroup](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=button-group) | Segmented control for switching between predefined options
|
|
81
|
-
| [Checkbox](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=checkbox) | Toggle selection with indeterminate state support
|
|
82
|
-
| [CommonButtons](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=buttons-icon) | Pre-configured buttons (Close, Edit, Refresh, Trash)
|
|
83
|
-
| [ComboBox](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=combobox) | Searchable dropdown with autocomplete
|
|
84
|
-
| [
|
|
85
|
-
| [
|
|
86
|
-
| [
|
|
87
|
-
| [
|
|
88
|
-
| [
|
|
89
|
-
| [
|
|
90
|
-
| [
|
|
91
|
-
| [
|
|
92
|
-
| [
|
|
93
|
-
| [
|
|
94
|
-
| [
|
|
95
|
-
| [
|
|
96
|
-
| [
|
|
97
|
-
| [
|
|
98
|
-
| [
|
|
99
|
-
| [
|
|
73
|
+
| Component | Description |
|
|
74
|
+
| ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
|
|
75
|
+
| [ActivityIndicator](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=activity) | Loading spinner with size variants and overlay mode |
|
|
76
|
+
| [Alert](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=alert) | Status banners with simple content, optional dismissal, and legacy code/text support |
|
|
77
|
+
| [AppDialog](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=app-dialog) | Render any registered app inside a dialog overlay |
|
|
78
|
+
| [Battery](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=battery) | Visual battery level indicator |
|
|
79
|
+
| [Button](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=buttons) | Primary action button with variants, sizes, and loading states |
|
|
80
|
+
| [ButtonGroup](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=button-group) | Segmented control for switching between predefined options |
|
|
81
|
+
| [Checkbox](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=checkbox) | Toggle selection with indeterminate state support |
|
|
82
|
+
| [CommonButtons](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=buttons-icon) | Pre-configured buttons (Close, Edit, Refresh, Trash) |
|
|
83
|
+
| [ComboBox](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=combobox) | Searchable dropdown with autocomplete |
|
|
84
|
+
| [CodeEditor](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=code-editor) | Code editor with syntax highlighting and line numbers (import from `@kingsimba/nc-ui/code-editor`) |
|
|
85
|
+
| [ContextMenu](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=context-menu) | Right-click menu with customizable items |
|
|
86
|
+
| [CsvTextArea](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=csv-textarea) | Tab-separated text editor with per-column color highlighting |
|
|
87
|
+
| [Dialog](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=dialog) | Modal dialogs with header, footer, and action buttons |
|
|
88
|
+
| [Hyperlink](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=hyperlink) | Styled anchor/link component |
|
|
89
|
+
| [Icons](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=icons) | 50+ SVG icons (separate import path) |
|
|
90
|
+
| [Input](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=input) | Text input with validation states and prefix/suffix support |
|
|
91
|
+
| [ListGroup](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=list-group) | Grouped content sections built from `ListGroupItem` children |
|
|
92
|
+
| [MonthRangePicker](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=month-range) | Month range selector with validation (YY-M(M) or YYYY-M(M) format) |
|
|
93
|
+
| [MultiSelect](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=multi-select) | Multi-selection dropdown with tag display |
|
|
94
|
+
| [NavStack](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=nav-stack) | Stack-based navigation for mobile-style settings UIs |
|
|
95
|
+
| [Notification](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=notification) | Toast-style notifications with auto-dismiss and stacking |
|
|
96
|
+
| [NumberInput](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=number-input) | Numeric input with increment/decrement controls |
|
|
97
|
+
| [Slider](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=slider) | Range slider with value display |
|
|
98
|
+
| [Tabs](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=tabs) | Tabbed navigation component |
|
|
99
|
+
| [Toggle](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=toggle) | Switch/toggle with on/off states |
|
|
100
|
+
| [YamlTextArea](https://kingsimba.github.io/nc-ui/?app=ui-components&tab=yaml-textarea) | YAML editor with syntax highlighting and validation (import from `@kingsimba/nc-ui/yaml`) |
|
|
100
101
|
|
|
101
102
|
## App Framework
|
|
102
103
|
|
|
@@ -1,2 +1 @@
|
|
|
1
1
|
"use strict";const n=require("react/jsx-runtime");function s({size:o=24,color:r="currentColor",strokeWidth:e=2,className:t,style:i}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:r,strokeWidth:e,strokeLinecap:"round",strokeLinejoin:"round",className:t,style:i,children:[n.jsx("line",{x1:"20",y1:"4",x2:"4",y2:"20"}),n.jsx("line",{x1:"4",y1:"4",x2:"20",y2:"20"})]})}function c({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h8"}),n.jsx("polyline",{points:"17 4 20 4 20 7"}),n.jsx("line",{x1:"13",y1:"11",x2:"20",y2:"4"})]})}function h({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("rect",{x:"3",y:"4",width:"18",height:"14",rx:"2"}),n.jsx("line",{x1:"8",y1:"21",x2:"16",y2:"21"}),n.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"21"}),n.jsx("line",{x1:"7",y1:"11",x2:"17",y2:"11"})]})}function x({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"}),n.jsx("circle",{cx:"12",cy:"12",r:"3"})]})}function l({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"-2 -2 28 28",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M1.5 9a15.5 15.5 0 0 1 21 0"}),n.jsx("path",{d:"M5 12.5a10 10 0 0 1 14 0"}),n.jsx("path",{d:"M8.5 16a5 5 0 0 1 7 0"}),n.jsx("circle",{cx:"12",cy:"20",r:"1.5",fill:"currentColor"})]})}function d({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2"}),n.jsx("path",{d:"M8 11V7a4 4 0 0 1 8 0v4"})]})}function u({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("rect",{x:"5",y:"11",width:"14",height:"10",rx:"2"}),n.jsx("path",{d:"M8 11V7a4 4 0 0 1 7.83-1"})]})}function j({size:o=24,className:r,style:e}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:n.jsx("polyline",{points:"9 18 15 12 9 6"})})}function a({size:o=24,className:r,style:e}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:n.jsx("polyline",{points:"15 18 9 12 15 6"})})}function k({size:o=24,className:r,style:e}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:n.jsx("polyline",{points:"6 9 12 15 18 9"})})}function v({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"-2 -2 28 28",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M21 2v6h-6"}),n.jsx("path",{d:"M3 12a9 9 0 0 1 15-6.7L21 8"}),n.jsx("path",{d:"M3 22v-6h6"}),n.jsx("path",{d:"M21 12a9 9 0 0 1-15 6.7L3 16"})]})}function p({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}),n.jsx("path",{d:"M3 3v5h5"})]})}function f({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),n.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]})}function w({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("polyline",{points:"3 6 5 6 21 6"}),n.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}),n.jsx("line",{x1:"10",y1:"11",x2:"10",y2:"17"}),n.jsx("line",{x1:"14",y1:"11",x2:"14",y2:"17"})]})}function y({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M4 4h5l2 2h9a1 1 0 0 1 1 1v2H3V5a1 1 0 0 1 1-1z"}),n.jsx("path",{d:"M2 9h20l-2 11H4L2 9z"}),n.jsx("path",{d:"M8 14h8",strokeDasharray:"2 2",opacity:"0.5"})]})}function L({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("circle",{cx:"12",cy:"12",r:"10"}),n.jsx("line",{x1:"12",y1:"16",x2:"12",y2:"12"}),n.jsx("line",{x1:"12",y1:"8",x2:"12.01",y2:"8"})]})}function g({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83"}),n.jsx("path",{d:"M22 12A10 10 0 0 0 12 2v10z"})]})}function I({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M12 2v10"}),n.jsx("path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04"})]})}function C({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z"}),n.jsx("circle",{cx:"12",cy:"13",r:"4"})]})}function M({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}function B({size:o=24,className:r,style:e}){return n.jsx("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:n.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})})}function W({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("circle",{cx:"9.5",cy:"4",r:"2",opacity:"0.5"}),n.jsx("circle",{cx:"9.5",cy:"4",r:"3.5",opacity:"0.3"}),n.jsx("path",{d:"M8 13V5.5a1.5 1.5 0 0 1 3 0V12"}),n.jsx("path",{d:"M11 11.5v-2a1.5 1.5 0 0 1 3 0v2.5"}),n.jsx("path",{d:"M14 10.5a1.5 1.5 0 0 1 3 0v1.5"}),n.jsx("path",{d:"M17 11.5a1.5 1.5 0 0 1 3 0v4.5a6 6 0 0 1-6 6h-2h.2a6 6 0 0 1-5-2.7l-.2-.3c-.3-.5-1.4-2.4-3.2-6.3l-.5-.8a.6.6 0 0 1 .5-.8h2.5"})]})}function H({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"currentColor",className:r,style:e,children:[n.jsx("circle",{cx:"12",cy:"5",r:"2"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"}),n.jsx("circle",{cx:"12",cy:"19",r:"2"})]})}function V({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"currentColor",className:r,style:e,children:[n.jsx("circle",{cx:"5",cy:"12",r:"2"}),n.jsx("circle",{cx:"12",cy:"12",r:"2"}),n.jsx("circle",{cx:"19",cy:"12",r:"2"})]})}function E({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("path",{d:"M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"}),n.jsx("line",{x1:"1",y1:"1",x2:"23",y2:"23"})]})}function m({size:o=24,className:r,style:e}){return n.jsxs("svg",{width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:r,style:e,children:[n.jsx("circle",{cx:"11",cy:"11",r:"8"}),n.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}exports.CameraIcon=C;exports.ChevronDownIcon=k;exports.ChevronLeftIcon=a;exports.ChevronRightIcon=j;exports.CloseIcon=s;exports.DoubleClickIcon=W;exports.EditIcon=f;exports.EmptyFolderIcon=y;exports.ExternalLinkIcon=c;exports.EyeHiddenIcon=E;exports.HideAppsIcon=h;exports.InfoIcon=L;exports.LockIcon=d;exports.MinusIcon=B;exports.MoreHorizontalIcon=V;exports.MoreIcon=H;exports.PieChartIcon=g;exports.PlusIcon=M;exports.PowerIcon=I;exports.RefreshIcon=v;exports.RevertIcon=p;exports.SearchIcon=m;exports.TrashIcon=w;exports.UnlockIcon=u;exports.ViewIcon=x;exports.WifiIcon=l;
|
|
2
|
-
//# sourceMappingURL=GeneratedIcons-CGjL38ny.cjs.map
|
package/dist/clsx-C11secjj.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
1
|
"use strict";function i(r){var f,n,t="";if(typeof r=="string"||typeof r=="number")t+=r;else if(typeof r=="object")if(Array.isArray(r)){var s=r.length;for(f=0;f<s;f++)r[f]&&(n=i(r[f]))&&(t&&(t+=" "),t+=n)}else for(n in r)r[n]&&(t&&(t+=" "),t+=n);return t}function o(){for(var r,f,n=0,t="",s=arguments.length;n<s;n++)(r=arguments[n])&&(f=i(r))&&(t&&(t+=" "),t+=f);return t}exports.clsx=o;
|
|
2
|
-
//# sourceMappingURL=clsx-C11secjj.cjs.map
|
package/dist/clsx-OuTLNxxd.js
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),s=require("react"),m=require("./index-Isl3QL-U.cjs");function A(n,a,o,t){if(!a)return{content:n,column:t+n.length};let r=t;return{content:Array.from(n,(d,c)=>{if(d===" ")return r++,e.jsx("span",{className:"nc-code-editor-whitespace","aria-hidden":"true",children:"·"},c);if(d===" "){const p=o-r%o;return r+=p,e.jsx("span",{className:"nc-code-editor-whitespace nc-code-editor-tab",style:{width:`${p}ch`},"aria-hidden":"true",children:"→"},c)}return r++,d}),column:r}}function H(n){var r;const a=(r=n.split(".").pop())==null?void 0:r.toLowerCase();if(!a)return;const o={ts:"typescript",tsx:"tsx",js:"javascript",jsx:"jsx",json:"json",yaml:"yaml",yml:"yaml",py:"python",rb:"ruby",rs:"rust",go:"go",java:"java",c:"c",cpp:"cpp",h:"c",hpp:"cpp",cs:"csharp",sh:"bash",bash:"bash",zsh:"bash",fish:"bash",md:"markdown",markdown:"markdown",html:"html",htm:"html",css:"css",scss:"scss",sql:"sql",xml:"xml",svg:"xml",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",properties:"properties",env:"properties",nginx:"nginx",dockerfile:"docker",makefile:"makefile",cmake:"cmake",lua:"lua",php:"php",pl:"perl",pm:"perl",r:"r",swift:"swift",kt:"kotlin",scala:"scala",dart:"dart",graphql:"graphql",proto:"protobuf"};if(o[a])return o[a];const t=n.toLowerCase();if(o[t])return o[t]}function S({value:n,onChange:a,language:o,readOnly:t=!1,minHeight:r=100,maxHeight:x,lineNumbers:d=!0,showWhitespace:c=!1,tabSize:p=8,colorTheme:b="auto",className:R="",style:q={}}){const h=Number.isFinite(p)?Math.max(1,Math.floor(p)):8,v=s.useMemo(()=>n.split(`
|
|
2
|
+
`).length,[n]),z=s.useMemo(()=>Array.from({length:v},(u,l)=>l+1).join(`
|
|
3
|
+
`),[v]),[E,L]=s.useState(!1);s.useEffect(()=>{const u=()=>{const i=getComputedStyle(document.documentElement).getPropertyValue("--nc-bg").trim();L(i.startsWith("#0")||i.startsWith("#1")||i.startsWith("#2")||i.startsWith("#3"))};u();const l=new MutationObserver(u);return l.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme"]}),()=>l.disconnect()},[]);const w=b==="dark"||b==="auto"&&E?m.themes_exports.vsDark:m.themes_exports.vsLight,T=s.useCallback(u=>{const l=o||"text";return e.jsx(m.Highlight2,{theme:w,code:u,language:l,children:({tokens:i,getLineProps:D,getTokenProps:F})=>e.jsx(e.Fragment,{children:i.map((k,y)=>{let j=0;return e.jsxs("div",{...D({line:k}),children:[k.map((C,W)=>{const N=F({token:C}),M=A(C.content,c,h,j);return j=M.column,e.jsx("span",{...N,style:{...N.style,opacity:t?.7:void 0},children:M.content},W)}),c&&y<i.length-1&&e.jsx("span",{className:"nc-code-editor-line-ending","aria-hidden":"true",children:"↵"})]},y)})})})},[w,o,h,t,c]),g=s.useRef(null),f=s.useRef(null),_=()=>{g.current&&f.current&&(f.current.scrollTop=g.current.scrollTop)};return e.jsxs("div",{className:`nc-code-editor ${R}`.trim(),style:{display:"flex",flexDirection:"column",gap:4,...q},children:[e.jsx("style",{children:`
|
|
4
|
+
.code-editor-container,
|
|
5
|
+
.code-editor-container * {
|
|
6
|
+
white-space: pre !important;
|
|
7
|
+
overflow-wrap: normal !important;
|
|
8
|
+
word-wrap: normal !important;
|
|
9
|
+
word-break: keep-all !important;
|
|
10
|
+
}
|
|
11
|
+
.code-editor-container textarea,
|
|
12
|
+
.code-editor-container pre {
|
|
13
|
+
white-space: pre !important;
|
|
14
|
+
overflow-wrap: normal !important;
|
|
15
|
+
word-wrap: normal !important;
|
|
16
|
+
word-break: keep-all !important;
|
|
17
|
+
overflow-x: visible !important;
|
|
18
|
+
resize: none !important;
|
|
19
|
+
}
|
|
20
|
+
.code-editor-container.read-only textarea {
|
|
21
|
+
caret-color: transparent !important;
|
|
22
|
+
color: var(--nc-text-weak) !important;
|
|
23
|
+
}
|
|
24
|
+
.nc-code-editor .token.tag {
|
|
25
|
+
display: inline;
|
|
26
|
+
padding: 0;
|
|
27
|
+
border: 0;
|
|
28
|
+
border-radius: 0;
|
|
29
|
+
background: transparent;
|
|
30
|
+
color: inherit;
|
|
31
|
+
font-size: inherit;
|
|
32
|
+
font-weight: inherit;
|
|
33
|
+
white-space: inherit;
|
|
34
|
+
}
|
|
35
|
+
`}),e.jsxs("div",{className:"nc-code-editor-container",style:{border:"1px solid var(--nc-border)",background:t?"var(--nc-bg-secondary)":"var(--nc-bg-tertiary)",minHeight:r,maxHeight:x,display:"flex"},children:[d&&e.jsx("div",{ref:f,style:{padding:"10px 8px",paddingRight:12,background:"var(--nc-bg-tertiary)",borderRight:"1px solid var(--nc-border)",color:"var(--nc-text-weak)",fontFamily:'Consolas, Monaco, "Courier New", monospace',fontSize:13,lineHeight:"1.5",textAlign:"right",userSelect:"none",whiteSpace:"pre",minWidth:40,overflow:"hidden"},children:z}),e.jsx("div",{ref:g,className:`code-editor-container${t?" read-only":""}`,style:{flex:1,overflowX:"auto",overflowY:"auto",color:"var(--nc-text)"},onScroll:_,children:e.jsx(m._default,{value:n,onValueChange:a,highlight:T,padding:10,readOnly:t,style:{fontFamily:'Consolas, Monaco, "Courier New", monospace',fontSize:13,lineHeight:"1.5",minHeight:Math.max(r-2,0),background:"transparent",color:"var(--nc-text)",whiteSpace:"pre",minWidth:"max-content",tabSize:h},textareaClassName:"code-editor-textarea"})})]})]})}exports.CodeEditor=S;exports.default=S;exports.detectLanguage=H;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { default as default_2 } from 'react';
|
|
2
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
declare function CodeEditor({ value, onChange, language, readOnly, minHeight, maxHeight, lineNumbers: showLineNumbers, showWhitespace, tabSize, colorTheme, className, style, }: CodeEditorProps): JSX_2.Element;
|
|
5
|
+
export { CodeEditor }
|
|
6
|
+
export default CodeEditor;
|
|
7
|
+
|
|
8
|
+
export declare interface CodeEditorProps {
|
|
9
|
+
value: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
/** Prism language name (e.g. 'javascript', 'python', 'yaml'). Omit for plain text. */
|
|
12
|
+
language?: string;
|
|
13
|
+
readOnly?: boolean;
|
|
14
|
+
minHeight?: number;
|
|
15
|
+
maxHeight?: number;
|
|
16
|
+
/** Show line numbers gutter. Default: true. */
|
|
17
|
+
lineNumbers?: boolean;
|
|
18
|
+
/** Show markers for spaces, tabs, and line endings. Default: false. */
|
|
19
|
+
showWhitespace?: boolean;
|
|
20
|
+
/** Number of columns occupied by a tab. Default: 8. */
|
|
21
|
+
tabSize?: number;
|
|
22
|
+
/** Prism color theme. Defaults to automatic document theme detection. */
|
|
23
|
+
colorTheme?: 'light' | 'dark' | 'auto';
|
|
24
|
+
className?: string;
|
|
25
|
+
style?: default_2.CSSProperties;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Map a filename (or file extension) to a Prism language name.
|
|
30
|
+
* Returns undefined if the language is not recognized.
|
|
31
|
+
*/
|
|
32
|
+
export declare function detectLanguage(filename: string): string | undefined;
|
|
33
|
+
|
|
34
|
+
export { }
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { jsx as o, Fragment as A, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as S, useState as $, useEffect as V, useCallback as I, useRef as M } from "react";
|
|
3
|
+
import { t as z, H as P, _ as X } from "./index-BZJJwrMY.js";
|
|
4
|
+
function Y(r, a, n, e) {
|
|
5
|
+
if (!a)
|
|
6
|
+
return { content: r, column: e + r.length };
|
|
7
|
+
let t = e;
|
|
8
|
+
return { content: Array.from(r, (c, s) => {
|
|
9
|
+
if (c === " ")
|
|
10
|
+
return t++, /* @__PURE__ */ o("span", { className: "nc-code-editor-whitespace", "aria-hidden": "true", children: "·" }, s);
|
|
11
|
+
if (c === " ") {
|
|
12
|
+
const l = n - t % n;
|
|
13
|
+
return t += l, /* @__PURE__ */ o(
|
|
14
|
+
"span",
|
|
15
|
+
{
|
|
16
|
+
className: "nc-code-editor-whitespace nc-code-editor-tab",
|
|
17
|
+
style: { width: `${l}ch` },
|
|
18
|
+
"aria-hidden": "true",
|
|
19
|
+
children: "→"
|
|
20
|
+
},
|
|
21
|
+
s
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
return t++, c;
|
|
25
|
+
}), column: t };
|
|
26
|
+
}
|
|
27
|
+
function K(r) {
|
|
28
|
+
var t;
|
|
29
|
+
const a = (t = r.split(".").pop()) == null ? void 0 : t.toLowerCase();
|
|
30
|
+
if (!a) return;
|
|
31
|
+
const n = {
|
|
32
|
+
ts: "typescript",
|
|
33
|
+
tsx: "tsx",
|
|
34
|
+
js: "javascript",
|
|
35
|
+
jsx: "jsx",
|
|
36
|
+
json: "json",
|
|
37
|
+
yaml: "yaml",
|
|
38
|
+
yml: "yaml",
|
|
39
|
+
py: "python",
|
|
40
|
+
rb: "ruby",
|
|
41
|
+
rs: "rust",
|
|
42
|
+
go: "go",
|
|
43
|
+
java: "java",
|
|
44
|
+
c: "c",
|
|
45
|
+
cpp: "cpp",
|
|
46
|
+
h: "c",
|
|
47
|
+
hpp: "cpp",
|
|
48
|
+
cs: "csharp",
|
|
49
|
+
sh: "bash",
|
|
50
|
+
bash: "bash",
|
|
51
|
+
zsh: "bash",
|
|
52
|
+
fish: "bash",
|
|
53
|
+
md: "markdown",
|
|
54
|
+
markdown: "markdown",
|
|
55
|
+
html: "html",
|
|
56
|
+
htm: "html",
|
|
57
|
+
css: "css",
|
|
58
|
+
scss: "scss",
|
|
59
|
+
sql: "sql",
|
|
60
|
+
xml: "xml",
|
|
61
|
+
svg: "xml",
|
|
62
|
+
toml: "toml",
|
|
63
|
+
ini: "ini",
|
|
64
|
+
cfg: "ini",
|
|
65
|
+
conf: "ini",
|
|
66
|
+
properties: "properties",
|
|
67
|
+
env: "properties",
|
|
68
|
+
nginx: "nginx",
|
|
69
|
+
dockerfile: "docker",
|
|
70
|
+
makefile: "makefile",
|
|
71
|
+
cmake: "cmake",
|
|
72
|
+
lua: "lua",
|
|
73
|
+
php: "php",
|
|
74
|
+
pl: "perl",
|
|
75
|
+
pm: "perl",
|
|
76
|
+
r: "r",
|
|
77
|
+
swift: "swift",
|
|
78
|
+
kt: "kotlin",
|
|
79
|
+
scala: "scala",
|
|
80
|
+
dart: "dart",
|
|
81
|
+
graphql: "graphql",
|
|
82
|
+
proto: "protobuf"
|
|
83
|
+
};
|
|
84
|
+
if (n[a]) return n[a];
|
|
85
|
+
const e = r.toLowerCase();
|
|
86
|
+
if (n[e]) return n[e];
|
|
87
|
+
}
|
|
88
|
+
function Q({
|
|
89
|
+
value: r,
|
|
90
|
+
onChange: a,
|
|
91
|
+
language: n,
|
|
92
|
+
readOnly: e = !1,
|
|
93
|
+
minHeight: t = 100,
|
|
94
|
+
maxHeight: f,
|
|
95
|
+
lineNumbers: c = !0,
|
|
96
|
+
showWhitespace: s = !1,
|
|
97
|
+
tabSize: l = 8,
|
|
98
|
+
colorTheme: b = "auto",
|
|
99
|
+
className: L = "",
|
|
100
|
+
style: D = {}
|
|
101
|
+
}) {
|
|
102
|
+
const m = Number.isFinite(l) ? Math.max(1, Math.floor(l)) : 8, x = S(() => r.split(`
|
|
103
|
+
`).length, [r]), E = S(() => Array.from({ length: x }, (d, p) => p + 1).join(`
|
|
104
|
+
`), [x]), [F, R] = $(!1);
|
|
105
|
+
V(() => {
|
|
106
|
+
const d = () => {
|
|
107
|
+
const i = getComputedStyle(document.documentElement).getPropertyValue("--nc-bg").trim();
|
|
108
|
+
R(i.startsWith("#0") || i.startsWith("#1") || i.startsWith("#2") || i.startsWith("#3"));
|
|
109
|
+
};
|
|
110
|
+
d();
|
|
111
|
+
const p = new MutationObserver(d);
|
|
112
|
+
return p.observe(document.documentElement, { attributes: !0, attributeFilter: ["class", "data-theme"] }), () => p.disconnect();
|
|
113
|
+
}, []);
|
|
114
|
+
const w = b === "dark" || b === "auto" && F ? z.vsDark : z.vsLight, T = I(
|
|
115
|
+
(d) => /* @__PURE__ */ o(P, { theme: w, code: d, language: n || "text", children: ({ tokens: i, getLineProps: q, getTokenProps: H }) => /* @__PURE__ */ o(A, { children: i.map((v, k) => {
|
|
116
|
+
let y = 0;
|
|
117
|
+
return /* @__PURE__ */ g("div", { ...q({ line: v }), children: [
|
|
118
|
+
v.map((N, _) => {
|
|
119
|
+
const C = H({ token: N }), j = Y(
|
|
120
|
+
N.content,
|
|
121
|
+
s,
|
|
122
|
+
m,
|
|
123
|
+
y
|
|
124
|
+
);
|
|
125
|
+
return y = j.column, /* @__PURE__ */ o(
|
|
126
|
+
"span",
|
|
127
|
+
{
|
|
128
|
+
...C,
|
|
129
|
+
style: {
|
|
130
|
+
...C.style,
|
|
131
|
+
opacity: e ? 0.7 : void 0
|
|
132
|
+
},
|
|
133
|
+
children: j.content
|
|
134
|
+
},
|
|
135
|
+
_
|
|
136
|
+
);
|
|
137
|
+
}),
|
|
138
|
+
s && k < i.length - 1 && /* @__PURE__ */ o("span", { className: "nc-code-editor-line-ending", "aria-hidden": "true", children: "↵" })
|
|
139
|
+
] }, k);
|
|
140
|
+
}) }) }),
|
|
141
|
+
[w, n, m, e, s]
|
|
142
|
+
), h = M(null), u = M(null), W = () => {
|
|
143
|
+
h.current && u.current && (u.current.scrollTop = h.current.scrollTop);
|
|
144
|
+
};
|
|
145
|
+
return /* @__PURE__ */ g(
|
|
146
|
+
"div",
|
|
147
|
+
{
|
|
148
|
+
className: `nc-code-editor ${L}`.trim(),
|
|
149
|
+
style: { display: "flex", flexDirection: "column", gap: 4, ...D },
|
|
150
|
+
children: [
|
|
151
|
+
/* @__PURE__ */ o("style", { children: `
|
|
152
|
+
.code-editor-container,
|
|
153
|
+
.code-editor-container * {
|
|
154
|
+
white-space: pre !important;
|
|
155
|
+
overflow-wrap: normal !important;
|
|
156
|
+
word-wrap: normal !important;
|
|
157
|
+
word-break: keep-all !important;
|
|
158
|
+
}
|
|
159
|
+
.code-editor-container textarea,
|
|
160
|
+
.code-editor-container pre {
|
|
161
|
+
white-space: pre !important;
|
|
162
|
+
overflow-wrap: normal !important;
|
|
163
|
+
word-wrap: normal !important;
|
|
164
|
+
word-break: keep-all !important;
|
|
165
|
+
overflow-x: visible !important;
|
|
166
|
+
resize: none !important;
|
|
167
|
+
}
|
|
168
|
+
.code-editor-container.read-only textarea {
|
|
169
|
+
caret-color: transparent !important;
|
|
170
|
+
color: var(--nc-text-weak) !important;
|
|
171
|
+
}
|
|
172
|
+
.nc-code-editor .token.tag {
|
|
173
|
+
display: inline;
|
|
174
|
+
padding: 0;
|
|
175
|
+
border: 0;
|
|
176
|
+
border-radius: 0;
|
|
177
|
+
background: transparent;
|
|
178
|
+
color: inherit;
|
|
179
|
+
font-size: inherit;
|
|
180
|
+
font-weight: inherit;
|
|
181
|
+
white-space: inherit;
|
|
182
|
+
}
|
|
183
|
+
` }),
|
|
184
|
+
/* @__PURE__ */ g(
|
|
185
|
+
"div",
|
|
186
|
+
{
|
|
187
|
+
className: "nc-code-editor-container",
|
|
188
|
+
style: {
|
|
189
|
+
border: "1px solid var(--nc-border)",
|
|
190
|
+
background: e ? "var(--nc-bg-secondary)" : "var(--nc-bg-tertiary)",
|
|
191
|
+
minHeight: t,
|
|
192
|
+
maxHeight: f,
|
|
193
|
+
display: "flex"
|
|
194
|
+
},
|
|
195
|
+
children: [
|
|
196
|
+
c && /* @__PURE__ */ o(
|
|
197
|
+
"div",
|
|
198
|
+
{
|
|
199
|
+
ref: u,
|
|
200
|
+
style: {
|
|
201
|
+
padding: "10px 8px",
|
|
202
|
+
paddingRight: 12,
|
|
203
|
+
background: "var(--nc-bg-tertiary)",
|
|
204
|
+
borderRight: "1px solid var(--nc-border)",
|
|
205
|
+
color: "var(--nc-text-weak)",
|
|
206
|
+
fontFamily: 'Consolas, Monaco, "Courier New", monospace',
|
|
207
|
+
fontSize: 13,
|
|
208
|
+
lineHeight: "1.5",
|
|
209
|
+
textAlign: "right",
|
|
210
|
+
userSelect: "none",
|
|
211
|
+
whiteSpace: "pre",
|
|
212
|
+
minWidth: 40,
|
|
213
|
+
overflow: "hidden"
|
|
214
|
+
},
|
|
215
|
+
children: E
|
|
216
|
+
}
|
|
217
|
+
),
|
|
218
|
+
/* @__PURE__ */ o(
|
|
219
|
+
"div",
|
|
220
|
+
{
|
|
221
|
+
ref: h,
|
|
222
|
+
className: `code-editor-container${e ? " read-only" : ""}`,
|
|
223
|
+
style: {
|
|
224
|
+
flex: 1,
|
|
225
|
+
overflowX: "auto",
|
|
226
|
+
overflowY: "auto",
|
|
227
|
+
color: "var(--nc-text)"
|
|
228
|
+
},
|
|
229
|
+
onScroll: W,
|
|
230
|
+
children: /* @__PURE__ */ o(
|
|
231
|
+
X,
|
|
232
|
+
{
|
|
233
|
+
value: r,
|
|
234
|
+
onValueChange: a,
|
|
235
|
+
highlight: T,
|
|
236
|
+
padding: 10,
|
|
237
|
+
readOnly: e,
|
|
238
|
+
style: {
|
|
239
|
+
fontFamily: 'Consolas, Monaco, "Courier New", monospace',
|
|
240
|
+
fontSize: 13,
|
|
241
|
+
lineHeight: "1.5",
|
|
242
|
+
minHeight: Math.max(t - 2, 0),
|
|
243
|
+
background: "transparent",
|
|
244
|
+
color: "var(--nc-text)",
|
|
245
|
+
whiteSpace: "pre",
|
|
246
|
+
minWidth: "max-content",
|
|
247
|
+
tabSize: m
|
|
248
|
+
},
|
|
249
|
+
textareaClassName: "code-editor-textarea"
|
|
250
|
+
}
|
|
251
|
+
)
|
|
252
|
+
}
|
|
253
|
+
)
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
)
|
|
257
|
+
]
|
|
258
|
+
}
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
export {
|
|
262
|
+
Q as CodeEditor,
|
|
263
|
+
Q as default,
|
|
264
|
+
K as detectLanguage
|
|
265
|
+
};
|
package/dist/icons.cjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./GeneratedIcons-CGjL38ny.cjs");exports.CameraIcon=o.CameraIcon;exports.ChevronDownIcon=o.ChevronDownIcon;exports.ChevronLeftIcon=o.ChevronLeftIcon;exports.ChevronRightIcon=o.ChevronRightIcon;exports.CloseIcon=o.CloseIcon;exports.DoubleClickIcon=o.DoubleClickIcon;exports.EditIcon=o.EditIcon;exports.EmptyFolderIcon=o.EmptyFolderIcon;exports.ExternalLinkIcon=o.ExternalLinkIcon;exports.EyeHiddenIcon=o.EyeHiddenIcon;exports.HideAppsIcon=o.HideAppsIcon;exports.InfoIcon=o.InfoIcon;exports.LockIcon=o.LockIcon;exports.MinusIcon=o.MinusIcon;exports.MoreHorizontalIcon=o.MoreHorizontalIcon;exports.MoreIcon=o.MoreIcon;exports.PieChartIcon=o.PieChartIcon;exports.PlusIcon=o.PlusIcon;exports.PowerIcon=o.PowerIcon;exports.RefreshIcon=o.RefreshIcon;exports.RevertIcon=o.RevertIcon;exports.SearchIcon=o.SearchIcon;exports.TrashIcon=o.TrashIcon;exports.UnlockIcon=o.UnlockIcon;exports.ViewIcon=o.ViewIcon;exports.WifiIcon=o.WifiIcon;
|
|
2
|
-
//# sourceMappingURL=icons.cjs.map
|
package/dist/icons.js
CHANGED