Skip to content

Commit 2dde63e

Browse files
committed
Initial commit
0 parents  commit 2dde63e

File tree

11 files changed

+2388
-0
lines changed

11 files changed

+2388
-0
lines changed

LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Sorcery
2+
3+
The future of AI roleplay.
4+
5+
6+
## License
7+
8+
Copyright &copy; 2025 Philipp Emanuel Weidmann (<[email protected]>)
9+
10+
This program is free software: you can redistribute it and/or modify
11+
it under the terms of the GNU Affero General Public License as published by
12+
the Free Software Foundation, either version 3 of the License, or
13+
(at your option) any later version.
14+
15+
This program is distributed in the hope that it will be useful,
16+
but WITHOUT ANY WARRANTY; without even the implied warranty of
17+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
GNU Affero General Public License for more details.
19+
20+
You should have received a copy of the GNU Affero General Public License
21+
along with this program. If not, see <https://www.gnu.org/licenses/>.
22+
23+
**By contributing to this project, you agree to release your
24+
contributions under the same license.**

common.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// SPDX-License-Identifier: AGPL-3.0-or-later
2+
// Copyright (C) 2025 Philipp Emanuel Weidmann <[email protected]>
3+
4+
export const NAME = "sorcery";

lib/code-input.css

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
/* Code-Input Compatibility */
2+
/* By WebCoder49 */
3+
/* First Published on CSS-Tricks.com */
4+
5+
6+
code-input {
7+
/* Allow other elements to be inside */
8+
display: block;
9+
overflow-y: auto;
10+
overflow-x: auto;
11+
position: relative;
12+
top: 0;
13+
left: 0;
14+
15+
/* Normal inline styles */
16+
margin: 8px;
17+
--padding: 16px;
18+
height: 250px;
19+
font-size: inherit;
20+
font-family: monospace;
21+
line-height: 1.5; /* Inherited to child elements */
22+
tab-size: 2;
23+
caret-color: darkgrey;
24+
white-space: pre;
25+
padding: 0!important; /* Use --padding to set the code-input element's padding */
26+
display: grid;
27+
grid-template-columns: 100%;
28+
grid-template-rows: 100%;
29+
}
30+
31+
32+
code-input:not(.code-input_loaded) {
33+
padding: var(--padding, 16px)!important;
34+
}
35+
36+
code-input textarea, code-input:not(.code-input_pre-element-styled) pre code, code-input.code-input_pre-element-styled pre {
37+
/* Both elements need the same text and space styling so they are directly on top of each other */
38+
margin: 0px!important;
39+
padding: var(--padding, 16px)!important;
40+
border: 0;
41+
min-width: calc(100% - var(--padding) * 2);
42+
min-height: calc(100% - var(--padding) * 2);
43+
overflow: hidden;
44+
resize: none;
45+
grid-row: 1;
46+
grid-column: 1;
47+
display: block;
48+
}
49+
50+
code-input:not(.code-input_pre-element-styled) pre code, code-input.code-input_pre-element-styled pre {
51+
height: max-content;
52+
width: max-content;
53+
}
54+
55+
code-input:not(.code-input_pre-element-styled) pre, code-input.code-input_pre-element-styled pre code {
56+
/* Remove all margin and padding from others */
57+
margin: 0px!important;
58+
padding: 0px!important;
59+
width: 100%;
60+
height: 100%;
61+
}
62+
63+
code-input textarea, code-input pre, code-input pre * {
64+
/* Also add text styles to highlighing tokens */
65+
font-size: inherit!important;
66+
font-family: inherit!important;
67+
line-height: inherit!important;
68+
tab-size: inherit!important;
69+
}
70+
71+
code-input textarea, code-input pre {
72+
/* In the same place */
73+
grid-column: 1;
74+
grid-row: 1;
75+
}
76+
77+
/* Move the textarea in front of the result */
78+
79+
code-input textarea {
80+
z-index: 1;
81+
}
82+
code-input pre {
83+
z-index: 0;
84+
}
85+
86+
/* Make textarea almost completely transparent, except for caret and placeholder */
87+
88+
code-input textarea {
89+
color: transparent;
90+
background: transparent;
91+
caret-color: inherit!important; /* Or choose your favourite color */
92+
}
93+
code-input textarea::placeholder {
94+
color: lightgrey;
95+
}
96+
97+
/* Can be scrolled */
98+
code-input textarea, code-input pre {
99+
white-space: inherit;
100+
word-spacing: normal;
101+
word-break: normal;
102+
word-wrap: normal;
103+
}
104+
105+
/* No resize on textarea; transfer outline on focus to code-input element */
106+
code-input textarea {
107+
resize: none;
108+
outline: none!important;
109+
}
110+
code-input:has(textarea:focus):not(.code-input_mouse-focused) {
111+
outline: 2px solid black;
112+
}
113+
114+
/* Before registering give a hint about how to register. */
115+
code-input:not(.code-input_registered) {
116+
overflow: hidden;
117+
display: block;
118+
box-sizing: border-box; /* Include padding in width/height */
119+
}
120+
121+
code-input:not(.code-input_registered)::after {
122+
/* Display message to register */
123+
content: "Use codeInput.registerTemplate to set up.";
124+
display: block;
125+
position: absolute;
126+
bottom: var(--padding);
127+
left: var(--padding);
128+
width: calc(100% - 2 * var(--padding));
129+
130+
border-top: 1px solid grey;
131+
outline: var(--padding) solid white;
132+
background-color: white;
133+
}
134+
135+
code-input:not(.code-input_loaded) pre, code-input:not(.code-input_loaded) textarea {
136+
opacity: 0;
137+
}
138+
139+
/* Contains dialog boxes that might appear as the result of a plugin.
140+
Sticks to the top of the code-input element */
141+
code-input .code-input_dialog-container {
142+
z-index: 2;
143+
144+
position: sticky;
145+
grid-row: 1;
146+
grid-column: 1;
147+
148+
top: 0px;
149+
left: 0;
150+
width: 100%;
151+
height: 0;
152+
153+
/* Dialog boxes' text is left-aligned */
154+
text-align: left;
155+
}
156+
/* Instructions specific to keyboard navigation set by plugins that override Tab functionality. */
157+
code-input .code-input_dialog-container .code-input_keyboard-navigation-instructions {
158+
top: 0;
159+
right: 0;
160+
display: block;
161+
position: absolute;
162+
background-color: black;
163+
color: white;
164+
padding: 2px;
165+
padding-left: 10px;
166+
text-wrap: pretty;
167+
overflow: hidden;
168+
text-overflow: ellipsis;
169+
width: calc(100% - 12px);
170+
max-height: 3em;
171+
}
172+
173+
code-input:not(:has(textarea:focus)) .code-input_dialog-container .code-input_keyboard-navigation-instructions,
174+
code-input.code-input_mouse-focused .code-input_dialog-container .code-input_keyboard-navigation-instructions,
175+
code-input .code-input_dialog-container .code-input_keyboard-navigation-instructions:empty {
176+
/* When not keyboard-focused / no instructions don't show instructions */
177+
display: none;
178+
}
179+
180+
/* Things with padding when instructions are present */
181+
code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:focus):not(.code-input_mouse-focused) textarea,
182+
code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:focus):not(.code-input_mouse-focused):not(.code-input_pre-element-styled) pre code,
183+
code-input:not(:has(.code-input_keyboard-navigation-instructions:empty)):has(textarea:focus):not(.code-input_mouse-focused).code-input_pre-element-styled pre {
184+
padding-top: calc(var(--padding) + 3em)!important;
185+
}

0 commit comments

Comments
 (0)