@arcanewizards/sigil 0.1.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.
Files changed (66) hide show
  1. package/dist/chunk-4PMRDURG.js +66 -0
  2. package/dist/chunk-5DRI7C4U.cjs +66 -0
  3. package/dist/chunk-A5LYYZER.cjs +103 -0
  4. package/dist/chunk-BIY5HAXP.js +125 -0
  5. package/dist/chunk-CAYKPJIX.cjs +10 -0
  6. package/dist/chunk-EJNNLQ2S.js +72 -0
  7. package/dist/chunk-FHXT3DAL.js +103 -0
  8. package/dist/chunk-H4U4Z4GM.js +66 -0
  9. package/dist/chunk-LSHKAVON.js +10 -0
  10. package/dist/chunk-MXDDIFIO.cjs +767 -0
  11. package/dist/chunk-PEARNJ5G.cjs +125 -0
  12. package/dist/chunk-RI33QVOD.cjs +66 -0
  13. package/dist/chunk-VZ4A6RRT.cjs +72 -0
  14. package/dist/chunk-XAK7WC3D.js +767 -0
  15. package/dist/frontend/appearance.cjs +88 -0
  16. package/dist/frontend/appearance.d.cts +11 -0
  17. package/dist/frontend/appearance.d.ts +11 -0
  18. package/dist/frontend/appearance.js +88 -0
  19. package/dist/frontend/context.cjs +16 -0
  20. package/dist/frontend/context.d.cts +32 -0
  21. package/dist/frontend/context.d.ts +32 -0
  22. package/dist/frontend/context.js +16 -0
  23. package/dist/frontend/controls/index.cjs +49 -0
  24. package/dist/frontend/controls/index.d.cts +168 -0
  25. package/dist/frontend/controls/index.d.ts +168 -0
  26. package/dist/frontend/controls/index.js +49 -0
  27. package/dist/frontend/dialogs.cjs +17 -0
  28. package/dist/frontend/dialogs.d.cts +36 -0
  29. package/dist/frontend/dialogs.d.ts +36 -0
  30. package/dist/frontend/dialogs.js +17 -0
  31. package/dist/frontend/input.cjs +8 -0
  32. package/dist/frontend/input.d.cts +33 -0
  33. package/dist/frontend/input.d.ts +33 -0
  34. package/dist/frontend/input.js +8 -0
  35. package/dist/frontend/preferences.cjs +54 -0
  36. package/dist/frontend/preferences.d.cts +14 -0
  37. package/dist/frontend/preferences.d.ts +14 -0
  38. package/dist/frontend/preferences.js +54 -0
  39. package/dist/frontend/styles/base.css +321 -0
  40. package/dist/frontend/styles/sigil.css +785 -0
  41. package/dist/frontend/styles/theme.css +625 -0
  42. package/dist/frontend/styling.cjs +18 -0
  43. package/dist/frontend/styling.d.cts +32 -0
  44. package/dist/frontend/styling.d.ts +32 -0
  45. package/dist/frontend/styling.js +18 -0
  46. package/dist/frontend/toolbars.cjs +18 -0
  47. package/dist/frontend/toolbars.d.cts +11 -0
  48. package/dist/frontend/toolbars.d.ts +11 -0
  49. package/dist/frontend/toolbars.js +18 -0
  50. package/dist/frontend/tooltip.cjs +10 -0
  51. package/dist/frontend/tooltip.d.cts +16 -0
  52. package/dist/frontend/tooltip.d.ts +16 -0
  53. package/dist/frontend/tooltip.js +10 -0
  54. package/dist/frontend.cjs +359 -0
  55. package/dist/frontend.d.cts +90 -0
  56. package/dist/frontend.d.ts +90 -0
  57. package/dist/frontend.js +359 -0
  58. package/dist/index.cjs +492 -0
  59. package/dist/index.d.cts +134 -0
  60. package/dist/index.d.ts +134 -0
  61. package/dist/index.js +492 -0
  62. package/dist/proto-B-WcMUOE.d.cts +33 -0
  63. package/dist/proto-kGDF-yWB.d.ts +33 -0
  64. package/dist/types-X8O95zmC.d.cts +23 -0
  65. package/dist/types-X8O95zmC.d.ts +23 -0
  66. package/package.json +123 -0
