windcraft-editor 0.1.0 → 0.1.1
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/LICENSE +23 -0
- package/README.md +8 -4
- package/{design → editor/design}/classes-section.js +1 -1
- package/{design → editor/design}/controls.js +1 -1
- package/{design → editor/design}/design-tab.js +1 -1
- package/{design → editor/design}/editor/designs.js +2 -2
- package/{design → editor/design}/editor/inspector.js +2 -2
- package/{design → editor/design}/editor/plane.js +1 -1
- package/{design → editor/design}/figma-sections.js +2 -2
- package/{design → editor/design}/panel-model.js +2 -2
- package/{design → editor/design}/style-sections.js +2 -2
- package/{index.js → editor/index.js} +4 -4
- package/{playground → editor/playground}/component-source.js +1 -1
- package/package.json +6 -17
- /package/{design → editor/design}/agent.js +0 -0
- /package/{design → editor/design}/code-editor.js +0 -0
- /package/{design → editor/design}/code-view.js +0 -0
- /package/{design → editor/design}/color-picker.js +0 -0
- /package/{design → editor/design}/config.js +0 -0
- /package/{design → editor/design}/css-props.js +0 -0
- /package/{design → editor/design}/device-frame.js +0 -0
- /package/{design → editor/design}/editor/add-menu.js +0 -0
- /package/{design → editor/design}/editor/api.js +0 -0
- /package/{design → editor/design}/editor/base.js +0 -0
- /package/{design → editor/design}/editor/code-panel.js +0 -0
- /package/{design → editor/design}/editor/color-ui.js +0 -0
- /package/{design → editor/design}/editor/docs.js +0 -0
- /package/{design → editor/design}/editor/frame-handles.js +0 -0
- /package/{design → editor/design}/editor/frame-messages.js +0 -0
- /package/{design → editor/design}/editor/layers.js +0 -0
- /package/{design → editor/design}/editor/pages-panel.js +0 -0
- /package/{design → editor/design}/editor/panel-resize.js +0 -0
- /package/{design → editor/design}/editor/present.js +0 -0
- /package/{design → editor/design}/editor/toolbar.js +0 -0
- /package/{design → editor/design}/editor.js +0 -0
- /package/{design → editor/design}/float-toolbar.js +0 -0
- /package/{design → editor/design}/group-controls.js +0 -0
- /package/{design → editor/design}/host.js +0 -0
- /package/{design → editor/design}/panel-state.js +0 -0
- /package/{design → editor/design}/panel.js +0 -0
- /package/{design → editor/design}/presenter.js +0 -0
- /package/{design → editor/design}/prop-sections.js +0 -0
- /package/{design → editor/design}/selection-overlay.js +0 -0
- /package/{design → editor/design}/store.js +0 -0
- /package/{design → editor/design}/tailwind-classes.js +0 -0
- /package/{embed-frame.js → editor/embed-frame.js} +0 -0
- /package/{embed.html → editor/embed.html} +0 -0
- /package/{embed.js → editor/embed.js} +0 -0
- /package/{styles.css → editor/styles.css} +0 -0
- /package/{template.js → editor/template.js} +0 -0
- /package/{vendor → editor/vendor}/codemirror.js +0 -0
- /package/{vendor → editor/vendor}/preact-htm.js +0 -0
- /package/{vendor → editor/vendor}/prettier.js +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Swapnil Jadhav
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Third-party code included in this repository is licensed under its own terms; see THIRD_PARTY_LICENSES.md.
|
package/README.md
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
#
|
|
1
|
+
# windcraft-editor
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
npm install windcraft-editor
|
|
5
|
+
```
|
|
2
6
|
|
|
3
7
|
The Windcraft visual editor (HTML + Tailwind): canvas, layers, Properties panel, code panel and pages. It has no backend of its own: the page that mounts it gives it a **host** that loads and saves.
|
|
4
8
|
|
|
5
9
|
```js
|
|
6
|
-
import { mountEditor } from "
|
|
10
|
+
import { mountEditor } from "windcraft-editor";
|
|
7
11
|
|
|
8
12
|
await mountEditor(document.getElementById("root"), {
|
|
9
13
|
host, // saving, projects, AI and the address: see design/host.js
|
|
@@ -18,7 +22,7 @@ await mountEditor(document.getElementById("root"), {
|
|
|
18
22
|
| Run the demo | `npm run demo`, then open http://localhost:4000/editor/demo/ |
|
|
19
23
|
| Windcraft's own host | `src/public/js/app-host.js` |
|
|
20
24
|
|
|
21
|
-
The
|
|
25
|
+
The package carries the Tailwind logic inside it (`core/`) and reaches it by relative paths, so there is nothing else to map. On a plain page map `windcraft-editor` to `<where you serve the package>/editor/index.js` with an import map; a bundler does that itself (an import map, as in `demo/index.html`, or a bundler). `mountEditor` loads Tailwind's play CDN (v3) unless you pass `tailwind: false`. One editor per page; it takes over the page's size, keys and zoom.
|
|
22
26
|
|
|
23
27
|
The AI panel and "Generate" need `host.generate`; without a working one they show its error.
|
|
24
28
|
|
|
@@ -27,7 +31,7 @@ The AI panel and "Generate" need `host.generate`; without a working one they sho
|
|
|
27
31
|
`embedEditor` puts the editor in an element of your page, isolated in an iframe (its own keys, zoom and styles), so several can share a page and it fills whatever size you give it. Leave out the parts you don't need with `ui`; keep the code box and the details form in your own page.
|
|
28
32
|
|
|
29
33
|
```js
|
|
30
|
-
import { embedEditor } from "
|
|
34
|
+
import { embedEditor } from "windcraft-editor";
|
|
31
35
|
|
|
32
36
|
const ed = embedEditor(el, {
|
|
33
37
|
host, // saving, as above
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// They act through `actions`, which the editor provides:
|
|
4
4
|
// setClassesText(text) · setStyle(css | null) · setAttribute(name, value | null)
|
|
5
5
|
import { html, useState, useEffect, useRef } from "../vendor/preact-htm.js";
|
|
6
|
-
import { parseToken } from "
|
|
6
|
+
import { parseToken } from "../../core/class-groups.js";
|
|
7
7
|
import { TextInput } from "./controls.js";
|
|
8
8
|
|
|
9
9
|
/** "color: red; margin: 0" -> [["color","red"],["margin","0"]] */
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// and a colour field. Each keeps what is being typed in its own state and reports changes through callbacks; none reads the
|
|
4
4
|
// page or the editor's state. Their classes are the ones canvas.handlebars styles.
|
|
5
5
|
import { html, useState, useRef } from "../vendor/preact-htm.js";
|
|
6
|
-
import { HUES, SHADES, SPECIAL_COLORS } from "
|
|
6
|
+
import { HUES, SHADES, SPECIAL_COLORS } from "../../core/class-groups.js";
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* What a typed-in field needs: it shows `value` until it is focused, keeps what is typed in its own state (a redraw with the
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// frame's breakpoint) through useUi() and act through `actions`, which the editor provides:
|
|
4
4
|
// select(path) · move(dir) · duplicate() · remove() · setTag(tag) · setBreakpoint(bp) · setState(st) · setText(text) · setAttr(name, value)
|
|
5
5
|
import { html, useState } from "../vendor/preact-htm.js";
|
|
6
|
-
import { BREAKPOINT_WIDTH, parseToken } from "
|
|
6
|
+
import { BREAKPOINT_WIDTH, parseToken } from "../../core/class-groups.js";
|
|
7
7
|
import { TAG_KINDS, variant } from "./panel-model.js";
|
|
8
8
|
import { useUi } from "./panel-state.js";
|
|
9
9
|
import { TextInput, TextArea, SelectInput, Field } from "./controls.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parseComponentSource, buildPreviewDocument } from "../../playground/component-source.js";
|
|
2
2
|
import { host } from "../host.js";
|
|
3
|
-
import { normalizeGroup } from "
|
|
4
|
-
import { GAP_X } from "
|
|
3
|
+
import { normalizeGroup } from "../../../core/pages.js";
|
|
4
|
+
import { GAP_X } from "../../../core/board-layout.js";
|
|
5
5
|
import { DEVICES } from "../float-toolbar.js";
|
|
6
6
|
import { $, S, collapsed, data, esc, frame, model, send } from "./base.js";
|
|
7
7
|
import { MIN_H, applyView, canvas, fitTo, heightOfDoc, layout, pageGroupOf, placePills, positions, view, widthOf } from "./plane.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { panelStore, togglePalette, toggleSection } from "../panel-state.js";
|
|
2
|
-
import { BREAKPOINT_WIDTH, setGroup, getGroup, GROUPS, parseToken } from "
|
|
2
|
+
import { BREAKPOINT_WIDTH, setGroup, getGroup, GROUPS, parseToken } from "../../../core/class-groups.js";
|
|
3
3
|
import { renderPanel } from "../panel.js";
|
|
4
4
|
import { inspectorView, variant, val, srcOf, modeFor } from "../panel-model.js";
|
|
5
5
|
import { checkTags } from "../code-view.js";
|
|
6
|
-
import { groupOf, variantOf, twShown, hasScale, twValue, fromPx, tokenFor } from "
|
|
6
|
+
import { groupOf, variantOf, twShown, hasScale, twValue, fromPx, tokenFor } from "../../../core/prop-tailwind.js";
|
|
7
7
|
import { normalizeValue } from "../css-props.js";
|
|
8
8
|
import { host } from "../host.js";
|
|
9
9
|
import { $, S, data, model, send } from "./base.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computeLayout } from "
|
|
1
|
+
import { computeLayout } from "../../../core/board-layout.js";
|
|
2
2
|
import { $, DEFAULT_W, S, data, frame, send } from "./base.js";
|
|
3
3
|
import { docs, wraps } from "./designs.js";
|
|
4
4
|
import { placeFloat, renderFloat, renderFrameSel } from "./frame-handles.js";
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
// setProp · setProps · resetProp · setGeom · freePosition · align · arrange · group · ungroup · autoLayout · sizeItMyself
|
|
6
6
|
import { html, useState } from "../vendor/preact-htm.js";
|
|
7
7
|
import { srcOf, shownOf, ownsValue, styled, val, variant, modeFor, PRESETS, OPTS } from "./panel-model.js";
|
|
8
|
-
import { parseToken } from "
|
|
9
|
-
import { tokenFor } from "
|
|
8
|
+
import { parseToken } from "../../core/class-groups.js";
|
|
9
|
+
import { tokenFor } from "../../core/prop-tailwind.js";
|
|
10
10
|
import { useUi } from "./panel-state.js";
|
|
11
11
|
import { TextInput } from "./controls.js";
|
|
12
12
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// What the Properties panel draws from: the data tables behind its controls (suggestions, options, tags), small selectors
|
|
2
2
|
// that read the selection and the panel's state (panel-state.js), and inspectorView, which says what the panel shows. The
|
|
3
3
|
// components themselves are in panel.js, design-tab.js, figma-sections.js, style-sections.js, prop-sections.js and classes-section.js.
|
|
4
|
-
import { HUES, SHADES, SPECIAL_COLORS, STEPS, SIZES, MAX_W, GROUPS, getGroup, parseToken } from "
|
|
5
|
-
import { twShown } from "
|
|
4
|
+
import { HUES, SHADES, SPECIAL_COLORS, STEPS, SIZES, MAX_W, GROUPS, getGroup, parseToken } from "../../core/class-groups.js";
|
|
5
|
+
import { twShown } from "../../core/prop-tailwind.js";
|
|
6
6
|
import { panelStore } from "./panel-state.js";
|
|
7
7
|
|
|
8
8
|
const esc = (s) => String(s ?? "").replace(/[&<>"']/g, (c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" }[c]));
|
|
@@ -11,8 +11,8 @@ import { useUi } from "./panel-state.js";
|
|
|
11
11
|
import { TextInput, ColorInput } from "./controls.js";
|
|
12
12
|
import { GroupColor } from "./group-controls.js";
|
|
13
13
|
import { I, IconBtn, NumField, FSection, Sub, PropField, PropSelect, TwField, TwSelect, num, owns, has, off, comp, srcKind, srcNote, atVariant } from "./figma-sections.js";
|
|
14
|
-
import { twShown } from "
|
|
15
|
-
import { brandScale, normalizeTheme } from "
|
|
14
|
+
import { twShown } from "../../core/prop-tailwind.js";
|
|
15
|
+
import { brandScale, normalizeTheme } from "../../core/theme.js";
|
|
16
16
|
import { data } from "./editor/base.js";
|
|
17
17
|
import { PropRow } from "./prop-sections.js";
|
|
18
18
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
//
|
|
1
|
+
// windcraft-editor: the visual editor as a package.
|
|
2
2
|
//
|
|
3
|
-
// import { mountEditor } from "
|
|
3
|
+
// import { mountEditor } from "windcraft-editor";
|
|
4
4
|
// await mountEditor(document.getElementById("root"), { host, data });
|
|
5
5
|
//
|
|
6
6
|
// `host` is what the editor needs from the app around it (design/host.js lists it): saving, projects, the AI and the page address.
|
|
7
|
-
// `data` is the design to open (below). The page must
|
|
8
|
-
//
|
|
7
|
+
// `data` is the design to open (below). The page must serve this package's files and, for a plain browser page, map "windcraft-editor"
|
|
8
|
+
// to editor/index.js with an import map (a bundler does that itself). One editor per page: it takes over the page's size and keyboard.
|
|
9
9
|
import { setHost } from "./design/host.js";
|
|
10
10
|
import { config } from "./design/config.js";
|
|
11
11
|
import { editorHtml } from "./template.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "windcraft-editor",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Windcraft's visual HTML + Tailwind editor. Mount it in a page and give it a host that loads and saves designs.
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Windcraft's visual HTML + Tailwind editor. Mount it in a page and give it a host that loads and saves designs.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tailwind",
|
|
7
7
|
"tailwindcss",
|
|
@@ -23,29 +23,18 @@
|
|
|
23
23
|
"bugs": {
|
|
24
24
|
"url": "https://github.com/Tolaj/windcraft/issues"
|
|
25
25
|
},
|
|
26
|
-
"main": "index.js",
|
|
26
|
+
"main": "editor/index.js",
|
|
27
27
|
"exports": {
|
|
28
|
-
".": "./index.js",
|
|
28
|
+
".": "./editor/index.js",
|
|
29
29
|
"./*": "./*"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
|
-
"
|
|
33
|
-
"embed.js",
|
|
34
|
-
"embed.html",
|
|
35
|
-
"embed-frame.js",
|
|
36
|
-
"template.js",
|
|
37
|
-
"styles.css",
|
|
38
|
-
"design",
|
|
39
|
-
"playground",
|
|
40
|
-
"vendor",
|
|
32
|
+
"editor",
|
|
41
33
|
"core",
|
|
34
|
+
"LICENSE",
|
|
42
35
|
"README.md"
|
|
43
36
|
],
|
|
44
37
|
"publishConfig": {
|
|
45
38
|
"access": "public"
|
|
46
|
-
},
|
|
47
|
-
"scripts": {
|
|
48
|
-
"prepack": "node scripts/bundle-core.mjs",
|
|
49
|
-
"postpack": "node scripts/bundle-core.mjs clean"
|
|
50
39
|
}
|
|
51
40
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|