@dannote/figma-use 0.6.0 → 0.6.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.
- package/CHANGELOG.md +34 -1
- package/README.md +34 -3
- package/SKILL.md +72 -0
- package/bin/figma-use.js +1 -4
- package/dist/cli/index.js +22348 -20440
- package/dist/proxy/index.js +25 -25
- package/package.json +7 -3
- package/packages/cli/src/render/component-set.tsx +30 -21
- package/packages/cli/src/render/components.tsx +40 -16
- package/packages/cli/src/render/index.ts +14 -14
- package/packages/cli/src/render/reconciler.ts +222 -190
- package/packages/cli/src/render/vars.ts +23 -22
- package/packages/plugin/dist/main.js +168 -55
- package/packages/plugin/dist/ui.html +23 -18
- package/packages/plugin/dist/ui.js +44 -43
|
@@ -1,61 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
(() => {
|
|
3
|
-
var __defProp = Object.defineProperty
|
|
4
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty
|
|
6
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable
|
|
7
|
-
var __defNormalProp = (obj, key, value) =>
|
|
1
|
+
'use strict'
|
|
2
|
+
;(() => {
|
|
3
|
+
var __defProp = Object.defineProperty
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable
|
|
7
|
+
var __defNormalProp = (obj, key, value) =>
|
|
8
|
+
key in obj
|
|
9
|
+
? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value })
|
|
10
|
+
: (obj[key] = value)
|
|
8
11
|
var __spreadValues = (a, b) => {
|
|
9
12
|
for (var prop in b || (b = {}))
|
|
10
|
-
if (__hasOwnProp.call(b, prop))
|
|
11
|
-
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop])
|
|
12
14
|
if (__getOwnPropSymbols)
|
|
13
15
|
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
-
if (__propIsEnum.call(b, prop))
|
|
15
|
-
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop])
|
|
16
17
|
}
|
|
17
|
-
return a
|
|
18
|
-
}
|
|
18
|
+
return a
|
|
19
|
+
}
|
|
19
20
|
|
|
20
21
|
// src/ui.ts
|
|
21
|
-
var PROXY_URL =
|
|
22
|
-
console.log(
|
|
23
|
-
var ws = null
|
|
24
|
-
var statusEl = null
|
|
22
|
+
var PROXY_URL = 'ws://localhost:38451/plugin'
|
|
23
|
+
console.log('[Figma Bridge] UI loaded at', /* @__PURE__ */ new Date().toISOString())
|
|
24
|
+
var ws = null
|
|
25
|
+
var statusEl = null
|
|
25
26
|
function connect() {
|
|
26
|
-
console.log(
|
|
27
|
-
ws = new WebSocket(PROXY_URL)
|
|
27
|
+
console.log('[Figma Bridge] Connecting to', PROXY_URL)
|
|
28
|
+
ws = new WebSocket(PROXY_URL)
|
|
28
29
|
ws.onopen = () => {
|
|
29
|
-
console.log(
|
|
30
|
-
updateStatus(true)
|
|
31
|
-
}
|
|
30
|
+
console.log('[Figma Bridge] WebSocket connected!')
|
|
31
|
+
updateStatus(true)
|
|
32
|
+
}
|
|
32
33
|
ws.onclose = (e) => {
|
|
33
|
-
console.log(
|
|
34
|
-
updateStatus(false)
|
|
35
|
-
setTimeout(connect, 2e3)
|
|
36
|
-
}
|
|
34
|
+
console.log('[Figma Bridge] WebSocket closed:', e.code, e.reason)
|
|
35
|
+
updateStatus(false)
|
|
36
|
+
setTimeout(connect, 2e3)
|
|
37
|
+
}
|
|
37
38
|
ws.onerror = (e) => {
|
|
38
|
-
console.error(
|
|
39
|
-
ws == null ? void 0 : ws.close()
|
|
40
|
-
}
|
|
39
|
+
console.error('[Figma Bridge] WebSocket error:', e)
|
|
40
|
+
ws == null ? void 0 : ws.close()
|
|
41
|
+
}
|
|
41
42
|
ws.onmessage = (event) => {
|
|
42
|
-
const data = JSON.parse(event.data)
|
|
43
|
-
parent.postMessage({ pluginMessage: __spreadValues({ type:
|
|
44
|
-
}
|
|
43
|
+
const data = JSON.parse(event.data)
|
|
44
|
+
parent.postMessage({ pluginMessage: __spreadValues({ type: 'command' }, data) }, '*')
|
|
45
|
+
}
|
|
45
46
|
}
|
|
46
47
|
window.onmessage = (event) => {
|
|
47
|
-
const msg = event.data.pluginMessage
|
|
48
|
-
if (msg.type !==
|
|
49
|
-
ws.send(JSON.stringify({ id: msg.id, result: msg.result, error: msg.error }))
|
|
50
|
-
}
|
|
48
|
+
const msg = event.data.pluginMessage
|
|
49
|
+
if (msg.type !== 'result' || !ws) return
|
|
50
|
+
ws.send(JSON.stringify({ id: msg.id, result: msg.result, error: msg.error }))
|
|
51
|
+
}
|
|
51
52
|
function updateStatus(connected) {
|
|
52
53
|
if (statusEl) {
|
|
53
|
-
statusEl.textContent = connected ?
|
|
54
|
-
statusEl.style.color = connected ?
|
|
54
|
+
statusEl.textContent = connected ? '\u2713 Connected' : '\u25CB Connecting...'
|
|
55
|
+
statusEl.style.color = connected ? '#0a0' : '#999'
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
|
-
document.addEventListener(
|
|
58
|
-
statusEl = document.getElementById(
|
|
59
|
-
connect()
|
|
60
|
-
})
|
|
61
|
-
})()
|
|
58
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
59
|
+
statusEl = document.getElementById('status')
|
|
60
|
+
connect()
|
|
61
|
+
})
|
|
62
|
+
})()
|