@@ -0,0 +1,125 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/frontend/tooltip.tsx
2
+ var _radixui = require('radix-ui');
3
+
4
+
5
+
6
+
7
+
8
+ var _react = require('react');
9
+ var _util = require('@arcanejs/toolkit-frontend/util');
10
+ var _jsxruntime = require('react/jsx-runtime');
11
+ var Content = _react.forwardRef.call(void 0, ({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
12
+ _radixui.Tooltip.Content,
13
+ {
14
+ ...props,
15
+ ref,
16
+ className: _util.cn.call(void 0,
17
+ `
18
+ relative z-sigil-tooltip rounded-sigil-control
19
+ bg-sigil-usage-hint-background px-1 py-0.5 leading-[1.5]
20
+ text-sigil-usage-hint-text shadow-sigil-box
21
+ `,
22
+ className
23
+ )
24
+ }
25
+ ));
26
+ Content.displayName = "Content";
27
+ var Arrow = _react.forwardRef.call(void 0, ({ className, ...props }, ref) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
28
+ _radixui.Tooltip.Arrow,
29
+ {
30
+ ...props,
31
+ ref,
32
+ className: _util.cn.call(void 0,
33
+ "fill-sigil-usage-hint-background drop-shadow-sigil-tooltip-arrow",
34
+ className
35
+ )
36
+ }
37
+ ));
38
+ Arrow.displayName = "Arrow";
39
+ var TooltipBoundaryContext = _react.createContext.call(void 0, null);
40
+ var TooltipBoundary = ({
41
+ children,
42
+ ...props
43
+ }) => {
44
+ const [ref, setRef] = _react.useState.call(void 0, null);
45
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
46
+ TooltipBoundaryContext.Provider,
47
+ {
48
+ value: ref ? ref : null,
49
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ref: setRef, ...props, children })
50
+ }
51
+ );
52
+ };
53
+ var TooltipWrapper = ({
54
+ tooltip,
55
+ children,
56
+ side = "top"
57
+ }) => {
58
+ const boundary = _react.useContext.call(void 0, TooltipBoundaryContext);
59
+ if (!tooltip) {
60
+ return children;
61
+ }
62
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _radixui.Tooltip.Root, { children: [
63
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _radixui.Tooltip.Trigger, { asChild: true, children }),
64
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
65
+ Content,
66
+ {
67
+ side,
68
+ align: "center",
69
+ sideOffset: 5,
70
+ alignOffset: 0,
71
+ collisionBoundary: boundary ? [boundary] : [],
72
+ collisionPadding: 10,
73
+ children: [
74
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Arrow, {}),
75
+ tooltip
76
+ ]
77
+ }
78
+ )
79
+ ] });
80
+ };
81
+ var keyboardShortcutText = (binding) => {
82
+ const parts = [];
83
+ if (_optionalChain([binding, 'access', _ => _.modifiers, 'optionalAccess', _2 => _2.ctrlOrMetaKey])) {
84
+ parts.push(navigator.platform.includes("Mac") ? "\u2318" : "Ctrl");
85
+ }
86
+ if (_optionalChain([binding, 'access', _3 => _3.modifiers, 'optionalAccess', _4 => _4.shiftKey])) {
87
+ parts.push("Shift");
88
+ }
89
+ if (binding.key === "ArrowLeft") {
90
+ parts.push("Left Arrow");
91
+ } else if (binding.key === "ArrowRight") {
92
+ parts.push("Right Arrow");
93
+ } else if (binding.key === " ") {
94
+ parts.push("Space");
95
+ } else {
96
+ parts.push(binding.key.toUpperCase());
97
+ }
98
+ return parts.join(" + ");
99
+ };
100
+ var keyboardShortcutTooltip = (label, keyboardBinding, extraBindings) => {
101
+ const bindings = [
102
+ ...keyboardBinding ? [keyboardBinding[0]] : [],
103
+ ..._nullishCoalesce(extraBindings, () => ( []))
104
+ ];
105
+ if (bindings.length === 0) {
106
+ return label;
107
+ }
108
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
109
+ label,
110
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
111
+ "kbd",
112
+ {
113
+ className: "text-[0.8rem] opacity-60",
114
+ style: { fontFamily: "sans-serif" },
115
+ children: ` (${bindings.map(keyboardShortcutText).join(" / ")})`
116
+ }
117
+ )
118
+ ] });
119
+ };
120
+
121
+
122
+
123
+
124
+
125
+ exports.TooltipBoundary = TooltipBoundary; exports.TooltipWrapper = TooltipWrapper; exports.keyboardShortcutTooltip = keyboardShortcutTooltip;
@@ -0,0 +1,66 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/frontend/input.ts
2
+ var _react = require('react');
3
+ var usePressable = (click) => {
4
+ const [touching, setTouching] = _react.useState.call(void 0, false);
5
+ return {
6
+ touching,
7
+ handlers: {
8
+ onClick: click,
9
+ onTouchStart: () => {
10
+ setTouching(true);
11
+ },
12
+ onTouchMove: () => {
13
+ setTouching(false);
14
+ },
15
+ onTouchEnd: (event) => {
16
+ if (touching) {
17
+ event.preventDefault();
18
+ setTouching(false);
19
+ click(event);
20
+ }
21
+ }
22
+ }
23
+ };
24
+ };
25
+ var useLongPressable = ({
26
+ onPress,
27
+ onRelease
28
+ }) => {
29
+ const [touching, setTouching] = _react.useState.call(void 0, false);
30
+ return _react.useMemo.call(void 0,
31
+ () => ({
32
+ touching,
33
+ handlers: {
34
+ onTouchStart: () => {
35
+ setTouching(true);
36
+ onPress();
37
+ },
38
+ onMouseDown: () => {
39
+ setTouching(true);
40
+ onPress();
41
+ },
42
+ onMouseUp: () => {
43
+ setTouching(false);
44
+ onRelease();
45
+ },
46
+ onTouchMove: () => {
47
+ setTouching(false);
48
+ onRelease();
49
+ },
50
+ onTouchEnd: (event) => {
51
+ if (touching) {
52
+ event.preventDefault();
53
+ setTouching(false);
54
+ onRelease();
55
+ }
56
+ }
57
+ }
58
+ }),
59
+ [touching, onRelease, onPress]
60
+ );
61
+ };
62
+
63
+
64
+
65
+
66
+ exports.usePressable = usePressable; exports.useLongPressable = useLongPressable;
@@ -0,0 +1,72 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/frontend/context.tsx
2
+
3
+
4
+
5
+
6
+
7
+
8
+ var _react = require('react');
9
+ var SystemInformationContext = _react.createContext.call(void 0,
10
+ new Proxy({}, {
11
+ get: () => {
12
+ throw new Error("Missing SystemInformationContext");
13
+ }
14
+ })
15
+ );
16
+ var DebuggerContext = _react.createContext.call(void 0,
17
+ new Proxy({}, {
18
+ get: () => {
19
+ throw new Error("Missing DebuggerContext");
20
+ }
21
+ })
22
+ );
23
+ var useSystemInformation = () => {
24
+ return _react.useContext.call(void 0, SystemInformationContext);
25
+ };
26
+ var useDebuggerContext = () => {
27
+ return _react.useContext.call(void 0, DebuggerContext);
28
+ };
29
+ var ChangeCommitContext = _react.createContext.call(void 0, {
30
+ commitChanges: () => {
31
+ }
32
+ });
33
+ var useChangeCommitBoundary = (dataRef, onCommit) => {
34
+ const shouldCommit = _react.useRef.call(void 0, false);
35
+ const commitTimeout = _react.useRef.call(void 0, null);
36
+ const doClearTimeout = () => {
37
+ if (commitTimeout.current) {
38
+ clearTimeout(commitTimeout.current);
39
+ commitTimeout.current = null;
40
+ }
41
+ };
42
+ const commitChanges = _react.useCallback.call(void 0, () => {
43
+ shouldCommit.current = true;
44
+ commitTimeout.current = setTimeout(() => {
45
+ onCommit();
46
+ shouldCommit.current = false;
47
+ commitTimeout.current = null;
48
+ }, 1e3);
49
+ }, [onCommit]);
50
+ _react.useEffect.call(void 0, () => {
51
+ if (shouldCommit.current) {
52
+ onCommit();
53
+ shouldCommit.current = false;
54
+ }
55
+ doClearTimeout();
56
+ return () => {
57
+ doClearTimeout();
58
+ };
59
+ }, [dataRef, onCommit]);
60
+ return {
61
+ commitChanges
62
+ };
63
+ };
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+ exports.SystemInformationContext = SystemInformationContext; exports.DebuggerContext = DebuggerContext; exports.useSystemInformation = useSystemInformation; exports.useDebuggerContext = useDebuggerContext; exports.ChangeCommitContext = ChangeCommitContext; exports.useChangeCommitBoundary = useChangeCommitBoundary;