Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
375 commits
Select commit Hold shift + click to select a range
cd968ae
Fixed focus rendering in menus.
amyjko Dec 24, 2025
529c584
Fixed conditional suggestion on boolean literal.
amyjko Dec 24, 2025
7c6f174
Block suggests in scope definitions.
amyjko Dec 24, 2025
5bbcf68
Fixed completion.
amyjko Dec 24, 2025
07608f1
Suggest units correctly.
amyjko Dec 24, 2025
fc03be5
Categorized menu by concepts, and node purpose as a fallback.
amyjko Dec 24, 2025
f6dbe46
Added missing literals to blank block suggestions.
amyjko Dec 24, 2025
a80af88
Properly filter hidden.
amyjko Dec 24, 2025
483d8a5
Fixed autocomplete appends.
amyjko Dec 24, 2025
ea73f16
Fixed expected type of list literal values.
amyjko Dec 24, 2025
bc65403
Renamed Binds purpose to Definitions.
amyjko Dec 24, 2025
5c99381
Match style of menu items.
amyjko Dec 24, 2025
4ccc2c3
Remove duplicate removals.
amyjko Dec 24, 2025
1d6707d
Don't allow removals in Replace or Assign, to avoid duplicates.
amyjko Dec 24, 2025
baebdc4
Include definitions declared in block in revisions.
amyjko Dec 24, 2025
9bcad13
Added test for block bind insertions.
amyjko Dec 24, 2025
f80bf53
Fixed filering of possible nodes on appends.
amyjko Dec 24, 2025
1693330
Suggest additional name insertion.
amyjko Dec 24, 2025
42c65b4
Fixed unit subclass to avoid including in type suggestions.
amyjko Dec 24, 2025
a7a7c46
Default name for function insertions.
amyjko Dec 24, 2025
074854d
Better name for getPossibleInsertions.
amyjko Dec 24, 2025
b93cb9c
Differentiated bind insertions based on context.
amyjko Dec 24, 2025
cc3f542
Label for function output type.
amyjko Dec 24, 2025
62aa899
Hide unhelpful menu triggers.
amyjko Dec 24, 2025
e43ea7a
Hide colon of map type view.
amyjko Dec 24, 2025
9d4c71f
Hide Mention from menu suggestions.
amyjko Dec 24, 2025
43900fb
Added field labels to node selections.
amyjko Dec 24, 2025
b9f48ac
Better empty menu feedback.
amyjko Dec 24, 2025
8b61a92
Fixed binary operator autocompletion in references.
amyjko Dec 24, 2025
1b2d5d6
Fixed operator colors.
amyjko Dec 24, 2025
4934b17
No minimum size on menu.
amyjko Dec 24, 2025
c95a320
Flow block differently dependenting on number of statements.
amyjko Dec 24, 2025
6fd7604
Fixed baseline layout of flow.
amyjko Dec 24, 2025
f9d8bd0
Better handling of actual types in function matching for binary evalu…
amyjko Dec 24, 2025
12811d9
Fixed unary operator revisions.
amyjko Dec 24, 2025
9575947
Give border to translations, to clarify language triggers.
amyjko Dec 24, 2025
dcac9c3
Don't give type style to Unit.
amyjko Dec 24, 2025
f9d7a4f
Filter revisions that would cause new conflicts.
amyjko Dec 24, 2025
82fd3a5
Added selection feedback and hover selection on menu.
amyjko Dec 24, 2025
8ef2b72
Cleaned up conflict comparison.
amyjko Dec 24, 2025
575337a
Internal spacing in BinaryEvaluate.
amyjko Dec 25, 2025
6c89e63
Better distinguished colors for minor warnings.
amyjko Dec 25, 2025
dead5f7
Better source tile toggle layout.
amyjko Dec 25, 2025
e2d41e9
Don't show menu trigger for non-root blocks.
amyjko Dec 25, 2025
fb8cb74
Hide type placeholder in read only code.
amyjko Dec 25, 2025
53d4231
Blocks should be block layout if docs.
amyjko Dec 25, 2025
b11e1a8
Better column list append trigger layout.
amyjko Dec 26, 2025
91867af
Include text in docs insertions.
amyjko Dec 26, 2025
5d164c7
Fixed list and set unwrapping.
amyjko Dec 26, 2025
5cddb4a
Better feedback on invalid delete.
amyjko Dec 26, 2025
509846e
Handle feedback.
amyjko Dec 26, 2025
860fe2b
Mirror only child selection behavior of text editing in blocks.
amyjko Dec 26, 2025
f1f02b3
Hide list literal type behavior.
amyjko Dec 26, 2025
fefc275
Root blocks can be empty, but others can't.
amyjko Dec 26, 2025
da582d1
Proper filtering of composite nodes in block mode caret positions.
amyjko Dec 26, 2025
fe35023
Fixed border radius of last menu item.
amyjko Dec 26, 2025
c68cc35
Better menu hover feedback.
amyjko Dec 26, 2025
1a16990
Reset ignored feedback when placing caret with pointer.
amyjko Dec 26, 2025
78f6da4
Fixed caret location of placeholders.
amyjko Dec 26, 2025
46e2f13
Removed docs from programs. Redundant with block docs.
amyjko Dec 26, 2025
9f40a9d
Fixed type error.
amyjko Dec 26, 2025
1007831
Comment fixes.
amyjko Dec 26, 2025
7c3e78b
Eliminate Map instance in Unit to save memory.
amyjko Dec 27, 2025
879a975
Don't parse with Empty unit.
amyjko Dec 27, 2025
a921d50
Removed log.
amyjko Dec 27, 2025
b8f953f
Style conversions like other evaluate expressions.
amyjko Dec 27, 2025
ca48fc4
Finished comment.
amyjko Dec 27, 2025
1d9d645
Recommend documented expressions.
amyjko Dec 27, 2025
7b95268
Removed log.
amyjko Dec 27, 2025
1543e35
More menu hover improvements.
amyjko Dec 27, 2025
7a9138a
Restore types on placeholders, but make read only.
amyjko Dec 27, 2025
b56d151
Fixed parser ambiguity.
amyjko Dec 27, 2025
5dc7fde
Improved placeholder selection consistency in blocks mode.
amyjko Dec 27, 2025
a91ff1b
Fixed out of bounds input getType on Evaluate.
amyjko Dec 27, 2025
2e9e40f
Don't show Evaluate.inputs trigger if function has no inputs.
amyjko Dec 27, 2025
d26e31e
Fixed variable length type error.
amyjko Dec 27, 2025
23d76a2
Fixed variable length input recommendations.
amyjko Dec 27, 2025
e5c93c5
Slightly improved typed placeholder UX.
amyjko Dec 27, 2025
c7ecf81
Clearer names for caret moves.
amyjko Dec 27, 2025
c477efc
Permit space insertion.
amyjko Dec 27, 2025
26dc5c6
Cleaner text token editing.
amyjko Dec 27, 2025
d7a62df
Put removals last.
amyjko Dec 27, 2025
0476c0b
Fix reference autocomplete and literal types.
amyjko Dec 27, 2025
e1201da
Smaller removal previews.
amyjko Dec 27, 2025
4a7ef2a
Fixed block token rendering defect.
amyjko Dec 27, 2025
a6e5fcb
NodeSequence elision for blocks mode.
amyjko Dec 27, 2025
9cf4b84
Type check list insertions.
amyjko Dec 27, 2025
d6eddcc
Better block first caret position on empty program.
amyjko Dec 27, 2025
779d853
Allow insertions of newlines but do not render them.
amyjko Dec 27, 2025
d22f58b
Changed layout of block space.
amyjko Dec 27, 2025
1fa8eca
Easier block insertion in blocks mode.
amyjko Dec 27, 2025
1db2a61
Fix unwrap block.
amyjko Dec 27, 2025
7d09bb7
Fixed borrow view.
amyjko Dec 27, 2025
0c13c66
Fixed ConversionType autocomplete.
amyjko Dec 27, 2025
8004a85
Autocomplete conversions.
amyjko Dec 27, 2025
dae606e
Fixed invalid removal.
amyjko Dec 27, 2025
12504e3
More flexible dimension suggestions with denominators.
amyjko Dec 27, 2025
46904ca
PII is minor.
amyjko Dec 27, 2025
a72decc
Catch negative index in type inference.
amyjko Dec 27, 2025
a70689d
Consistent compound literal behavior.
amyjko Dec 27, 2025
5c0a769
Consistent underlining of editable text tokens.
amyjko Dec 27, 2025
463449b
Don't allow parents to be inserted into children.
amyjko Dec 27, 2025
fcbb0de
Fixed Replace equality change.
amyjko Dec 28, 2025
e02f877
Added Changed replacements.
amyjko Dec 28, 2025
3ce3b31
Fixed Changed conflict analysis.
amyjko Dec 28, 2025
9cacaa2
Show editor mode labels.
amyjko Dec 28, 2025
270651f
More precise wrap on paste.
amyjko Dec 28, 2025
f7a7b31
Designed StructureDefinitionView.
amyjko Dec 28, 2025
1075d73
Suggests for StructureDefinitions.
amyjko Dec 28, 2025
5dcc137
Allow empty Docs.
amyjko Dec 28, 2025
5103d6e
Designed PreviousView.
amyjko Dec 28, 2025
775c3f0
Allow caret placement in blocks mode.
amyjko Dec 28, 2025
856d1c2
Shorter documentation name.
amyjko Dec 28, 2025
041b0aa
Drop onto empty fields.
amyjko Dec 28, 2025
80061bc
Always have docs in a bind.
amyjko Dec 28, 2025
3fa929b
Always have empty Docs to avoid need to set.
amyjko Dec 28, 2025
853777d
Fixed caret placement in blocks mode.
amyjko Dec 28, 2025
b0bac1e
Don't blink caret after placing for a bit.
amyjko Dec 28, 2025
83df947
Better mode chooser symbols.
amyjko Dec 28, 2025
c9b465b
Fixed untyped placeholder expressions' type.
amyjko Dec 28, 2025
9490abb
Improved parsing of StructureDefinitions.
amyjko Dec 28, 2025
ef262df
Suggest source names in borrows.
amyjko Dec 28, 2025
c126ad5
Narrowed scope of source suggestions.
amyjko Dec 28, 2025
0a0af22
Fixed typed stream suggestions.
amyjko Dec 28, 2025
7c25df7
Fixed type error.
amyjko Dec 28, 2025
3a1b3a0
Translated labels.
amyjko Dec 28, 2025
373a466
Suggest NameTypes in scope.
amyjko Dec 28, 2025
08650d0
Suggest references to streams.
amyjko Dec 28, 2025
9777c92
Don't include names in references as block editable.
amyjko Dec 28, 2025
c5dc480
Fixed block docs layout.
amyjko Dec 28, 2025
33c2eff
Suggest range for Previous.
amyjko Dec 28, 2025
1e45f5e
Improved input streams label.
amyjko Dec 28, 2025
f18570f
Don't permit selection ranges in blocks mode.
amyjko Dec 28, 2025
fd0ac94
Improved markup editing experience.
amyjko Dec 29, 2025
c0e6125
Allow for persistent replace menus.
amyjko Dec 29, 2025
fa7b78e
Generate evaluate templates when auto-completing.
amyjko Dec 29, 2025
e9a8625
Only respond to primary button.
amyjko Dec 29, 2025
16e153c
Better styling of streams and structures on tokens.
amyjko Dec 29, 2025
c183292
Click on empty fields to place caret.
amyjko Dec 29, 2025
bb3efd8
Wrap long lists on request.
amyjko Dec 29, 2025
4e28058
Extracted pointer utility functions.
amyjko Dec 29, 2025
cd786a1
Drop on window blur.
amyjko Dec 29, 2025
9a91962
Supported list insertion feedback on wrapped inline lists.
amyjko Dec 29, 2025
3a9cffa
Compute locaation of caret after window resize.
amyjko Dec 29, 2025
66b03c1
Preferred space for blocks.
amyjko Dec 29, 2025
3602f97
Tighter padding for lists.
amyjko Dec 29, 2025
18aa9eb
Organized editing source files.
amyjko Dec 29, 2025
db0f1e2
Fixed some spacing issues.
amyjko Dec 29, 2025
030e6b0
Dedicated folder for caret functionality.
amyjko Dec 29, 2025
1bcd250
Better name for possible edits functionality.
amyjko Dec 29, 2025
df6327e
Organized autocomplete on insert.
amyjko Dec 29, 2025
d8aa626
Rid of unused state.
amyjko Dec 29, 2025
bb8f557
Smarter convert completion.
amyjko Dec 29, 2025
e7da79f
Removed flaky arrow completion.
amyjko Dec 29, 2025
cf00461
Complete Is nodes.
amyjko Dec 29, 2025
2f91408
Complete list, set, and map accesses.
amyjko Dec 29, 2025
03735f2
Removed gap in flow.
amyjko Dec 29, 2025
8292251
Some trigger spacing.
amyjko Dec 29, 2025
e91ba1d
Proper filtering of expressions.
amyjko Dec 29, 2025
c0d43c4
Complete web link.
amyjko Dec 29, 2025
8451940
Reuse in markup insertion.
amyjko Dec 29, 2025
be1849f
More permissive URL tokenizing, to allow for editing.
amyjko Dec 29, 2025
0560cbd
Consistent link styling.
amyjko Dec 29, 2025
c2fd61f
Fixed tests.
amyjko Dec 29, 2025
d313145
Fixed example layout.
amyjko Dec 29, 2025
57377f5
Cleaned up possible edits on property reference.
amyjko Dec 29, 2025
1befede
Add a bit of padding to the caret description.
amyjko Dec 29, 2025
3628a7a
Always show all conflicts.
amyjko Dec 29, 2025
78b62e3
Better NameType organization.
amyjko Dec 29, 2025
064fd57
Better evaluation complete.
amyjko Dec 29, 2025
b7e919b
More precise default values for templates.
amyjko Dec 29, 2025
d176c64
Cleaned up reference completion.
amyjko Dec 29, 2025
89b47bd
Fixed order of basis equals in menus.
amyjko Dec 30, 2025
61343d9
Fixed space in guide and menus.
amyjko Dec 30, 2025
23a2519
Removed logs.
amyjko Dec 30, 2025
5986233
Increase timeout for long test.
amyjko Dec 30, 2025
8b80231
Only update index once per project edit.
amyjko Dec 30, 2025
87ea911
Only recreate index page on idle.
amyjko Dec 30, 2025
ecc54a5
Longer idle.
amyjko Dec 30, 2025
bc891cd
Fixed conflict update timing.
amyjko Dec 30, 2025
50cde51
Unit aware operator completion.
amyjko Dec 30, 2025
8ecb2d5
Complete function inputs.
amyjko Dec 30, 2025
23eed96
Remove log.
amyjko Dec 30, 2025
2bd693a
Fixed function evaluate templates.
amyjko Dec 30, 2025
273c81e
Better placement of append in block list.
amyjko Dec 31, 2025
df7dc02
Restored missing append.
amyjko Dec 31, 2025
b730fcd
Fixed invalid grammar on FunctionDefinition.
amyjko Dec 31, 2025
3b28e23
Improved UnknownInput conflict message.
amyjko Dec 31, 2025
58c428c
Wow, even longer running for WhatWord?
amyjko Dec 31, 2025
c019e71
Don't Is placeholders.
amyjko Dec 31, 2025
48643c9
Fixed grammar issue in Is.
amyjko Dec 31, 2025
ed892d0
More precise binary operator wrap.
amyjko Dec 31, 2025
3001f68
Even more precise binary eval completion.
amyjko Dec 31, 2025
c8a77a2
Select all on text editable block tokens.
amyjko Dec 31, 2025
22249bb
Don't construct translations with empty words.
amyjko Dec 31, 2025
c96a213
Include edge of text editable block node in select all.
amyjko Dec 31, 2025
d9020af
Clone the type to avoid duplicates.
amyjko Dec 31, 2025
da993bf
Rid of redundant type operator to enable reparsing.
amyjko Dec 31, 2025
a1328aa
Allow completion of is operators on placeholders.
amyjko Dec 31, 2025
a601d68
Properly complete typed placeholders.
amyjko Dec 31, 2025
4ac6755
Only select whole placeholders in blocks mode.
amyjko Dec 31, 2025
bff9f0d
Check conflicts on autocomplete as well.
amyjko Dec 31, 2025
f2dcae8
Preserve units when typing over number placeholder.
amyjko Dec 31, 2025
2b54697
Fixed how to loading.
amyjko Jan 3, 2026
d9bb8f8
Consistent header and explanation for project concepts.
amyjko Jan 3, 2026
6771a8c
Improved stability and usability of block drag insertion feedback in …
amyjko Jan 3, 2026
665598f
Permit type errors on drags.
amyjko Jan 3, 2026
cf9fa20
More robust drag test.
amyjko Jan 3, 2026
2c4ec84
Conditionally wrap inline node sequences.
amyjko Jan 3, 2026
8ddc3ed
Better dragging of Program blocks onto Program blocks.
amyjko Jan 3, 2026
b6712b6
Permit typing type errors and unknown names.
amyjko Jan 3, 2026
318264e
More uniform selection of single-leaf parents.
amyjko Jan 3, 2026
6f131e7
Also handle only children in select all.
amyjko Jan 3, 2026
006ddfa
More precise expected stream conflict on reactions.
amyjko Jan 3, 2026
fc0f6ec
Delete dependent fields when deleting a node.
amyjko Jan 3, 2026
161a47c
Fixed annotation colors on collapse.
amyjko Jan 3, 2026
bb7aeeb
Removed confusing color differentiation of errors.
amyjko Jan 3, 2026
c31adb4
Prevent wrap on tile controls.
amyjko Jan 3, 2026
321f766
Suggest streams on stream placeholders.
amyjko Jan 3, 2026
9b3f2fd
Suggest unary alternatives of unary/binary functions.
amyjko Jan 3, 2026
68fbff4
Don't suggest Random on number.
amyjko Jan 3, 2026
43c5e7d
Pass units along in suggestions.
amyjko Jan 3, 2026
37b30f4
Only suggest functions on placeholders.
amyjko Jan 3, 2026
714855b
Fixed preceding space of list items.
amyjko Jan 3, 2026
c69a2a1
Improved reference appearance.
amyjko Jan 3, 2026
6454691
Improved rendering in selection in blocks mode.
amyjko Jan 3, 2026
0c6bb2c
Improved rendering of how to in blocks mode.
amyjko Jan 3, 2026
67c6b4f
Fixed space position of caret in blocks mode.
amyjko Jan 3, 2026
1ff7287
More liberal binary evaluate completion.
amyjko Jan 3, 2026
e0403c3
Fixed block space caret position.
amyjko Jan 4, 2026
33329c4
Better end token position.
amyjko Jan 4, 2026
e73a883
Handle out of bounds submenu.
amyjko Jan 4, 2026
9e494eb
Removed logs.
amyjko Jan 4, 2026
6b4817a
Removed more logs.
amyjko Jan 4, 2026
7c19e19
Fixed slow guide.
amyjko Jan 4, 2026
e4f0624
Layout program view better.
amyjko Jan 4, 2026
8d5829f
Wrap binds.
amyjko Jan 4, 2026
34d17b2
Don't create context.
amyjko Jan 4, 2026
92f077d
Reduce creation of new contexts.
amyjko Jan 4, 2026
7a037c9
Fixed binary completion.
amyjko Jan 4, 2026
0f087cd
Fixed typo in complete logic.
amyjko Jan 4, 2026
011163b
Fixed description of test.
amyjko Jan 4, 2026
5541d97
Don't show empty region.
amyjko Jan 4, 2026
98c3efd
Fixed caching of types in Context.
amyjko Jan 4, 2026
a40db96
Fixed save feedback.
amyjko Jan 4, 2026
635fe7a
Longer keyboard idle.
amyjko Jan 4, 2026
0b17569
More consistent hover feedback.
amyjko Jan 4, 2026
62deaed
More highlight consistency.
amyjko Jan 4, 2026
ca3e110
Fixed caret placement.
amyjko Jan 4, 2026
083b40b
Fixed bug in delete note.
amyjko Jan 4, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PUBLIC_CONTEXT = local
PUBLIC_FIREBASE_API_KEY = myfakeapikeymyfakeapikeymyfakeapikeymyf
PUBLIC_FIREBASE_AUTH_DOMAIN = wordplay-dev.firebaseapp.com
PUBLIC_FIREBASE_PROJECT_ID = demo
PUBLIC_FIREBASE_PROJECT_ID = demo-wordplay
PUBLIC_FIREBASE_MESSAGING_SENDER_ID = 123456789123
PUBLIC_FIREBASE_APP_ID = 1:123456789123:web:1234567890123456789012
PUBLIC_FIREBASE_MEASUREMENT_ID = G-FAKEFAKEFA
169 changes: 83 additions & 86 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,19 @@ const db = getFirestore();

