rip-lang 3.13.71 → 3.13.73
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/README.md +1 -1
- package/docs/dist/rip.js +25 -2
- package/docs/dist/rip.min.js +2 -2
- package/docs/dist/rip.min.js.br +0 -0
- package/docs/ui/alert-dialog.rip +96 -0
- package/docs/ui/badge.rip +15 -0
- package/docs/ui/breadcrumb.rip +46 -0
- package/docs/ui/button-group.rip +26 -0
- package/docs/ui/card.rip +25 -0
- package/docs/ui/carousel.rip +110 -0
- package/docs/ui/collapsible.rip +50 -0
- package/docs/ui/hljs-rip.js +209 -0
- package/docs/ui/index.css +412 -19
- package/docs/ui/index.html +690 -354
- package/docs/ui/input-group.rip +28 -0
- package/docs/ui/label.rip +16 -0
- package/docs/ui/native-select.rip +32 -0
- package/docs/ui/pagination.rip +123 -0
- package/docs/ui/resizable.rip +123 -0
- package/docs/ui/skeleton.rip +22 -0
- package/docs/ui/spinner.rip +17 -0
- package/docs/ui/table.rip +27 -0
- package/docs/ui/textarea.rip +48 -0
- package/package.json +1 -1
- package/src/browser.js +23 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
// highlight.js language definition for Rip
|
|
2
|
+
|
|
3
|
+
export default function(hljs) {
|
|
4
|
+
const KEYWORDS = [
|
|
5
|
+
// Control flow
|
|
6
|
+
'if', 'else', 'unless', 'then', 'switch', 'when',
|
|
7
|
+
'for', 'while', 'until', 'loop', 'do',
|
|
8
|
+
'return', 'break', 'continue', 'throw',
|
|
9
|
+
'try', 'catch', 'finally',
|
|
10
|
+
'yield', 'await',
|
|
11
|
+
// Modules
|
|
12
|
+
'import', 'export', 'from', 'default',
|
|
13
|
+
// Operators as keywords
|
|
14
|
+
'delete', 'typeof', 'instanceof', 'new', 'super',
|
|
15
|
+
'and', 'or', 'not', 'is', 'isnt',
|
|
16
|
+
// Declarations
|
|
17
|
+
'class', 'def', 'enum', 'interface', 'extends', 'own',
|
|
18
|
+
// Iteration
|
|
19
|
+
'in', 'of', 'by', 'as',
|
|
20
|
+
// Component system
|
|
21
|
+
'component', 'render', 'slot', 'offer', 'accept',
|
|
22
|
+
// Other
|
|
23
|
+
'use', 'debugger', 'it',
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
const LITERALS = [
|
|
27
|
+
'true', 'false', 'yes', 'no', 'on', 'off',
|
|
28
|
+
'null', 'undefined', 'NaN', 'Infinity', 'this',
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
const BUILT_INS = [
|
|
32
|
+
'console', 'process', 'require', 'module', 'exports',
|
|
33
|
+
'setTimeout', 'setInterval', 'clearTimeout', 'clearInterval',
|
|
34
|
+
'requestAnimationFrame', 'cancelAnimationFrame',
|
|
35
|
+
'Promise', 'Array', 'Object', 'String', 'Number', 'Boolean',
|
|
36
|
+
'Math', 'Date', 'RegExp', 'Error', 'TypeError', 'RangeError',
|
|
37
|
+
'JSON', 'Map', 'Set', 'WeakMap', 'WeakSet',
|
|
38
|
+
'Symbol', 'Proxy', 'Reflect',
|
|
39
|
+
'Buffer', 'Bun',
|
|
40
|
+
'document', 'window', 'globalThis', 'navigator',
|
|
41
|
+
'fetch', 'URL', 'URLSearchParams', 'FormData',
|
|
42
|
+
'Event', 'CustomEvent', 'EventSource',
|
|
43
|
+
'HTMLElement', 'Node', 'NodeList', 'Element',
|
|
44
|
+
'DocumentFragment', 'MutationObserver', 'ResizeObserver',
|
|
45
|
+
'IntersectionObserver',
|
|
46
|
+
// Rip stdlib
|
|
47
|
+
'p', 'pp', 'abort', 'assert', 'exit', 'kind', 'noop',
|
|
48
|
+
'raise', 'rand', 'sleep', 'todo', 'warn', 'zip',
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
const INTERPOLATION = {
|
|
52
|
+
className: 'subst',
|
|
53
|
+
begin: /#\{/, end: /\}/,
|
|
54
|
+
keywords: { keyword: KEYWORDS, literal: LITERALS },
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const STRING_DOUBLE = {
|
|
58
|
+
className: 'string',
|
|
59
|
+
begin: '"', end: '"',
|
|
60
|
+
contains: [hljs.BACKSLASH_ESCAPE, INTERPOLATION],
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const STRING_SINGLE = {
|
|
64
|
+
className: 'string',
|
|
65
|
+
begin: "'", end: "'",
|
|
66
|
+
contains: [hljs.BACKSLASH_ESCAPE],
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const HEREDOC_DOUBLE = {
|
|
70
|
+
className: 'string',
|
|
71
|
+
begin: '"""', end: '"""',
|
|
72
|
+
contains: [hljs.BACKSLASH_ESCAPE, INTERPOLATION],
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const HEREDOC_SINGLE = {
|
|
76
|
+
className: 'string',
|
|
77
|
+
begin: "'''", end: "'''",
|
|
78
|
+
contains: [hljs.BACKSLASH_ESCAPE],
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
const HEREGEX = {
|
|
82
|
+
className: 'regexp',
|
|
83
|
+
begin: '///', end: '///[gimsuy]*',
|
|
84
|
+
contains: [INTERPOLATION, hljs.HASH_COMMENT_MODE],
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const REGEX = {
|
|
88
|
+
className: 'regexp',
|
|
89
|
+
begin: /\/(?![/*])(?:[^\/\\]|\\.)*\/[gimsuy]*/,
|
|
90
|
+
relevance: 0,
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const BLOCK_COMMENT = {
|
|
94
|
+
className: 'comment',
|
|
95
|
+
begin: '###', end: '###',
|
|
96
|
+
contains: [hljs.PHRASAL_WORDS_MODE],
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const LINE_COMMENT = hljs.COMMENT('#', '$');
|
|
100
|
+
|
|
101
|
+
const NUMBER = {
|
|
102
|
+
className: 'number',
|
|
103
|
+
variants: [
|
|
104
|
+
{ begin: /0x[0-9a-fA-F](?:_?[0-9a-fA-F])*n?/ },
|
|
105
|
+
{ begin: /0o[0-7](?:_?[0-7])*n?/ },
|
|
106
|
+
{ begin: /0b[01](?:_?[01])*n?/ },
|
|
107
|
+
{ begin: /\d[\d_]*(?:\.[\d][\d_]*)?(?:[eE][+-]?\d+)?n?/ },
|
|
108
|
+
],
|
|
109
|
+
relevance: 0,
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const INSTANCE_VAR = {
|
|
113
|
+
className: 'variable',
|
|
114
|
+
begin: /@[a-zA-Z_$][\w$]*/,
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const SIGIL_ATTR = {
|
|
118
|
+
className: 'attribute',
|
|
119
|
+
begin: /\$[a-zA-Z_][\w]*/,
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const CLASS_NAME = {
|
|
123
|
+
className: 'title.class',
|
|
124
|
+
begin: /[A-Z][\w]*/,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const FUNCTION_DEF = {
|
|
128
|
+
className: 'function',
|
|
129
|
+
begin: /\bdef\s+/,
|
|
130
|
+
end: /[(\s]/,
|
|
131
|
+
excludeEnd: true,
|
|
132
|
+
keywords: { keyword: 'def' },
|
|
133
|
+
contains: [
|
|
134
|
+
{ className: 'title.function', begin: /[a-zA-Z_$][\w$]*[!?]?/ },
|
|
135
|
+
],
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const METHOD_DEF = {
|
|
139
|
+
className: 'function',
|
|
140
|
+
match: /[a-zA-Z_$][\w$]*[!?]?(?=\s*:\s*(?:\([^)]*\)\s*)?[-=]>)/,
|
|
141
|
+
contains: [
|
|
142
|
+
{ className: 'title.function', begin: /[a-zA-Z_$][\w$]*[!?]?/ },
|
|
143
|
+
],
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const COMPONENT_DEF = {
|
|
147
|
+
className: 'class',
|
|
148
|
+
begin: /\b(?:export\s+)?[A-Z][\w]*\s*=\s*component\b/,
|
|
149
|
+
returnBegin: true,
|
|
150
|
+
keywords: { keyword: ['export', 'component'] },
|
|
151
|
+
contains: [
|
|
152
|
+
{ className: 'title.class', begin: /[A-Z][\w]*/ },
|
|
153
|
+
],
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const CLASS_DEF = {
|
|
157
|
+
className: 'class',
|
|
158
|
+
beginKeywords: 'class',
|
|
159
|
+
end: /$/,
|
|
160
|
+
contains: [
|
|
161
|
+
{ className: 'title.class', begin: /[A-Z][\w]*/ },
|
|
162
|
+
{ beginKeywords: 'extends', contains: [CLASS_NAME] },
|
|
163
|
+
],
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const OPERATORS = {
|
|
167
|
+
className: 'operator',
|
|
168
|
+
begin: /\|>|::=|::|:=|~=|~>|<=>|\.=|=!|!\?|\?!|=~|\?\?=|\?\?|\?\.|\.\.\.|\.\.|=>|->|\*\*|\/\/|%%|===|!==|==|!=|<=|>=|&&|\|\||[+\-*\/%&|^~<>=!?]/,
|
|
169
|
+
relevance: 0,
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const TYPE_KEYWORDS = {
|
|
173
|
+
className: 'type',
|
|
174
|
+
begin: /\b(?:number|string|boolean|void|any|never|unknown|object|symbol|bigint)\b/,
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
name: 'Rip',
|
|
179
|
+
aliases: ['rip'],
|
|
180
|
+
keywords: {
|
|
181
|
+
keyword: KEYWORDS,
|
|
182
|
+
literal: LITERALS,
|
|
183
|
+
built_in: BUILT_INS,
|
|
184
|
+
},
|
|
185
|
+
contains: [
|
|
186
|
+
BLOCK_COMMENT,
|
|
187
|
+
LINE_COMMENT,
|
|
188
|
+
HEREDOC_DOUBLE,
|
|
189
|
+
HEREDOC_SINGLE,
|
|
190
|
+
STRING_DOUBLE,
|
|
191
|
+
STRING_SINGLE,
|
|
192
|
+
HEREGEX,
|
|
193
|
+
REGEX,
|
|
194
|
+
COMPONENT_DEF,
|
|
195
|
+
FUNCTION_DEF,
|
|
196
|
+
METHOD_DEF,
|
|
197
|
+
CLASS_DEF,
|
|
198
|
+
NUMBER,
|
|
199
|
+
INSTANCE_VAR,
|
|
200
|
+
SIGIL_ATTR,
|
|
201
|
+
TYPE_KEYWORDS,
|
|
202
|
+
OPERATORS,
|
|
203
|
+
{ // inline JS (backtick)
|
|
204
|
+
className: 'string',
|
|
205
|
+
begin: /`[^`]*`/,
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
};
|
|
209
|
+
}
|