utopia-project 0.37.6 → 0.39.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.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/context/documentation-guidelines.md +12 -7
- data/lib/utopia/project/import_map.rb +1 -0
- data/lib/utopia/project/version.rb +1 -1
- data/pages/_page.xnode +2 -24
- data/pages/guides/show.xnode +0 -1
- data/pages/releases/index.xnode +0 -1
- data/public/_components/@socketry/syntax/Syntax/CodeElement.js +293 -0
- data/public/_components/@socketry/syntax/Syntax/Errors.js +52 -0
- data/public/_components/@socketry/syntax/Syntax/Language/apache.js +49 -0
- data/public/_components/@socketry/syntax/Syntax/Language/applescript.js +157 -0
- data/public/_components/@socketry/syntax/Syntax/Language/assembly.js +42 -0
- data/public/_components/@socketry/syntax/Syntax/Language/bash-script.js +108 -0
- data/public/_components/@socketry/syntax/Syntax/Language/bash.js +32 -0
- data/public/_components/@socketry/syntax/Syntax/Language/basic.js +232 -0
- data/public/_components/@socketry/syntax/Syntax/Language/c++.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/c.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/clang.js +201 -0
- data/public/_components/@socketry/syntax/Syntax/Language/cpp.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/csharp.js +166 -0
- data/public/_components/@socketry/syntax/Syntax/Language/css.js +244 -0
- data/public/_components/@socketry/syntax/Syntax/Language/diff.js +24 -0
- data/public/_components/@socketry/syntax/Syntax/Language/go.js +135 -0
- data/public/_components/@socketry/syntax/Syntax/Language/haskell.js +110 -0
- data/public/_components/@socketry/syntax/Syntax/Language/html.js +69 -0
- data/public/_components/@socketry/syntax/Syntax/Language/io.js +68 -0
- data/public/_components/@socketry/syntax/Syntax/Language/java.js +134 -0
- data/public/_components/@socketry/syntax/Syntax/Language/javascript.js +89 -0
- data/public/_components/@socketry/syntax/Syntax/Language/json.js +36 -0
- data/public/_components/@socketry/syntax/Syntax/Language/lisp.js +38 -0
- data/public/_components/@socketry/syntax/Syntax/Language/lua.js +87 -0
- data/public/_components/@socketry/syntax/Syntax/Language/markdown.js +112 -0
- data/public/_components/@socketry/syntax/Syntax/Language/nginx.js +37 -0
- data/public/_components/@socketry/syntax/Syntax/Language/objective-c.js +1 -0
- data/public/_components/@socketry/syntax/Syntax/Language/ocaml.js +225 -0
- data/public/_components/@socketry/syntax/Syntax/Language/pascal.js +166 -0
- data/public/_components/@socketry/syntax/Syntax/Language/patch.js +2 -0
- data/public/_components/@socketry/syntax/Syntax/Language/perl5.js +317 -0
- data/public/_components/@socketry/syntax/Syntax/Language/php-script.js +112 -0
- data/public/_components/@socketry/syntax/Syntax/Language/php.js +18 -0
- data/public/_components/@socketry/syntax/Syntax/Language/plain.js +20 -0
- data/public/_components/@socketry/syntax/Syntax/Language/protobuf.js +77 -0
- data/public/_components/@socketry/syntax/Syntax/Language/python.js +208 -0
- data/public/_components/@socketry/syntax/Syntax/Language/ruby.js +124 -0
- data/public/_components/@socketry/syntax/Syntax/Language/scala.js +81 -0
- data/public/_components/@socketry/syntax/Syntax/Language/smalltalk.js +30 -0
- data/public/_components/@socketry/syntax/Syntax/Language/sql.js +865 -0
- data/public/_components/@socketry/syntax/Syntax/Language/super-collider.js +70 -0
- data/public/_components/@socketry/syntax/Syntax/Language/swift.js +176 -0
- data/public/_components/@socketry/syntax/Syntax/Language/xml.js +76 -0
- data/public/_components/@socketry/syntax/Syntax/Language/xrb.js +33 -0
- data/public/_components/@socketry/syntax/Syntax/Language/yaml.js +29 -0
- data/public/_components/@socketry/syntax/Syntax/Language.js +276 -0
- data/public/_components/@socketry/syntax/Syntax/Loader.js +78 -0
- data/public/_components/@socketry/syntax/Syntax/Match.js +546 -0
- data/public/_components/@socketry/syntax/Syntax/Rule.js +306 -0
- data/public/_components/@socketry/syntax/Syntax.js +356 -0
- data/public/_components/@socketry/syntax/license.md +21 -0
- data/public/_components/@socketry/syntax/package.json +43 -0
- data/public/_components/@socketry/syntax/readme.md +162 -0
- data/public/_components/@socketry/syntax/themes/base/apache.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/applescript.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/assembly.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/bash.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/basic.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/c.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/clang.css +0 -0
- data/public/_components/@socketry/syntax/themes/base/csharp.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/css.css +22 -0
- data/public/_components/@socketry/syntax/themes/base/diff.css +48 -0
- data/public/_components/@socketry/syntax/themes/base/go.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/haskell.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/html.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/io.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/java.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/javascript.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/json.css +41 -0
- data/public/_components/@socketry/syntax/themes/base/lisp.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/lua.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/markdown.css +16 -0
- data/public/_components/@socketry/syntax/themes/base/nginx.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/ocaml.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/pascal.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/perl5.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/php-script.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/php.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/plain.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/protobuf.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/python.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/ruby.css +23 -0
- data/public/_components/@socketry/syntax/themes/base/scala.css +3 -0
- data/public/_components/@socketry/syntax/themes/base/smalltalk.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/sql.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/super-collider.css +33 -0
- data/public/_components/@socketry/syntax/themes/base/swift.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/syntax.css +63 -0
- data/public/_components/@socketry/syntax/themes/base/xml.css +1 -0
- data/public/_components/@socketry/syntax/themes/base/xrb.css +29 -0
- data/public/_components/@socketry/syntax/themes/base/yaml.css +1 -0
- data/public/_components/@socketry/syntax/themes/theming.md +233 -0
- data/public/_static/application.js +24 -0
- data/public/_static/links.js +18 -16
- data/public/_static/sidebar.js +216 -111
- data/public/_static/site.css +0 -4
- data.tar.gz.sig +0 -0
- metadata +95 -74
- metadata.gz.sig +0 -0
- data/public/_components/jquery/jquery.js +0 -10716
- data/public/_components/jquery/jquery.min.js +0 -2
- data/public/_components/jquery/jquery.min.map +0 -1
- data/public/_components/jquery/jquery.slim.js +0 -8617
- data/public/_components/jquery/jquery.slim.min.js +0 -2
- data/public/_components/jquery/jquery.slim.min.map +0 -1
- data/public/_components/jquery-litebox/jquery.litebox.css +0 -23
- data/public/_components/jquery-litebox/jquery.litebox.gallery.css +0 -48
- data/public/_components/jquery-litebox/jquery.litebox.js +0 -30
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.apache.css +0 -12
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.applescript.css +0 -5
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.assembly.css +0 -8
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.bash-script.css +0 -4
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.bash.css +0 -2
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.clang.css +0 -6
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.css.css +0 -14
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.diff.css +0 -16
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.html.css +0 -3
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.ocaml.css +0 -3
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.protobuf.css +0 -2
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.python.css +0 -6
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.ruby.css +0 -2
- data/public/_components/jquery-syntax/base/jquery.syntax.brush.xml.css +0 -35
- data/public/_components/jquery-syntax/base/jquery.syntax.core.css +0 -58
- data/public/_components/jquery-syntax/base/jquery.syntax.editor.css +0 -6
- data/public/_components/jquery-syntax/base/theme.js +0 -1
- data/public/_components/jquery-syntax/bright/jquery.syntax.core.css +0 -27
- data/public/_components/jquery-syntax/bright/theme.js +0 -1
- data/public/_components/jquery-syntax/jquery.syntax.brush.apache.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.applescript.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.assembly.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.bash-script.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.bash.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.basic.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.clang.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.csharp.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.css.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.diff.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.go.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.haskell.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.html.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.io.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.java.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.javascript.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.kai.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.lisp.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.lua.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.nginx.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.ocaml.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.ooc.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.pascal.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.perl5.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.php-script.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.php.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.plain.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.protobuf.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.python.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.ruby.js +0 -5
- data/public/_components/jquery-syntax/jquery.syntax.brush.scala.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.smalltalk.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.sql.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.super-collider.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.swift.js +0 -3
- data/public/_components/jquery-syntax/jquery.syntax.brush.xml.js +0 -4
- data/public/_components/jquery-syntax/jquery.syntax.brush.xrb.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.brush.yaml.js +0 -2
- data/public/_components/jquery-syntax/jquery.syntax.cache.js +0 -7
- data/public/_components/jquery-syntax/jquery.syntax.core.js +0 -34
- data/public/_components/jquery-syntax/jquery.syntax.editor.js +0 -11
- data/public/_components/jquery-syntax/jquery.syntax.js +0 -8
- data/public/_components/jquery-syntax/jquery.syntax.min.js +0 -13
- data/public/_components/jquery-syntax/paper/jquery.syntax.core.css +0 -31
- data/public/_components/jquery-syntax/paper/theme.js +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 21be268fb201720abe3d699eba3f8a71ebee79896293f8aaa0861a592d650dab
|
|
4
|
+
data.tar.gz: 93c814b9d849ad90d3a7761cf6d4c9bd2713293fb7de7bb48b5b2f28b3c8b34d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b0ece167920bd1069f74879b53a1844948808613e6865ecc3984861c9d6c6fe89bb9d2b98e60cb545523c488c8d5c439f8f5ff7a3b589a54222225272c3837f7
|
|
7
|
+
data.tar.gz: 885452bfa693632fae6fedb2970ec85575e7633fe2f98c62f06195f524f3fb4d27333b7eb399abfeb33455b5e6a4a390393a8163e526d5534f2528544048de68
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -73,11 +73,12 @@ Every feature or concept should be introduced with clear context about why users
|
|
|
73
73
|
1. **Problem statement**: What challenge does this solve?
|
|
74
74
|
2. **Use cases**: When would users encounter this need?
|
|
75
75
|
3. **Solution overview**: How does this feature address the problem?
|
|
76
|
-
4. **Implementation**: Code examples and detailed usage
|
|
76
|
+
4. **Implementation**: Code examples and detailed usage.
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
#### Example
|
|
79
|
+
|
|
80
|
+
❌ Poor context:
|
|
79
81
|
|
|
80
|
-
❌ **Poor context**:
|
|
81
82
|
~~~markdown
|
|
82
83
|
## Transactions
|
|
83
84
|
|
|
@@ -90,7 +91,8 @@ client.exec
|
|
|
90
91
|
```
|
|
91
92
|
~~~
|
|
92
93
|
|
|
93
|
-
✅
|
|
94
|
+
✅ Good context:
|
|
95
|
+
|
|
94
96
|
~~~markdown
|
|
95
97
|
## Transactions
|
|
96
98
|
|
|
@@ -127,7 +129,8 @@ When documenting advanced features, follow this structure:
|
|
|
127
129
|
4. **Best Practices**: When to use vs when not to use
|
|
128
130
|
5. **Common Pitfalls**: What to watch out for
|
|
129
131
|
|
|
130
|
-
|
|
132
|
+
#### Template
|
|
133
|
+
|
|
131
134
|
```markdown
|
|
132
135
|
## [Feature Name]
|
|
133
136
|
|
|
@@ -234,13 +237,15 @@ Help users understand when to choose between alternatives:
|
|
|
234
237
|
|
|
235
238
|
Every code example should demonstrate a realistic scenario, not abstract operations:
|
|
236
239
|
|
|
237
|
-
❌
|
|
240
|
+
❌ Abstract:
|
|
241
|
+
|
|
238
242
|
```ruby
|
|
239
243
|
client.set("key", "value")
|
|
240
244
|
client.get("key")
|
|
241
245
|
```
|
|
242
246
|
|
|
243
|
-
✅
|
|
247
|
+
✅ Contextual:
|
|
248
|
+
|
|
244
249
|
```ruby
|
|
245
250
|
# Store user session data:
|
|
246
251
|
client.set("session:#{session_id}", user_data.to_json)
|
data/pages/_page.xnode
CHANGED
|
@@ -15,31 +15,9 @@
|
|
|
15
15
|
<link rel="icon" type="image/png" href="/_static/icon.png" />
|
|
16
16
|
<link rel="stylesheet" href="/_static/site.css" type="text/css" media="screen" />
|
|
17
17
|
|
|
18
|
-
#{Utopia::Project::IMPORT_MAP.relative_to(request.
|
|
19
|
-
|
|
20
|
-
<script src="/_components/jquery/jquery.min.js"></script>
|
|
21
|
-
<script src="/_components/jquery-syntax/jquery.syntax.min.js"></script>
|
|
22
|
-
|
|
23
|
-
<script src="/_static/links.js"></script>
|
|
24
|
-
|
|
25
|
-
<script type="text/javascript">
|
|
26
|
-
//<![CDATA[
|
|
27
|
-
jQuery(function($) {
|
|
28
|
-
$.syntax();
|
|
29
|
-
});
|
|
30
|
-
//]]>
|
|
31
|
-
</script>
|
|
32
|
-
|
|
33
|
-
<script type="module">
|
|
34
|
-
// <![CDATA[
|
|
35
|
-
import mermaid from 'mermaid';
|
|
36
|
-
const isDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
37
|
-
const theme = isDarkMode ? 'dark' : 'default';
|
|
38
|
-
mermaid.initialize({startOnLoad: true, theme: theme});
|
|
39
|
-
// ]]>
|
|
40
|
-
</script>
|
|
18
|
+
#{Utopia::Project::IMPORT_MAP.relative_to(request.env["REQUEST_PATH"]).to_html}
|
|
19
|
+
<script type="module" src="/_static/application.js"></script>
|
|
41
20
|
</head>
|
|
42
|
-
|
|
43
21
|
<body>
|
|
44
22
|
<content:header />
|
|
45
23
|
|
data/pages/guides/show.xnode
CHANGED
data/pages/releases/index.xnode
CHANGED
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
import Syntax from '../Syntax.js';
|
|
2
|
+
|
|
3
|
+
const supportsAdopted =
|
|
4
|
+
typeof CSSStyleSheet !== 'undefined' &&
|
|
5
|
+
'adoptedStyleSheets' in Document.prototype;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* CodeElement - Web Component for syntax highlighting with isolated styles
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
* <syntax-code language="javascript">const x = 1;</syntax-code>
|
|
12
|
+
* <pre><syntax-code language="ruby">puts "Hello"</syntax-code></pre>
|
|
13
|
+
*/
|
|
14
|
+
export class CodeElement extends HTMLElement {
|
|
15
|
+
static get observedAttributes() {
|
|
16
|
+
return ['language', 'theme', 'wrap'];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#syntax = null;
|
|
20
|
+
#shadow;
|
|
21
|
+
#adoptedHrefs = new Set();
|
|
22
|
+
#highlighted = false;
|
|
23
|
+
|
|
24
|
+
constructor() {
|
|
25
|
+
super();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
get syntax() {
|
|
29
|
+
return this.#syntax || Syntax.default;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
set syntax(value) {
|
|
33
|
+
this.#syntax = value;
|
|
34
|
+
// Re-render with new syntax instance if already connected:
|
|
35
|
+
if (this.isConnected && !this.#highlighted) {
|
|
36
|
+
this.#render();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get language() {
|
|
41
|
+
return (
|
|
42
|
+
this.getAttribute('language') ||
|
|
43
|
+
this.#detectLanguageFromClass()
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
set language(value) {
|
|
48
|
+
if (value == null) {
|
|
49
|
+
this.removeAttribute('language');
|
|
50
|
+
} else {
|
|
51
|
+
this.setAttribute('language', value);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
get theme() {
|
|
56
|
+
return this.getAttribute('theme') || this.syntax.defaultOptions.theme;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
set theme(value) {
|
|
60
|
+
if (value == null) {
|
|
61
|
+
this.removeAttribute('theme');
|
|
62
|
+
} else {
|
|
63
|
+
this.setAttribute('theme', value);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get wrap() {
|
|
68
|
+
return this.hasAttribute('wrap');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
set wrap(value) {
|
|
72
|
+
if (value) {
|
|
73
|
+
this.setAttribute('wrap', '');
|
|
74
|
+
} else {
|
|
75
|
+
this.removeAttribute('wrap');
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
connectedCallback() {
|
|
80
|
+
// Detect if we're inside a <pre> element and set wrap attribute
|
|
81
|
+
if (this.parentElement?.tagName === 'PRE') {
|
|
82
|
+
this.wrap = true;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Don't re-highlight if already done
|
|
86
|
+
if (this.#highlighted) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (!this.#shadow) {
|
|
91
|
+
this.#shadow = this.attachShadow({mode: 'open'});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
this.#render();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
98
|
+
if (oldValue === newValue) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (
|
|
103
|
+
(name === 'language' || name === 'theme' || name === 'wrap') &&
|
|
104
|
+
this.isConnected &&
|
|
105
|
+
this.#shadow
|
|
106
|
+
) {
|
|
107
|
+
// Reset highlighted flag to allow re-rendering
|
|
108
|
+
this.#highlighted = false;
|
|
109
|
+
this.#adoptedHrefs.clear();
|
|
110
|
+
this.#render();
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Detect language from class names (e.g., language-javascript, brush-ruby)
|
|
116
|
+
*/
|
|
117
|
+
#detectLanguageFromClass() {
|
|
118
|
+
const classes = this.className.split(/\s+/);
|
|
119
|
+
|
|
120
|
+
for (const cls of classes) {
|
|
121
|
+
// Match language-* or brush-* patterns
|
|
122
|
+
const match = cls.match(/^(?:language|brush)-(.+)$/);
|
|
123
|
+
if (match) {
|
|
124
|
+
return match[1];
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Get the code content to highlight
|
|
133
|
+
*/
|
|
134
|
+
#getCodeContent() {
|
|
135
|
+
// Check if there's a <code> child element
|
|
136
|
+
const codeElement = this.querySelector('code');
|
|
137
|
+
if (codeElement) {
|
|
138
|
+
return codeElement.textContent;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return this.textContent;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Load theme CSS into shadow root
|
|
146
|
+
*/
|
|
147
|
+
async #loadStylesheets(languageName) {
|
|
148
|
+
// Guard: ensure shadow root exists
|
|
149
|
+
if (!this.#shadow) {
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const themeRoot = new URL(
|
|
154
|
+
this.syntax.themeRoot,
|
|
155
|
+
typeof document !== 'undefined' ? document.baseURI : import.meta.url
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const urls = [
|
|
159
|
+
new URL('syntax.css', themeRoot),
|
|
160
|
+
new URL(`${languageName}.css`, themeRoot)
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
if (supportsAdopted && this.#shadow.adoptedStyleSheets !== undefined) {
|
|
164
|
+
const sheets = Array.from(this.#shadow.adoptedStyleSheets);
|
|
165
|
+
for (const url of urls) {
|
|
166
|
+
const href = url.toString();
|
|
167
|
+
if (this.#adoptedHrefs.has(href)) continue;
|
|
168
|
+
try {
|
|
169
|
+
const result = await this.syntax.getStyleSheet(url);
|
|
170
|
+
if (result.sheet) {
|
|
171
|
+
sheets.push(result.sheet);
|
|
172
|
+
this.#adoptedHrefs.add(href);
|
|
173
|
+
}
|
|
174
|
+
} catch (error) {
|
|
175
|
+
console.warn(`Failed to load ${href}:`, error);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
this.#shadow.adoptedStyleSheets = sheets;
|
|
179
|
+
} else {
|
|
180
|
+
// Fallback: inline <style> tags in shadow root
|
|
181
|
+
for (const url of urls) {
|
|
182
|
+
const href = url.toString();
|
|
183
|
+
if (this.#adoptedHrefs.has(href)) continue;
|
|
184
|
+
try {
|
|
185
|
+
const result = await this.syntax.getStyleSheet(url);
|
|
186
|
+
const style = document.createElement('style');
|
|
187
|
+
style.textContent = result.cssText;
|
|
188
|
+
this.#shadow.appendChild(style);
|
|
189
|
+
this.#adoptedHrefs.add(href);
|
|
190
|
+
} catch (error) {
|
|
191
|
+
console.warn(`Failed to load ${href}:`, error);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Perform syntax highlighting and render into shadow DOM
|
|
199
|
+
*/
|
|
200
|
+
async #render() {
|
|
201
|
+
try {
|
|
202
|
+
const languageName = this.language;
|
|
203
|
+
|
|
204
|
+
if (!languageName) {
|
|
205
|
+
console.warn('<syntax-code>: No language specified');
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Get or auto-load the language
|
|
210
|
+
const language = await this.syntax.getLanguage(languageName);
|
|
211
|
+
|
|
212
|
+
if (!language) {
|
|
213
|
+
console.warn(
|
|
214
|
+
`<syntax-code>: Language '${languageName}' not found and could not be loaded`
|
|
215
|
+
);
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// Load theme CSS into shadow root using the language's canonical name
|
|
220
|
+
await this.#loadStylesheets(language.name);
|
|
221
|
+
|
|
222
|
+
const code = this.#getCodeContent();
|
|
223
|
+
|
|
224
|
+
// Clear shadow DOM before rendering (must happen before appendChild to remove old content, but after loadStylesheets since fallback path may have appended <style> elements):
|
|
225
|
+
this.#shadow.innerHTML = '';
|
|
226
|
+
|
|
227
|
+
// Highlight and append - language.process() returns a <code> element:
|
|
228
|
+
const highlighted = await language.process(this.syntax, code);
|
|
229
|
+
this.#shadow.appendChild(highlighted);
|
|
230
|
+
|
|
231
|
+
// Clear light DOM only after successful render to avoid losing content on errors:
|
|
232
|
+
this.textContent = '';
|
|
233
|
+
|
|
234
|
+
this.#highlighted = true;
|
|
235
|
+
} catch (error) {
|
|
236
|
+
console.warn('<syntax-code> render failed:', error);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Auto-register the custom element
|
|
243
|
+
*/
|
|
244
|
+
if (
|
|
245
|
+
typeof customElements !== 'undefined' &&
|
|
246
|
+
!customElements.get('syntax-code')
|
|
247
|
+
) {
|
|
248
|
+
customElements.define('syntax-code', CodeElement);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Compatibility layer - upgrade existing code blocks to web components
|
|
253
|
+
*/
|
|
254
|
+
export function upgradeAll(selector, syntax = null) {
|
|
255
|
+
const elements = document.querySelectorAll(selector);
|
|
256
|
+
|
|
257
|
+
for (const element of elements) {
|
|
258
|
+
// Create a syntax-code wrapper
|
|
259
|
+
const wrapper = document.createElement('syntax-code');
|
|
260
|
+
if (syntax) {
|
|
261
|
+
wrapper.syntax = syntax;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Try to detect language from various sources
|
|
265
|
+
let language = element.getAttribute('lang') || element.getAttribute('language');
|
|
266
|
+
|
|
267
|
+
if (!language) {
|
|
268
|
+
// Check class names
|
|
269
|
+
const classes = element.className.split(/\s+/);
|
|
270
|
+
for (const cls of classes) {
|
|
271
|
+
const match = cls.match(/^(?:language|brush)-(.+)$/);
|
|
272
|
+
if (match) {
|
|
273
|
+
language = match[1];
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (language) {
|
|
280
|
+
wrapper.setAttribute('language', language);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Copy the code content into the wrapper
|
|
284
|
+
wrapper.textContent = element.textContent;
|
|
285
|
+
|
|
286
|
+
// Replace <code> with <syntax-code>, leaving <pre> parent in place
|
|
287
|
+
const parent = element.parentElement;
|
|
288
|
+
parent.replaceChild(wrapper, element);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export {Syntax};
|
|
293
|
+
export default CodeElement;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export class GenericSyntaxError extends Error {
|
|
2
|
+
constructor(message, options = {}) {
|
|
3
|
+
super(message, options);
|
|
4
|
+
Object.defineProperty(this, 'name', {value: this.constructor.name});
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class LanguageNotFoundError extends GenericSyntaxError {
|
|
9
|
+
constructor(language, options = {}) {
|
|
10
|
+
super(`Language not found: ${language}`, options);
|
|
11
|
+
this.language = language;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export class LanguageLoadError extends GenericSyntaxError {
|
|
16
|
+
constructor(language, url, options = {}) {
|
|
17
|
+
super(`Failed to load language '${language}' from ${url}`, options);
|
|
18
|
+
this.language = language;
|
|
19
|
+
this.url = url;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export class StyleSheetLoadError extends GenericSyntaxError {
|
|
24
|
+
constructor(url, status, options = {}) {
|
|
25
|
+
super(`Failed to load stylesheet ${url} (status: ${status})`, options);
|
|
26
|
+
this.url = url;
|
|
27
|
+
this.status = status;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export class RuleApplyError extends GenericSyntaxError {
|
|
32
|
+
constructor(rule, options = {}) {
|
|
33
|
+
const pattern =
|
|
34
|
+
rule?.pattern instanceof RegExp
|
|
35
|
+
? `/${rule.pattern.source}/${rule.pattern.flags}`
|
|
36
|
+
: String(rule?.pattern);
|
|
37
|
+
const type = rule?.type || rule?.klass || 'unknown';
|
|
38
|
+
super(`Rule apply failed (type=${type}, pattern=${pattern})`, options);
|
|
39
|
+
this.rule = rule;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class HighlightRenderError extends GenericSyntaxError {}
|
|
44
|
+
|
|
45
|
+
export default {
|
|
46
|
+
GenericSyntaxError,
|
|
47
|
+
LanguageNotFoundError,
|
|
48
|
+
LanguageLoadError,
|
|
49
|
+
StyleSheetLoadError,
|
|
50
|
+
RuleApplyError,
|
|
51
|
+
HighlightRenderError
|
|
52
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('apache');
|
|
5
|
+
|
|
6
|
+
language.push({
|
|
7
|
+
pattern: /(<(\w+).*?>)/i,
|
|
8
|
+
matches: Rule.extractMatches(
|
|
9
|
+
{
|
|
10
|
+
type: 'tag',
|
|
11
|
+
allow: ['attribute', 'tag-name', 'string']
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
type: 'tag-name',
|
|
15
|
+
process: Rule.webLinkProcess(
|
|
16
|
+
'http://httpd.apache.org/docs/trunk/mod/directive-dict.html#'
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
language.push({
|
|
23
|
+
pattern: /(<\/(\w+).*?>)/i,
|
|
24
|
+
matches: Rule.extractMatches(
|
|
25
|
+
{type: 'tag', allow: ['tag-name']},
|
|
26
|
+
{type: 'tag-name'}
|
|
27
|
+
)
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
language.push({
|
|
31
|
+
pattern: /^\s+([A-Z][\w]+)/m,
|
|
32
|
+
matches: Rule.extractMatches({
|
|
33
|
+
type: 'function',
|
|
34
|
+
allow: ['attribute'],
|
|
35
|
+
process: Rule.webLinkProcess(
|
|
36
|
+
'http://httpd.apache.org/docs/trunk/mod/directive-dict.html#'
|
|
37
|
+
)
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
language.push(Rule.perlStyleComment);
|
|
42
|
+
language.push(Rule.singleQuotedString);
|
|
43
|
+
language.push(Rule.doubleQuotedString);
|
|
44
|
+
|
|
45
|
+
language.push(Rule.webLink);
|
|
46
|
+
|
|
47
|
+
export default function register(syntax) {
|
|
48
|
+
syntax.register('apache', language);
|
|
49
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import {Language} from '../Language.js';
|
|
2
|
+
import {Rule} from '../Rule.js';
|
|
3
|
+
|
|
4
|
+
const language = new Language('applescript');
|
|
5
|
+
|
|
6
|
+
var keywords = [
|
|
7
|
+
'after',
|
|
8
|
+
'before',
|
|
9
|
+
'beginning',
|
|
10
|
+
'continue',
|
|
11
|
+
'copy',
|
|
12
|
+
'each',
|
|
13
|
+
'end',
|
|
14
|
+
'every',
|
|
15
|
+
'from',
|
|
16
|
+
'get',
|
|
17
|
+
'global',
|
|
18
|
+
'in',
|
|
19
|
+
'local',
|
|
20
|
+
'named',
|
|
21
|
+
'of',
|
|
22
|
+
'return',
|
|
23
|
+
'set',
|
|
24
|
+
'some',
|
|
25
|
+
'that',
|
|
26
|
+
'the',
|
|
27
|
+
'then',
|
|
28
|
+
'times',
|
|
29
|
+
'to',
|
|
30
|
+
'where',
|
|
31
|
+
'whose',
|
|
32
|
+
'with',
|
|
33
|
+
'without'
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
language.push(keywords, {type: 'keyword'});
|
|
37
|
+
|
|
38
|
+
var ordinals = [
|
|
39
|
+
'first',
|
|
40
|
+
'second',
|
|
41
|
+
'third',
|
|
42
|
+
'fourth',
|
|
43
|
+
'fifth',
|
|
44
|
+
'sixth',
|
|
45
|
+
'seventh',
|
|
46
|
+
'eighth',
|
|
47
|
+
'ninth',
|
|
48
|
+
'tenth',
|
|
49
|
+
'last',
|
|
50
|
+
'front',
|
|
51
|
+
'back',
|
|
52
|
+
'middle'
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
language.push(ordinals, {type: 'keyword'});
|
|
56
|
+
|
|
57
|
+
var specials = [
|
|
58
|
+
'activate',
|
|
59
|
+
'add',
|
|
60
|
+
'alias',
|
|
61
|
+
'AppleScript',
|
|
62
|
+
'ask',
|
|
63
|
+
'attachment',
|
|
64
|
+
'boolean',
|
|
65
|
+
'class',
|
|
66
|
+
'constant',
|
|
67
|
+
'delete',
|
|
68
|
+
'duplicate',
|
|
69
|
+
'empty',
|
|
70
|
+
'exists',
|
|
71
|
+
'false',
|
|
72
|
+
'id',
|
|
73
|
+
'integer',
|
|
74
|
+
'list',
|
|
75
|
+
'make',
|
|
76
|
+
'message',
|
|
77
|
+
'modal',
|
|
78
|
+
'modified',
|
|
79
|
+
'new',
|
|
80
|
+
'no',
|
|
81
|
+
'paragraph',
|
|
82
|
+
'pi',
|
|
83
|
+
'properties',
|
|
84
|
+
'quit',
|
|
85
|
+
'real',
|
|
86
|
+
'record',
|
|
87
|
+
'remove',
|
|
88
|
+
'rest',
|
|
89
|
+
'result',
|
|
90
|
+
'reveal',
|
|
91
|
+
'reverse',
|
|
92
|
+
'run',
|
|
93
|
+
'running',
|
|
94
|
+
'save',
|
|
95
|
+
'string',
|
|
96
|
+
'true',
|
|
97
|
+
'word',
|
|
98
|
+
'yes'
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
language.push(specials, {type: 'keyword'});
|
|
102
|
+
|
|
103
|
+
language.push(Rule.webLink);
|
|
104
|
+
|
|
105
|
+
// AppleScript supports multiple comment styles
|
|
106
|
+
language.push({
|
|
107
|
+
pattern: /(\-\-|#).*$/m,
|
|
108
|
+
type: 'comment',
|
|
109
|
+
allow: ['href']
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
language.push({
|
|
113
|
+
pattern: /\(\*(?:[\s\S]*?\(\*[\s\S]*?\*\))*[\s\S]*?\*\)/m,
|
|
114
|
+
type: 'comment',
|
|
115
|
+
allow: ['href']
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
language.push(Rule.doubleQuotedString);
|
|
119
|
+
|
|
120
|
+
// Ordinal numbers (1st, 2nd, 3rd, etc.)
|
|
121
|
+
language.push({
|
|
122
|
+
pattern: /\b\d+(st|nd|rd|th)\b/,
|
|
123
|
+
type: 'constant'
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Regular numbers
|
|
127
|
+
language.push({
|
|
128
|
+
pattern: /\b-?\d+\.?\d*(?:E[+\-]?\d+)?\b/,
|
|
129
|
+
type: 'constant'
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
language.push({
|
|
133
|
+
pattern: /&|¬|=|≠|>|<|≥|>=|≤|<=|\*|\+|-|\/|÷|\^/,
|
|
134
|
+
type: 'operator'
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
language.push({
|
|
138
|
+
pattern:
|
|
139
|
+
/\b(?:and|as|div|mod|not|or|return(?!\s&)(ing)?|equals|(is(n't| not)? )?equal( to)?|does(n't| not) equal|(is(n't| not)? )?(greater|less) than( or equal( to)?)?|(comes|does(n't| not) come) (after|before)|is(n't| not)?( in)? (back|front) of|is(n't| not)? behind|is(n't| not)?( (in|contained by))?|does(n't| not) contain|contain(s)?|(start|begin|end)(s)? with|((but|end) )?(consider|ignor)ing|prop(erty)?|(a )?ref(erence)?( to)?|repeat (until|while|with)|((end|exit) )?repeat|((else|end) )?if|else|(end )?(script|tell|try)|(on )?error|(put )?into|(of )?(it|me)|its|my|with (timeout( of)?|transaction)|end (timeout|transaction))\b/,
|
|
140
|
+
type: 'keyword'
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
language.push({
|
|
144
|
+
pattern:
|
|
145
|
+
/\b(?:about|above|against|around|at|below|beneath|beside|between|by|(apart|aside) from|(instead|out) of|into|on(to)?|over|since|thr(ough|u)|under)\b/,
|
|
146
|
+
type: 'keyword'
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
language.push({
|
|
150
|
+
pattern:
|
|
151
|
+
/\b(?:adding folder items to|after receiving|choose( ((remote )?application|color|folder|from list|URL))?|clipboard info|set the clipboard to|(the )?clipboard|entire contents|display(ing| (alert|dialog|mode))?|document( (edited|file|nib name))?|file( (name|type))?|(info )?for|giving up after|(name )?extension|quoted form|return(ed)?|second(?! item)(s)?|list (disks|folder)|text item(s| delimiters)?|(Unicode )?text|(disk )?item(s)?|((current|list) )?view|((container|key) )?window|with (data|icon( (caution|note|stop))?|parameter(s)?|prompt|properties|seed|title)|case|diacriticals|hyphens|numeric strings|punctuation|white space|folder creation|application(s( folder)?| (processes|scripts position|support))?|((desktop )?(pictures )?|(documents|downloads|favorites|home|keychain|library|movies|music|public|scripts|sites|system|users|utilities|workflows) )folder|desktop|Folder Action scripts|font(s| panel)?|help|internet plugins|modem scripts|(system )?preferences|printer descriptions|scripting (additions|components)|shared (documents|libraries)|startup (disk|items)|temporary items|trash|on server|in AppleTalk zone|((as|long|short) )?user name|user (ID|locale)|(with )?password|in (bundle( with identifier)?|directory)|(close|open for) access|read|write( permission)?|(g|s)et eof|using( delimiters)?|starting at|default (answer|button|color|country code|entr(y|ies)|identifiers|items|name|location|script editor)|hidden( answer)?|open(ed| (location|untitled))?|error (handling|reporting)|(do( shell)?|load|run|store) script|administrator privileges|altering line endings|get volume settings|(alert|boot|input|mount|output|set) volume|output muted|(fax|random )?number|round(ing)?|up|down|toward zero|to nearest|as taught in school|system (attribute|info)|((AppleScript( Studio)?|system) )?version|(home )?directory|(IPv4|primary Ethernet) address|CPU (type|speed)|physical memory|time (stamp|to GMT)|replacing|ASCII (character|number)|localized string|from table|offset|summarize|beep|delay|say|(empty|multiple) selections allowed|(of|preferred) type|invisibles|showing( package contents)?|editable URL|(File|FTP|News|Media|Web) [Ss]ervers|Telnet hosts|Directory services|Remote applications|waiting until completion|saving( (in|to))?|path (for|to( (((current|frontmost) )?application|resource))?)|POSIX (file|path)|(background|RGB) color|(OK|cancel) button name|cancel button|button(s)?|cubic ((centi)?met(re|er)s|yards|feet|inches)|square ((kilo)?met(re|er)s|miles|yards|feet)|(centi|kilo)?met(re|er)s|miles|yards|feet|inches|lit(re|er)s|gallons|quarts|(kilo)?grams|ounces|pounds|degrees (Celsius|Fahrenheit|Kelvin)|print( (dialog|settings))?|clos(e(able)?|ing)|(de)?miniaturized|miniaturizable|zoom(ed|able)|attribute run|action (method|property|title)|phone|email|((start|end)ing|home) page|((birth|creation|current|custom|modification) )?date|((((phonetic )?(first|last|middle))|computer|host|maiden|related) |nick)?name|aim|icq|jabber|msn|yahoo|address(es)?|save addressbook|should enable action|city|country( code)?|formatte(r|d address)|(palette )?label|state|street|zip|AIM [Hh]andle(s)?|my card|select(ion| all)?|unsaved|(alpha )?value|entr(y|ies)|group|(ICQ|Jabber|MSN) handle|person|people|company|department|icon image|job title|note|organization|suffix|vcard|url|copies|collating|pages (across|down)|request print time|target( printer)?|((GUI Scripting|Script menu) )?enabled|show Computer scripts|(de)?activated|awake from nib|became (key|main)|call method|of (class|object)|center|clicked toolbar item|closed|for document|exposed|(can )?hide|idle|keyboard (down|up)|event( (number|type))?|launch(ed)?|load (image|movie|nib|sound)|owner|log|mouse (down|dragged|entered|exited|moved|up)|move|column|localization|resource|script|register|drag (info|types)|resigned (active|key|main)|resiz(e(d)?|able)|right mouse (down|dragged|up)|scroll wheel|(at )?index|should (close|open( untitled)?|quit( after last window closed)?|zoom)|((proposed|screen) )?bounds|show(n)?|behind|in front of|size (mode|to fit)|update(d| toolbar item)?|was (hidden|miniaturized)|will (become active|close|finish launching|hide|miniaturize|move|open|quit|(resign )?active|((maximum|minimum|proposed) )?size|show|zoom)|bundle|data source|movie|pasteboard|sound|tool(bar| tip)|(color|open|save) panel|coordinate system|frontmost|main( (bundle|menu|window))?|((services|(excluded from )?windows) )?menu|((executable|frameworks|resource|scripts|shared (frameworks|support)) )?path|(selected item )?identifier|data|content(s| view)?|character(s)?|click count|(command|control|option|shift) key down|context|delta (x|y|z)|key( code)?|location|pressure|unmodified characters|types|(first )?responder|playing|(allowed|selectable) identifiers|allows customization|(auto saves )?configuration|visible|image( name)?|menu form representation|tag|user(-| )defaults|associated file name|(auto|needs) display|current field editor|floating|has (resize indicator|shadow)|hides when deactivated|level|minimized (image|title)|opaque|position|release when closed|sheet|title(d)?)\b/,
|
|
152
|
+
type: 'keyword'
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
export default function register(syntax) {
|
|
156
|
+
syntax.register('applescript', language);
|
|
157
|
+
}
|