type UserMatch = { uid: string; email: string | null; name: string | null };

// Permit local testing and calls from our two domains.
const cors = {
cors: [
'/firebase\.com$/',
'/127.0.0.1*/',
'http://localhost:5173',
'https://test.wordplay.dev',
'https://wordplay.dev',
],
};

export const getCreators = onCall<UserIdentifier[]>(
cors,
async (request): Promise<UserMatch[]> => {
const users = await admin.auth().getUsers(request.data);
const matches: UserMatch[] = [];
Expand All @@ -42,7 +54,7 @@ export const getCreators = onCall<UserIdentifier[]>(
export const emailExists = onCall<
EmailExistsInputs,
Promise<EmailExistsOutput>
>(async (request) => {
>(cors, async (request) => {
const emails = request.data;
return admin
.auth()
Expand Down Expand Up @@ -70,100 +82,85 @@ export const getTranslations = onCall<{
from: string;
to: string;
text: string[];
}>(
// Permit local testing and calls from our two domains.
{
cors: [
'/firebase\.com$/',
'/127.0.0.1*/',
'/localhost*/',
'https://test.wordplay.dev',
'https://wordplay.dev',
],
},
async (request): Promise<string[] | null> => {
const from = request.data.from;
const to = request.data.to;
const text = request.data.text;
}>(cors, async (request): Promise<string[] | null> => {
const from = request.data.from;
const to = request.data.to;
const text = request.data.text;

try {
// Creates a Google Translate client
const translator = new Translate.v2.Translate();
try {
// Creates a Google Translate client
const translator = new Translate.v2.Translate();

const [translations] = await translator.translate(text, {
from,
to,
});
const [translations] = await translator.translate(text, {
from,
to,
});

return translations;
} catch (e) {
console.error(e);
return null;
}
},
);
return translations;
} catch (e) {
console.error(e);
return null;
}
});

/** Given a URL that should refer to an HTML document, sends a GET request to the URL to try to get the document's text. */
export const getWebpage = onRequest(
{ cors: true },
async (request, response) => {
const url: string | undefined =
'url' in request.query && typeof request.query.url === 'string'
? decodeURI(request.query['url'])
: undefined;

const lib =
url === undefined
? undefined
: url.startsWith('https://')
? https
: http;

// Cache the response for 10 minutes to minimize requests.
response.set('Cache-Control', 'public, max-age=600, s-maxage=600');

if (lib === undefined || url === undefined) {
console.log('Invalid URL ' + url);
response.json('invalid-url');
} else {
const result: string = await new Promise((resolve) => {
lib.get(url, (resp) => {
const contentType = resp.headers['content-type'];
if (resp.statusCode !== 200) {
console.error(`GET status: Code: ${resp.statusCode}`);
resolve('not-available');
} else if (!contentType?.startsWith('text/html')) {
console.error(`GET received ${contentType}`);
resolve('not-html');
}

// Get the data
let data = '';

// A chunk of data has been recieved.
resp.on('data', (chunk) => {
data += chunk;
});

// The whole response has been received. Print out the result.
resp.on('end', () => {
console.log('GET success');
resolve(data);
});
}).on('error', (err) => {
console.error('GET error: ' + err.message);
export const getWebpage = onRequest(cors, async (request, response) => {
const url: string | undefined =
'url' in request.query && typeof request.query.url === 'string'
? decodeURI(request.query['url'])
: undefined;

const lib =
url === undefined
? undefined
: url.startsWith('https://')
? https
: http;

// Cache the response for 10 minutes to minimize requests.
response.set('Cache-Control', 'public, max-age=600, s-maxage=600');

if (lib === undefined || url === undefined) {
console.log('Invalid URL ' + url);
response.json('invalid-url');
} else {
const result: string = await new Promise((resolve) => {
lib.get(url, (resp) => {
const contentType = resp.headers['content-type'];
if (resp.statusCode !== 200) {
console.error(`GET status: Code: ${resp.statusCode}`);
resolve('not-available');
} else if (!contentType?.startsWith('text/html')) {
console.error(`GET received ${contentType}`);
resolve('not-html');
}

// Get the data
let data = '';

// A chunk of data has been recieved.
resp.on('data', (chunk) => {
data += chunk;
});

// The whole response has been received. Print out the result.
resp.on('end', () => {
console.log('GET success');
resolve(data);
});
}).on('error', (err) => {
console.error('GET error: ' + err.message);
resolve('not-available');
});
});

// Set the content length header.
response.set('Content-Length', `${new Blob([result]).size}`);
// Set the content length header.
response.set('Content-Length', `${new Blob([result]).size}`);

// Send the HTML back as JSON-encoded text.
response.json(result);
}
},
);
// Send the HTML back as JSON-encoded text.
response.json(result);
}
});

const PurgeDayDelay = 30;
const MillisecondsPerDay = 24 * 60 * 60 * 1000;
Expand Down Expand Up @@ -202,7 +199,7 @@ export const purgeArchivedProjects = onSchedule(
export const createClass = onCall<
CreateClassInputs,
Promise<CreateClassOutput>
>(async (request) => {
>(cors, async (request) => {
const auth = admin.auth();
const { teacher, name, description, students, existing } = request.data;

Expand Down
59 changes: 50 additions & 9 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,17 +303,34 @@

:root {
--color-blue: #648fff;
--color-blue-transparent: color-mix(
in srgb,
var(--color-blue) 10%,
transparent
);
--color-purple: #785ef0;
--color-purple-transparent: color-mix(
in srgb,
var(--color-purple) 10%,
transparent
);
--color-pink: #dc267f;
--color-light-pink: #f7d3e4;
--color-pink-transparent: color-mix(
in srgb,
var(--color-pink) 2%,
transparent
);
--color-orange: #fe6100;
--color-yellow: #ffb000;
--color-yellow-transparent: #ffae004b;
--color-white: #ffffff;
--color-black: #000000;
--color-light-grey: #9f9f9f;
--color-light-grey-transparent: #9f9f9f36;
--color-very-light-grey: #f3f3f3;
--color-dark-grey: #303030;
--color-shadow: rgb(0, 0, 0, 0.2);
--color-shadow-transparent: rgb(0, 0, 0, 0.05);

/* Colors */
--wordplay-foreground: var(--color-black);
Expand All @@ -324,7 +341,7 @@
--wordplay-evaluation-color: var(--color-pink);
--wordplay-highlight-color: var(--color-yellow);
--wordplay-focus-color: var(--color-blue);
--wordplay-hover: #feebc3;
--wordplay-hover: var(--color-yellow-transparent);
--wordplay-error: var(--color-orange);
--wordplay-warning: var(--color-yellow);
--wordplay-inactive-color: var(--color-light-grey);
Expand All @@ -346,12 +363,13 @@
--wordplay-editor-indent: 3em;
--wordplay-editor-radius: 3px;
--wordplay-spacing: 0.5em;
--wordplay-spacing-half: 0.25em;
--wordplay-font-weight: 400;
--wordplay-font-size: 12pt;
--wordplay-small-font-size: 10pt;
--wordplay-border-width: 1px;
--wordplay-focus-width: 4px;
--wordplay-border-radius: 5px;
--wordplay-border-radius: 8px;
--wordplay-code-line-height: 1.6;
--wordplay-palette-min-width: 5em;
--wordplay-palette-max-width: 15em;
Expand All @@ -368,15 +386,17 @@
--color-purple: #5b3ce6;
--color-purple-transparent: #261862;
--color-pink: #ee68a9;
--color-light-pink: rgb(77, 15, 45);
--color-pink-transparent: rgb(77, 15, 45);
--color-orange: #993800;
--color-yellow: #d69600;
--color-yellow: #b67c00;
--color-yellow-transparent: #b67c004b;
--color-white: #ffffff;
--color-black: #000000;
--color-light-grey: #b4b4b4;
--color-very-light-grey: #373636;
--color-dark-grey: #eaeaea;
--color-shadow: rgb(32, 32, 32, 0.2);
--color-shadow: rgba(227, 227, 227, 0.8);
--color-shadow-transparent: rgba(227, 227, 227, 0.95);

--wordplay-foreground: var(--color-white);
--wordplay-background: var(--color-black);
Expand All @@ -386,7 +406,7 @@
--wordplay-evaluation-color: var(--color-pink);
--wordplay-highlight-color: var(--color-yellow);
--wordplay-focus-color: var(--color-blue);
--wordplay-hover: #463000;
--wordplay-hover: var(--color-yellow-transparent);
--wordplay-error: var(--color-orange);
--wordplay-warning: var(--color-yellow);
--wordplay-inactive-color: var(--color-light-grey);
Expand Down Expand Up @@ -486,15 +506,15 @@

@keyframes pulse {
0% {
stroke-width: calc(var(--wordplay-border-width) * 2);
stroke-width: var(--wordplay-focus-width);
}

70% {
stroke-width: var(--wordplay-border-width);
}

100% {
stroke-width: calc(var(--wordplay-border-width) * 2);
stroke-width: var(--wordplay-focus-width);
}
}

Expand Down Expand Up @@ -653,6 +673,27 @@
border-bottom: var(--wordplay-border-width) solid
var(--wordplay-border-color);
}

a {
color: var(--wordplay-highlight-color);
text-decoration: none;
/* In case a parent disables pointer events, we need to enable them here. */
pointer-events: auto;
}

/* Links in paragraphs should have underlines for visibility. */
p > a {
text-decoration: calc(var(--wordplay-focus-width) / 2) underline
var(--wordplay-highlight-color);
}

a:focus,
a:hover {
outline: none;
text-decoration: underline;
text-decoration-thickness: var(--wordplay-focus-width);
text-decoration-color: var(--wordplay-focus-color);
}
</style>

%sveltekit.head%
Expand Down
3 changes: 1 addition & 2 deletions src/basis/Basis.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import Templates from '@concepts/Templates';
import UnusedBind from '@conflicts/UnusedBind';
import DefaultLocales from '@locale/DefaultLocales';
import Context from '@nodes/Context';
import type Node from '@nodes/Node';
import Source from '@nodes/Source';
import UnparsableExpression from '@nodes/UnparsableExpression';
Expand All @@ -16,7 +15,7 @@ const basis = Basis.getLocalizedBasis(DefaultLocales);

const source = new Source('basis', '');
const project = Project.make(null, 'test', source, [], DefaultLocale);
const context = new Context(project, source);
const context = project.getContext(source);

function checkBasisNodes(node: Node) {
// Check for syntax errors
Expand Down
2 changes: 1 addition & 1 deletion src/basis/InternalExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class InternalExpression extends SimpleExpression {
}

getPurpose() {
return Purpose.Evaluate;
return Purpose.Hidden;
}

computeType(): Type {
Expand Down
2 changes: 1 addition & 1 deletion src/basis/Iteration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class Iteration<State = any> extends Expression {
}

getPurpose(): Purpose {
return Purpose.Evaluate;
return Purpose.Hidden;
}

computeType() {
Expand Down
Loading
Loading