create-basicjs 0.1.5 → 0.1.7
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 +12 -0
- package/bin/create-basicjs.js +49 -4
- package/package.json +1 -1
- package/payload/projects/tauri/.github/workflows/build.yml +86 -0
- package/payload/projects/tauri/.github/workflows/tests.yml +87 -0
- package/payload/projects/tauri/AGENTS.md +128 -0
- package/payload/projects/tauri/CLAUDE.md +1 -0
- package/payload/projects/tauri/LICENSE +201 -0
- package/payload/projects/tauri/NOTICE +8 -0
- package/payload/projects/tauri/README.md +269 -0
- package/payload/projects/tauri/checks/window-check.js +189 -0
- package/payload/projects/tauri/gitignore +8 -0
- package/payload/projects/tauri/handbook/01-getting-started.md +188 -0
- package/payload/projects/tauri/handbook/02-the-project.md +264 -0
- package/payload/projects/tauri/handbook/03-the-page.md +260 -0
- package/payload/projects/tauri/handbook/04-commands.md +265 -0
- package/payload/projects/tauri/handbook/05-events-and-state.md +275 -0
- package/payload/projects/tauri/handbook/06-plugins.md +282 -0
- package/payload/projects/tauri/handbook/07-the-window-and-the-app.md +431 -0
- package/payload/projects/tauri/handbook/08-security.md +374 -0
- package/payload/projects/tauri/handbook/09-tests-and-checks.md +266 -0
- package/payload/projects/tauri/handbook/10-building-and-releasing.md +238 -0
- package/payload/projects/tauri/handbook/11-troubleshooting.md +259 -0
- package/payload/projects/tauri/handbook/README.md +125 -0
- package/payload/projects/tauri/handbook/turkce/01-getting-started.md +193 -0
- package/payload/projects/tauri/handbook/turkce/02-the-project.md +272 -0
- package/payload/projects/tauri/handbook/turkce/03-the-page.md +272 -0
- package/payload/projects/tauri/handbook/turkce/04-commands.md +271 -0
- package/payload/projects/tauri/handbook/turkce/05-events-and-state.md +284 -0
- package/payload/projects/tauri/handbook/turkce/06-plugins.md +286 -0
- package/payload/projects/tauri/handbook/turkce/07-the-window-and-the-app.md +433 -0
- package/payload/projects/tauri/handbook/turkce/08-security.md +384 -0
- package/payload/projects/tauri/handbook/turkce/09-tests-and-checks.md +275 -0
- package/payload/projects/tauri/handbook/turkce/10-building-and-releasing.md +241 -0
- package/payload/projects/tauri/handbook/turkce/11-troubleshooting.md +264 -0
- package/payload/projects/tauri/handbook/turkce/README.md +128 -0
- package/payload/projects/tauri/images/app.png +0 -0
- package/payload/projects/tauri/src-tauri/Cargo.lock +4389 -0
- package/payload/projects/tauri/src-tauri/Cargo.toml +31 -0
- package/payload/projects/tauri/src-tauri/app-icon.svg +16 -0
- package/payload/projects/tauri/src-tauri/build.rs +15 -0
- package/payload/projects/tauri/src-tauri/capabilities/default.json +7 -0
- package/payload/projects/tauri/src-tauri/gitignore +5 -0
- package/payload/projects/tauri/src-tauri/icons/128x128.png +0 -0
- package/payload/projects/tauri/src-tauri/icons/128x128@2x.png +0 -0
- package/payload/projects/tauri/src-tauri/icons/32x32.png +0 -0
- package/payload/projects/tauri/src-tauri/icons/icon.icns +0 -0
- package/payload/projects/tauri/src-tauri/icons/icon.ico +0 -0
- package/payload/projects/tauri/src-tauri/src/check.rs +144 -0
- package/payload/projects/tauri/src-tauri/src/files.rs +255 -0
- package/payload/projects/tauri/src-tauri/src/main.rs +45 -0
- package/payload/projects/tauri/src-tauri/src/sizes.rs +214 -0
- package/payload/projects/tauri/src-tauri/tauri.conf.json +44 -0
- package/payload/projects/tauri/src-tauri/tests/project.rs +243 -0
- package/payload/projects/tauri/ui/app.js +459 -0
- package/payload/projects/tauri/ui/backend.js +196 -0
- package/payload/projects/tauri/ui/basic/LICENSE +14 -0
- package/payload/projects/tauri/ui/basic/basic.min.css +1 -0
- package/payload/projects/tauri/ui/basic/basic.min.js +78 -0
- package/payload/projects/tauri/ui/basic/font/open-sans/LICENSE.txt +206 -0
- package/payload/projects/tauri/ui/basic/font/open-sans/OpenSans-Bold.ttf +0 -0
- package/payload/projects/tauri/ui/basic/font/open-sans/OpenSans-Regular.ttf +0 -0
- package/payload/projects/tauri/ui/basic/scroll-bar.min.js +3 -0
- package/payload/projects/tauri/ui/comp/_sources.txt +9 -0
- package/payload/projects/tauri/ui/comp/components.min.js +21 -0
- package/payload/projects/tauri/ui/index.html +28 -0
- package/payload/projects/tauri/ui/sizes.js +104 -0
- package/payload/starter/_basic/VERSION +1 -1
- package/payload/starter/_basic/comp/bottom-bar.js +31 -3
- package/payload/starter/_basic/comp/code-editor.js +219 -1
- package/payload/starter/_basic/comp/context-menu.js +6 -1
- package/payload/starter/_basic/comp/markdown-view.js +4 -2
- package/payload/starter/_basic/comp/phone-field.js +13 -5
- package/payload/starter/_basic/comp/property-panel.js +1 -1
- package/payload/starter/_basic/comp/slider.js +27 -12
- package/payload/starter/_basic/comp/smart-button.js +5 -1
- package/payload/starter/_basic/comp/smart-table.js +8 -1
- package/payload/starter/_basic/comp/stepper.js +29 -3
- package/payload/starter/_basic/comp/toggle.js +2 -1
- package/payload/starter/_basic/docs/component-index.md +53 -53
- package/payload/starter/_basic/examples/code-editor.htm +48 -1
- package/payload/starter/_basic/examples/gallery-styled.htm +896 -0
- package/payload/starter/_basic/examples/search-input.htm +1 -1
- package/payload/starter/_basic/examples/select-box-2-item-view.htm +304 -0
- package/payload/starter/_basic/examples/{slider-2-classic.htm → slider-2-split.htm} +36 -2
- package/payload/starter/_basic/examples/stepper-2.htm +22 -6
- package/payload/starter/_basic/min/bottom-bar.min.js +1 -1
- package/payload/starter/_basic/min/code-editor.min.js +1 -1
- package/payload/starter/_basic/min/context-menu.min.js +1 -1
- package/payload/starter/_basic/min/markdown-view.min.js +1 -1
- package/payload/starter/_basic/min/phone-field.min.js +1 -1
- package/payload/starter/_basic/min/slider.min.js +1 -1
- package/payload/starter/_basic/min/smart-button.min.js +1 -1
- package/payload/starter/_basic/min/smart-table.min.js +1 -1
- package/payload/starter/_basic/min/stepper.min.js +1 -1
- package/payload/starter/_basic/min/toggle.min.js +1 -1
- package/payload/starter/_basic/tools/check.js +13 -2
|
@@ -7,7 +7,8 @@ CodeEditor - v26.11
|
|
|
7
7
|
UI COMPONENT
|
|
8
8
|
- A text editor for code: line numbers, colors by language, the line of the cursor. A long line does not wrap: the
|
|
9
9
|
view scrolls sideways.
|
|
10
|
-
- Languages: "python", "javascript", "json", "html", "css", "sql", "bash", "text". CodeEditor.languages
|
|
10
|
+
- Languages: "python", "javascript", "go", "ruby", "json", "html", "css", "sql", "bash", "text". CodeEditor.languages
|
|
11
|
+
takes your own.
|
|
11
12
|
- The typing is the <textarea> of the browser: selection, copy, paste, undo and the input of every language work as
|
|
12
13
|
they do everywhere. The colors are drawn behind it, only for the lines that are seen, so a file of 100000 lines stays
|
|
13
14
|
fast.
|
|
@@ -847,6 +848,204 @@ CodeEditor.tokenizeHtml = function (text, state) {
|
|
|
847
848
|
return { parts: parts, state: openState };
|
|
848
849
|
};
|
|
849
850
|
|
|
851
|
+
// Ruby has its own parts: :symbols, font_size: values, @variables, #{} in a string, %w[] lists, heredocs and
|
|
852
|
+
// =begin comments. state: "=end" (a =begin comment), "<<~END" or "<<END" (a heredoc and the word that ends it;
|
|
853
|
+
// "~": that word may be indented), "%]" (a %w[ list and its closing letter).
|
|
854
|
+
CodeEditor.RUBY_CLOSERS = { "[": "]", "(": ")", "{": "}", "<": ">" };
|
|
855
|
+
CodeEditor.RUBY_HEREDOC = /^<<([~-]?)(["'`]?)([A-Za-z_]\w*)\2/;
|
|
856
|
+
CodeEditor.RUBY_PERCENT = /^%([wWiIqQ]?)([[({<|!\/])/;
|
|
857
|
+
CodeEditor.RUBY_SYMBOL = /^:[\p{L}_][\p{L}\p{N}_]*[?!]?/u;
|
|
858
|
+
CodeEditor.RUBY_VARIABLE = /^(@@?|\$)[\p{L}_][\p{L}\p{N}_]*/u;
|
|
859
|
+
|
|
860
|
+
CodeEditor.tokenizeRuby = function (text, state) {
|
|
861
|
+
const definition = CodeEditor.languages.ruby;
|
|
862
|
+
CodeEditor.prepareDefinition(definition);
|
|
863
|
+
const parts = [];
|
|
864
|
+
const add = function (kind, value) {
|
|
865
|
+
if (value.length === 0) return;
|
|
866
|
+
const last = parts[parts.length - 1];
|
|
867
|
+
if (last && last[0] === kind) last[1] += value;
|
|
868
|
+
else parts.push([kind, value]);
|
|
869
|
+
};
|
|
870
|
+
let index = 0;
|
|
871
|
+
let openState = state;
|
|
872
|
+
let heredocState = null; // WHY: the text of a heredoc starts on the next line, the rest of this line is code
|
|
873
|
+
let previousWord = "";
|
|
874
|
+
|
|
875
|
+
// A "..." or `...` string: the code in #{} is colored as code. Returns the index after it, -1: it goes on.
|
|
876
|
+
const readInterpolated = function (from, mark) {
|
|
877
|
+
let start = from;
|
|
878
|
+
let at = from + 1;
|
|
879
|
+
while (at < text.length) {
|
|
880
|
+
if (text[at] === "\\") {
|
|
881
|
+
at += 2;
|
|
882
|
+
continue;
|
|
883
|
+
}
|
|
884
|
+
if (text[at] === mark) {
|
|
885
|
+
add("string", text.slice(start, at + 1));
|
|
886
|
+
return at + 1;
|
|
887
|
+
}
|
|
888
|
+
const close = (text.startsWith("#{", at)) ? CodeEditor.findRubyBraceEnd(text, at + 2) : -1;
|
|
889
|
+
if (close < 0) {
|
|
890
|
+
at++;
|
|
891
|
+
continue;
|
|
892
|
+
}
|
|
893
|
+
add("string", text.slice(start, at));
|
|
894
|
+
add("variable", "#{");
|
|
895
|
+
CodeEditor.tokenizeRuby(text.slice(at + 2, close), null).parts.forEach(function (part) { add(part[0], part[1]); });
|
|
896
|
+
add("variable", "}");
|
|
897
|
+
at = close + 1;
|
|
898
|
+
start = at;
|
|
899
|
+
}
|
|
900
|
+
add("string", text.slice(start));
|
|
901
|
+
return -1;
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
// WHAT IS STILL OPEN from the lines before
|
|
905
|
+
if (openState === "=end") {
|
|
906
|
+
add("comment", text);
|
|
907
|
+
return { parts: parts, state: (/^=end\b/.test(text)) ? null : "=end" };
|
|
908
|
+
}
|
|
909
|
+
if (openState && openState.startsWith("<<")) {
|
|
910
|
+
const isIndented = (openState[2] === "~");
|
|
911
|
+
const endWord = openState.slice((isIndented) ? 3 : 2);
|
|
912
|
+
const isEnd = ((isIndented) ? text.trim() : text) === endWord;
|
|
913
|
+
add("string", text);
|
|
914
|
+
return { parts: parts, state: (isEnd) ? null : openState };
|
|
915
|
+
}
|
|
916
|
+
if (openState && openState.startsWith("%")) {
|
|
917
|
+
const end = CodeEditor.findStringEnd(text, 0, openState[1]);
|
|
918
|
+
if (end < 0) {
|
|
919
|
+
add("string", text);
|
|
920
|
+
return { parts: parts, state: openState };
|
|
921
|
+
}
|
|
922
|
+
add("string", text.slice(0, end));
|
|
923
|
+
index = end;
|
|
924
|
+
openState = null;
|
|
925
|
+
}
|
|
926
|
+
if (/^=begin\b/.test(text)) {
|
|
927
|
+
add("comment", text);
|
|
928
|
+
return { parts: parts, state: "=end" };
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
while (index < text.length) {
|
|
932
|
+
const rest = text.slice(index);
|
|
933
|
+
const letter = text[index];
|
|
934
|
+
const before = text.slice(0, index).trimEnd();
|
|
935
|
+
const isAfterValue = /[\p{L}\p{N}_)\]}]$/u.test(before); // WHY: "a %(b)" is a remainder after a value
|
|
936
|
+
|
|
937
|
+
if (letter === "#") {
|
|
938
|
+
add("comment", rest);
|
|
939
|
+
break;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
if (letter === '"' || letter === "`") {
|
|
943
|
+
const end = readInterpolated(index, letter);
|
|
944
|
+
if (end < 0) break;
|
|
945
|
+
index = end;
|
|
946
|
+
continue;
|
|
947
|
+
}
|
|
948
|
+
|
|
949
|
+
if (letter === "'") {
|
|
950
|
+
const end = CodeEditor.findStringEnd(text, index + 1, "'");
|
|
951
|
+
const stop = (end < 0) ? text.length : end;
|
|
952
|
+
add("string", text.slice(index, stop));
|
|
953
|
+
index = stop;
|
|
954
|
+
continue;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
const percent = CodeEditor.RUBY_PERCENT.exec(rest);
|
|
958
|
+
if (percent && (percent[1] || !isAfterValue)) {
|
|
959
|
+
const closer = CodeEditor.RUBY_CLOSERS[percent[2]] || percent[2];
|
|
960
|
+
const end = CodeEditor.findStringEnd(text, index + percent[0].length, closer);
|
|
961
|
+
if (end < 0) {
|
|
962
|
+
add("string", rest);
|
|
963
|
+
openState = "%" + closer;
|
|
964
|
+
break;
|
|
965
|
+
}
|
|
966
|
+
add("string", text.slice(index, end));
|
|
967
|
+
index = end;
|
|
968
|
+
continue;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
const heredoc = CodeEditor.RUBY_HEREDOC.exec(rest);
|
|
972
|
+
const isHeredoc = heredoc && (heredoc[1] || /^[A-Z_]+$/.test(heredoc[3])); // WHY: "list <<item" appends
|
|
973
|
+
if (isHeredoc) {
|
|
974
|
+
add("string", heredoc[0]);
|
|
975
|
+
if (!heredocState) heredocState = "<<" + ((heredoc[1]) ? "~" : "") + heredoc[3];
|
|
976
|
+
index += heredoc[0].length;
|
|
977
|
+
continue;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
if (rest.startsWith("::")) {
|
|
981
|
+
add("", "::");
|
|
982
|
+
index += 2;
|
|
983
|
+
continue;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
const isAfterWord = (index > 0 && CodeEditor.WORD_LETTER.test(text[index - 1]));
|
|
987
|
+
const symbol = (isAfterWord) ? null : CodeEditor.RUBY_SYMBOL.exec(rest); // WHY: "puts :name", not "a:b"
|
|
988
|
+
if (symbol) {
|
|
989
|
+
add("property", symbol[0]);
|
|
990
|
+
index += symbol[0].length;
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
const variable = CodeEditor.RUBY_VARIABLE.exec(rest);
|
|
995
|
+
if (variable) {
|
|
996
|
+
add("variable", variable[0]);
|
|
997
|
+
index += variable[0].length;
|
|
998
|
+
continue;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
const numberMatch = (isAfterWord) ? null : CodeEditor.NUMBER.exec(rest);
|
|
1002
|
+
if (numberMatch) {
|
|
1003
|
+
add("number", numberMatch[0]);
|
|
1004
|
+
index += numberMatch[0].length;
|
|
1005
|
+
continue;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
const wordMatch = CodeEditor.WORD.exec(rest);
|
|
1009
|
+
if (wordMatch) {
|
|
1010
|
+
const mark = /^[?!](?!=)/.exec(rest.slice(wordMatch[0].length)); // empty?, save!
|
|
1011
|
+
const word = wordMatch[0] + ((mark) ? mark[0] : "");
|
|
1012
|
+
const after = rest.slice(word.length);
|
|
1013
|
+
const kind = CodeEditor.kindOfRubyWord(word, after, previousWord, definition);
|
|
1014
|
+
const value = (kind === "property") ? word + ":" : word;
|
|
1015
|
+
add(kind, value);
|
|
1016
|
+
index += value.length;
|
|
1017
|
+
previousWord = word;
|
|
1018
|
+
continue;
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
add("", letter);
|
|
1022
|
+
index++;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
return { parts: parts, state: openState || heredocState };
|
|
1026
|
+
};
|
|
1027
|
+
|
|
1028
|
+
// The index of the "}" that closes a #{ (from: after it). -1: not on this line.
|
|
1029
|
+
CodeEditor.findRubyBraceEnd = function (text, from) {
|
|
1030
|
+
let depth = 1;
|
|
1031
|
+
for (let at = from; at < text.length; at++) {
|
|
1032
|
+
if (text[at] === "{") depth++;
|
|
1033
|
+
if (text[at] === "}") depth--;
|
|
1034
|
+
if (depth === 0) return at;
|
|
1035
|
+
}
|
|
1036
|
+
return -1;
|
|
1037
|
+
};
|
|
1038
|
+
|
|
1039
|
+
// The kind of a Ruby word: font_size: is a named value, the word after def a function, a capital a constant.
|
|
1040
|
+
CodeEditor.kindOfRubyWord = function (word, restOfLine, previousWord, definition) {
|
|
1041
|
+
if (/^:(?!:)/.test(restOfLine)) return "property";
|
|
1042
|
+
if (definition.keywordSet.has(word)) return "keyword";
|
|
1043
|
+
if (definition.builtinSet.has(word)) return "builtin";
|
|
1044
|
+
if (previousWord === "def" || /^\(/.test(restOfLine)) return "function";
|
|
1045
|
+
if (/^\p{Lu}/u.test(word)) return "builtin";
|
|
1046
|
+
return "";
|
|
1047
|
+
};
|
|
1048
|
+
|
|
850
1049
|
// *** LANGUAGES:
|
|
851
1050
|
CodeEditor.languages = {
|
|
852
1051
|
|
|
@@ -876,6 +1075,25 @@ CodeEditor.languages = {
|
|
|
876
1075
|
indentAfter: "{[(",
|
|
877
1076
|
},
|
|
878
1077
|
|
|
1078
|
+
go: {
|
|
1079
|
+
lineComment: "//",
|
|
1080
|
+
blockComment: ["/*", "*/"],
|
|
1081
|
+
strings: ['"', "'", "`"],
|
|
1082
|
+
multiLineStrings: ["`"],
|
|
1083
|
+
keywords: ["break", "case", "chan", "const", "continue", "default", "defer", "else", "fallthrough", "false", "for", "func", "go", "goto", "if", "import", "interface", "iota", "map", "nil", "package", "range", "return", "select", "struct", "switch", "true", "type", "var"],
|
|
1084
|
+
builtins: ["any", "append", "bool", "byte", "cap", "clear", "close", "complex", "copy", "delete", "error", "float32", "float64", "int", "int8", "int16", "int32", "int64", "len", "make", "max", "min", "new", "panic", "print", "println", "recover", "rune", "string", "uint", "uint8", "uint16", "uint32", "uint64", "uintptr"],
|
|
1085
|
+
callWords: 1,
|
|
1086
|
+
indentAfter: "{[(",
|
|
1087
|
+
},
|
|
1088
|
+
|
|
1089
|
+
ruby: {
|
|
1090
|
+
tokenize: CodeEditor.tokenizeRuby,
|
|
1091
|
+
lineComment: "#", // WHY: Ctrl + / comments the lines out with it
|
|
1092
|
+
keywords: ["BEGIN", "END", "__FILE__", "__LINE__", "__method__", "alias", "and", "attr_accessor", "attr_reader", "attr_writer", "begin", "break", "case", "class", "def", "defined?", "do", "else", "elsif", "end", "ensure", "extend", "false", "for", "if", "in", "include", "lambda", "loop", "module", "next", "nil", "not", "or", "prepend", "private", "proc", "protected", "public", "raise", "redo", "require", "require_relative", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless", "until", "when", "while", "yield"],
|
|
1093
|
+
builtins: ["Array", "Float", "Hash", "Integer", "String", "format", "gets", "print", "printf", "puts", "rand", "sleep", "sprintf"],
|
|
1094
|
+
indentAfter: "{[(|",
|
|
1095
|
+
},
|
|
1096
|
+
|
|
879
1097
|
json: {
|
|
880
1098
|
strings: ['"'],
|
|
881
1099
|
keywords: ["true", "false", "null"],
|
|
@@ -12,6 +12,8 @@ UI COMPONENT TEMPLATE
|
|
|
12
12
|
- "-" in the item list adds a separator line.
|
|
13
13
|
- Closes on: item click, click outside, Escape, mouse wheel outside, page resize, window blur.
|
|
14
14
|
- Keyboard: ArrowUp/ArrowDown to move, Enter or Space to click, Escape to close.
|
|
15
|
+
- The menu is made on the page (over everything), not in the group where ContextMenu() is called. A menu with one
|
|
16
|
+
target is removed with it; a menu of a list, of attachTo() or of openAt() is removed by the page (or obj.own(menu)).
|
|
15
17
|
- Submenus: an item with items: [...] has a › at its end. Its menu opens at its side on
|
|
16
18
|
hover, a click, Enter or ArrowRight (at the left when there is no room). ArrowLeft or Escape closes only the
|
|
17
19
|
submenu. A click on an item of a submenu closes every menu and calls onClick(self, item, index) of the menu
|
|
@@ -57,7 +59,7 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
57
59
|
const ContextMenuDefaults = {
|
|
58
60
|
key: "0",
|
|
59
61
|
items: [], // [{ text, key, iconFile, enabled, data, onClick }, "-", "Text"]
|
|
60
|
-
target: null, // An object (or a list of objects). The menu opens on it with the trigger.
|
|
62
|
+
target: null, // An object (or a list of objects). The menu opens on it with the trigger. One object: the menu is removed with it.
|
|
61
63
|
trigger: "contextmenu", // "contextmenu": Right click, "click": Left click
|
|
62
64
|
minWidth: 180,
|
|
63
65
|
maxWidth: 320, // Long texts are cut with "...". 0: No limit.
|
|
@@ -888,6 +890,9 @@ const ContextMenu = function (params = {}) {
|
|
|
888
890
|
if (box.target) {
|
|
889
891
|
const targets = Array.isArray(box.target) ? box.target : [box.target];
|
|
890
892
|
targets.forEach(function (obj) { box.attachTo(obj, box.trigger); });
|
|
893
|
+
// WHY: the menu is on the page, not in the group of its target, so it stayed when the target was removed (a
|
|
894
|
+
// page that draws its window again left one at every drawing). A list keeps it: one of its rows can go.
|
|
895
|
+
if (!Array.isArray(box.target)) box.target.own(box);
|
|
891
896
|
}
|
|
892
897
|
|
|
893
898
|
endObject(box);
|
|
@@ -14,8 +14,8 @@ UI COMPONENT
|
|
|
14
14
|
remotePictures: 1. A picture of the page and a data: address are always drawn.
|
|
15
15
|
- A text that comes piece by piece: appendText(). Only the blocks that changed are drawn again, and the view follows the end
|
|
16
16
|
until the reader scrolls up.
|
|
17
|
-
- Code: a button copies it. comp/code-editor.js, when it is loaded, gives it colors: "python", "javascript", "
|
|
18
|
-
"css", "sql", "bash" (and "py", "js", "sh"...).
|
|
17
|
+
- Code: a button copies it. comp/code-editor.js, when it is loaded, gives it colors: "python", "javascript", "go", "ruby",
|
|
18
|
+
"json", "html", "css", "sql", "bash" (and "py", "js", "rb", "sh"...).
|
|
19
19
|
- height: a number or "100%": the text scrolls inside it (basic/scroll-bar.js when it is loaded). "auto": it grows with its text.
|
|
20
20
|
- A click on a link: onLinkClick when it is given, else a new tab. A link to "#a-heading" goes to that heading of the text.
|
|
21
21
|
- Style packages: "light" (default), "dark". Select with styleName (MarkdownView.styles), or later with setTheme().
|
|
@@ -591,6 +591,8 @@ MarkdownView.LANGUAGE_NAMES = {
|
|
|
591
591
|
py: "python", python3: "python",
|
|
592
592
|
js: "javascript", jsx: "javascript", ts: "javascript", tsx: "javascript", typescript: "javascript", node: "javascript",
|
|
593
593
|
sh: "bash", shell: "bash", zsh: "bash", console: "bash",
|
|
594
|
+
golang: "go",
|
|
595
|
+
rb: "ruby",
|
|
594
596
|
htm: "html", xml: "html", svg: "html",
|
|
595
597
|
};
|
|
596
598
|
MarkdownView.MAX_COLORED_LETTERS = 200000; // WHY: A longer code stays plain: a stream must not wait for the colors.
|
|
@@ -73,16 +73,24 @@ const PhoneField = function(params = {}) {
|
|
|
73
73
|
return box.countryCode + box.phoneMask;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
// The
|
|
76
|
+
// The place of the first empty digit (the first "_"), or the end when the number is full.
|
|
77
|
+
const getFirstEmptyDigitPos = function() {
|
|
78
|
+
const firstUnderscore = inputElem.value.indexOf("_");
|
|
79
|
+
return (firstUnderscore !== -1) ? firstUnderscore : inputElem.value.length;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// The cursor goes to the first empty digit.
|
|
77
83
|
const setCursorToFirstUnderscore = function() {
|
|
78
84
|
if (!inputElem) return;
|
|
79
|
-
|
|
80
|
-
if (inputElem.selectionStart === firstUnderscore) return;
|
|
85
|
+
if (inputElem.selectionStart === inputElem.value.indexOf("_")) return;
|
|
81
86
|
|
|
82
|
-
const cursorPos = (
|
|
87
|
+
const cursorPos = getFirstEmptyDigitPos();
|
|
83
88
|
inputElem.setSelectionRange(cursorPos, cursorPos); // WHY: the caret must not jump to the end first.
|
|
84
89
|
box.after(0, () => {
|
|
85
|
-
|
|
90
|
+
// WHY the place again, not cursorPos: on a slow computer a key typed before this timer moved the first "_",
|
|
91
|
+
// and the old place put the next digit in the middle ("5550102030" became "+1 (535) 501-0200")
|
|
92
|
+
const cursorPosNow = getFirstEmptyDigitPos();
|
|
93
|
+
inputElem.setSelectionRange(cursorPosNow, cursorPosNow); // WHY: this moves the caret (after the browser moved it).
|
|
86
94
|
});
|
|
87
95
|
};
|
|
88
96
|
|
|
@@ -1762,7 +1762,7 @@ const PropertyPanel = function (params = {}) {
|
|
|
1762
1762
|
});
|
|
1763
1763
|
|
|
1764
1764
|
// WHY the shown text: the % field wrote the value at every blur, also with no change (and after Escape):
|
|
1765
|
-
// "transparent" became "rgba(0, 0, 0, 0)", "rgb(55, 56, 54)" "#373836", and basic
|
|
1765
|
+
// "transparent" became "rgba(0, 0, 0, 0)", "rgb(55, 56, 54)" "#373836", and basic.js Designer got a change
|
|
1766
1766
|
// the user did not make. The number field has the same check.
|
|
1767
1767
|
alphaEl.addEventListener("blur", function () {
|
|
1768
1768
|
const parts = splitAlpha(api.getValue());
|
|
@@ -6,7 +6,7 @@ Slider - v26.11
|
|
|
6
6
|
|
|
7
7
|
UI COMPONENT TEMPLATE
|
|
8
8
|
- NEW PROJECTS: a page or a project that needs a slider uses this component with styleName
|
|
9
|
-
"round" (_basic/examples/slider.htm), unless the user asks for another look. "
|
|
9
|
+
"round" (_basic/examples/slider.htm), unless the user asks for another look. "split" stays the default
|
|
10
10
|
of the file, for the pages made before. On a dark page: "roundDark". SliderField (comp/slider-field.js, a
|
|
11
11
|
slider in the shape of a field) is a parallel design: only when a page asks for that shape.
|
|
12
12
|
- A value from minValue to maxValue (0 - 100 by default) on a step (1), chosen by dragging the thumb. The value
|
|
@@ -19,9 +19,10 @@ UI COMPONENT TEMPLATE
|
|
|
19
19
|
a ring around the thumb only for the keyboard (style.focus).
|
|
20
20
|
- A key, a tap and a click on the track are short drags for the page: onChangeStart(self), onChange(self),
|
|
21
21
|
onChangeEnd(self), so a page that saves in onChangeEnd saves them too.
|
|
22
|
-
- Style packages: "
|
|
23
|
-
a thin line for the thumb, a dot at the end), "
|
|
24
|
-
and phone sliders; a ring in the track color while it is dragged) and
|
|
22
|
+
- Style packages: "split" (the default: inspired by Google Material 3: a thick track split in two at the
|
|
23
|
+
thumb, a thin line for the thumb, a dot at the end), "splitDark" (split for a dark page), "round" (a thin track and
|
|
24
|
+
a round white knob: the look of most web and phone sliders; a ring in the track color while it is dragged) and
|
|
25
|
+
"roundDark" (round for a dark page).
|
|
25
26
|
Select with styleName. (Slider.styles)
|
|
26
27
|
The colors and the height of the track stay params (trackColor, trackHeight...): a package fills the ones the
|
|
27
28
|
page does not give, so Slider({ styleName: "round", trackColor: "tomato" }) is a tomato round slider.
|
|
@@ -71,9 +72,9 @@ const SliderDefaults = {
|
|
|
71
72
|
|
|
72
73
|
ariaLabel: "", // The name a screen reader says (Ex: "Volume"). "": none
|
|
73
74
|
|
|
74
|
-
styleName: "
|
|
75
|
-
style: { //
|
|
76
|
-
thumb: { // The part that is dragged: a line (
|
|
75
|
+
styleName: "split", // "split", "splitDark", "round", "roundDark", "minimal", "minimalDark" or a name added to Slider.styles
|
|
76
|
+
style: { // The split style package (default): inspired by Material 3
|
|
77
|
+
thumb: { // The part that is dragged: a line (split) or a knob (round)
|
|
77
78
|
areaWidth: 20, // px: the part that takes the mouse and the finger (the thumb is in its middle)
|
|
78
79
|
width: 4,
|
|
79
80
|
height: 0, // 0: as high as the slider
|
|
@@ -114,7 +115,7 @@ const SliderDefaults = {
|
|
|
114
115
|
|
|
115
116
|
const Slider = function(params = {}) {
|
|
116
117
|
|
|
117
|
-
// Merge style package: params.style > Slider.styles[styleName] > SliderDefaults.style (
|
|
118
|
+
// Merge style package: params.style > Slider.styles[styleName] > SliderDefaults.style (split)
|
|
118
119
|
basic.applyStylePackage(params, Slider.styles, SliderDefaults);
|
|
119
120
|
|
|
120
121
|
// Merge params:
|
|
@@ -294,7 +295,7 @@ const Slider = function(params = {}) {
|
|
|
294
295
|
return shadows.join(", ");
|
|
295
296
|
};
|
|
296
297
|
|
|
297
|
-
// While dragging: the look of style.dragging (
|
|
298
|
+
// While dragging: the look of style.dragging (split: a thinner thumb line, closer tracks) and the value bubble (showValueOnDrag).
|
|
298
299
|
// $isValueKept: at the end, the bubble stays for a while (a click on the track: it was there only for a moment).
|
|
299
300
|
const setIsDragging = function($isDragging, $isValueKept = false) {
|
|
300
301
|
isDragging = $isDragging;
|
|
@@ -479,7 +480,7 @@ const Slider = function(params = {}) {
|
|
|
479
480
|
that.cursor = "pointer";
|
|
480
481
|
that.setMotion("left 0.2s");
|
|
481
482
|
|
|
482
|
-
// BOX: Thumb line (
|
|
483
|
+
// BOX: Thumb line (split) or knob (round)
|
|
483
484
|
const thumbLineBox = Box({
|
|
484
485
|
top: 0,
|
|
485
486
|
width: _s.thumb.width,
|
|
@@ -709,13 +710,27 @@ const Slider = function(params = {}) {
|
|
|
709
710
|
// USAGE: Slider({ styleName: "round" })
|
|
710
711
|
// USAGE: Slider({ styleName: "round", trackColor: "tomato" }) // The colors and the height of the track are params.
|
|
711
712
|
// USAGE: Slider({ styleName: "round", style: { value: { color: "tomato" } } }) // Change only some keys.
|
|
712
|
-
// NOTE: A new package needs only the keys that differ from the default (
|
|
713
|
+
// NOTE: A new package needs only the keys that differ from the default (split) style.
|
|
713
714
|
// USAGE: Slider.styles.myStyle = { trackColor: "tomato", style: { trackDot: { size: 0 } } };
|
|
714
715
|
Slider.styles = {
|
|
715
716
|
|
|
716
717
|
// Inspired by Google Material 3: a thick track in two parts with a space at the thumb, a thin line for the
|
|
717
718
|
// thumb (thinner while it is dragged), a dot at the end of the empty track.
|
|
718
|
-
|
|
719
|
+
split: SliderDefaults.style,
|
|
720
|
+
|
|
721
|
+
// The split look for a dark page: a light empty track, the main cyan of the kit, a light thumb line and a light
|
|
722
|
+
// value bubble with a dark text (a dark bubble was lost on the page).
|
|
723
|
+
splitDark: {
|
|
724
|
+
trackColor: "#5BBAC1",
|
|
725
|
+
trackBackgroundColor: White(0.12),
|
|
726
|
+
thumbColor: White(0.85),
|
|
727
|
+
style: {
|
|
728
|
+
value: {
|
|
729
|
+
color: "#F2F2F2",
|
|
730
|
+
textColor: "#232323",
|
|
731
|
+
},
|
|
732
|
+
},
|
|
733
|
+
},
|
|
719
734
|
|
|
720
735
|
// The look of most web and phone sliders: a thin round track, a round white knob with a soft
|
|
721
736
|
// shadow, a ring in the track color while it is dragged, a small value bubble. A package of params: the colors
|
|
@@ -36,7 +36,8 @@ The other samples: smart-button-alternatif.htm (pill and outlined with the color
|
|
|
36
36
|
- HEIGHT: 44 by default (40 looked narrow); every template, pill and outlined too. An icon on
|
|
37
37
|
top of a text makes it "auto" (as high as its padding and content).
|
|
38
38
|
- KEYBOARD AND ACCESSIBILITY: role "button", Tab reaches it, Enter / Space press it (Space when it goes up), a focus
|
|
39
|
-
ring only for the keyboard;
|
|
39
|
+
ring only for the keyboard; a click of the mouse does not take the focus (as the buttons of macOS: Enter and Space
|
|
40
|
+
stay with the page or the field that had them); ariaLabel for a button with only an icon (else labelText is read).
|
|
40
41
|
- setEnabled(0): no click, no hover, out of the Tab order (aria-disabled): a flat light gray button, a faint edge, no
|
|
41
42
|
bottom line, the text and the icon faint gray (the same for every color; chosen on
|
|
42
43
|
experimental/smart-button-bench.htm).
|
|
@@ -651,6 +652,9 @@ const SmartButton = function (params = {}) {
|
|
|
651
652
|
render();
|
|
652
653
|
});
|
|
653
654
|
box.on("mousedown", function (self, event) {
|
|
655
|
+
// WHY: a button clicked with the mouse kept the focus, and a later Enter pressed it again (a calculator that
|
|
656
|
+
// takes Enter as "=" pressed the clicked key too). The focus stays where it was.
|
|
657
|
+
event.preventDefault();
|
|
654
658
|
if (!canPress() || event.button !== 0) return; // WHY: a right click gives no click
|
|
655
659
|
isPressed = 1;
|
|
656
660
|
render();
|
|
@@ -52,6 +52,9 @@ SPDX-License-Identifier: Apache-2.0
|
|
|
52
52
|
with no language keeps "tr-TR". Ex: "en-US" -> 12,499, "tr-TR" -> 12.499. setLocale(locale).
|
|
53
53
|
- wheelScroll: 1: the mouse wheel scrolls the rows of the table (the page does not move). The default 0: the wheel scrolls the page; the rows move with the scroll bar and its buttons.
|
|
54
54
|
-- smartTable.setWheelScroll(1) turns it on later.
|
|
55
|
+
- The scroll buttons stand right of the table, outside its box (22 px: getVerticalScrollWidth()). The table keeps that
|
|
56
|
+
room: a width in percent is that much narrower, another width has a margin at its right, so in a group the next
|
|
57
|
+
object stands after the buttons. A table with a place of its own (left, top): leave the room yourself.
|
|
55
58
|
- allowHtml: 0 (default): the values of the cells are written as plain text (a name or a title a user wrote does not
|
|
56
59
|
run as HTML). 1: the values are written as HTML (Ex: "<b>12</b>"). Your own values written with cell.label.text in
|
|
57
60
|
createCellView / updateCellView are not touched.
|
|
@@ -1363,12 +1366,16 @@ const SmartTable = function (params = {}) {
|
|
|
1363
1366
|
// WHY: a number (width: 800) made .includes throw.
|
|
1364
1367
|
const isPercent = typeof width === "string" && width.includes("%");
|
|
1365
1368
|
|
|
1369
|
+
// The vertical scroll stands right of the table, outside its box: the table keeps that room for it.
|
|
1366
1370
|
if (!isPercent) {
|
|
1371
|
+
// WHY a margin: in a group the next object stood on the scroll (a table that takes the room that is
|
|
1372
|
+
// left, a table of 600 px next to a chart). A table with a place of its own is not moved by it.
|
|
1367
1373
|
box.width = width;
|
|
1374
|
+
box.css = { marginRight: box.getVerticalScrollWidth() + "px" };
|
|
1368
1375
|
return;
|
|
1369
1376
|
}
|
|
1370
1377
|
|
|
1371
|
-
|
|
1378
|
+
if (box.css.marginRight) box.css = { marginRight: "" }; // a width in px before
|
|
1372
1379
|
box.width = "calc(" + width + " - " + box.getVerticalScrollWidth() + "px)";
|
|
1373
1380
|
|
|
1374
1381
|
};
|
|
@@ -18,8 +18,8 @@ UI COMPONENT TEMPLATE
|
|
|
18
18
|
- A line around the buttons: style.button.border and borderColor (0 and "transparent" by default: no line).
|
|
19
19
|
- style.button.opacity (1) / disabledOpacity: a button that can / can not be clicked (at min / max). fadeDuration:
|
|
20
20
|
the time of the fade between them (s). 0: at once (the default).
|
|
21
|
-
- Style packages: "light" (default; the old name "classic" works too), "modern", "dark", "ozden". Select with styleName. (Stepper.styles)
|
|
22
|
-
-- "ozden": for a 600 px design.
|
|
21
|
+
- Style packages: "light" (default; the old name "classic" works too), "modern", "dark", "ozden", "ozdenDark". Select with styleName. (Stepper.styles)
|
|
22
|
+
-- "ozden": for a 600 px design. "ozdenDark": ozden on a dark page.
|
|
23
23
|
It is a package of params (basic.js v26.10.27): it also gives the size, 150 x 50.
|
|
24
24
|
|
|
25
25
|
USAGE:
|
|
@@ -65,7 +65,7 @@ const StepperDefaults = {
|
|
|
65
65
|
onChange: function (self) { }, // self.value
|
|
66
66
|
onMinReached: function (self) { }, // Called when the value arrives at min
|
|
67
67
|
onMaxReached: function (self) { }, // Called when the value arrives at max
|
|
68
|
-
styleName: "light", // "light" ("classic": its old name), "modern", "dark", "ozden", "minimal", "minimalDark" or a name added to Stepper.styles
|
|
68
|
+
styleName: "light", // "light" ("classic": its old name), "modern", "dark", "ozden", "ozdenDark", "minimal", "minimalDark" or a name added to Stepper.styles
|
|
69
69
|
style: { // Light style package (default)
|
|
70
70
|
box: {
|
|
71
71
|
color: White(1),
|
|
@@ -700,6 +700,32 @@ Stepper.styles = {
|
|
|
700
700
|
},
|
|
701
701
|
},
|
|
702
702
|
|
|
703
|
+
// ozden on a dark page: the same shape; the buttons in the ground of a dark card with a light line (on such a
|
|
704
|
+
// card they are rings, as the white buttons of ozden on white), a light value.
|
|
705
|
+
ozdenDark: {
|
|
706
|
+
width: 150,
|
|
707
|
+
height: 50, // WHY: 42 px buttons (50 - 2 x padding)
|
|
708
|
+
style: {
|
|
709
|
+
box: { color: "transparent", border: 0, round: 100, padding: 4 },
|
|
710
|
+
button: {
|
|
711
|
+
width: 42,
|
|
712
|
+
color: "#232322",
|
|
713
|
+
hoverColor: "#2E2E2D",
|
|
714
|
+
activeColor: "#393938",
|
|
715
|
+
border: 1,
|
|
716
|
+
borderColor: "rgba(255, 255, 255, 0.8)",
|
|
717
|
+
round: 21,
|
|
718
|
+
iconColor: "rgba(255, 255, 255, 0.7)",
|
|
719
|
+
iconSize: 24, // WHY: a + 16 px long, with a 2.7 px line
|
|
720
|
+
opacity: 0.9, // the line and the icon are a little softer
|
|
721
|
+
disabledOpacity: 0.4,
|
|
722
|
+
fadeDuration: 0.2,
|
|
723
|
+
},
|
|
724
|
+
value: { fontSize: 22, textColor: "rgba(255, 255, 255, 0.88)", fontFamily: "" },
|
|
725
|
+
input: { color: "rgba(255, 255, 255, 0.06)", textColor: "rgba(255, 255, 255, 0.88)" },
|
|
726
|
+
},
|
|
727
|
+
},
|
|
728
|
+
|
|
703
729
|
};
|
|
704
730
|
Stepper.styles.classic = Stepper.styles.light; // the old name of light: the pages made with it keep their look
|
|
705
731
|
|
|
@@ -20,7 +20,7 @@ UI COMPONENT TEMPLATE
|
|
|
20
20
|
-- A package is a package of params (basic.js v26.10.27): its keys fill the params you did not give, also the
|
|
21
21
|
keys inside backgroundStyle and buttonStyle (Ex: the classic package with your own selectedColor).
|
|
22
22
|
-- "float", "round", "slim", "outline", "square": other shapes, with their sizes, in soft colors
|
|
23
|
-
(the "Soft" palette of basic
|
|
23
|
+
(the "Soft" palette of basic.js Designer). "float": a knob bigger than its track, "round": a big knob, "slim": a low
|
|
24
24
|
track, "outline": a line around the track when off, "square": small corners.
|
|
25
25
|
-- "tick", "badge", "label": with marks. "tick": a check or a cross on the track, "badge": in the knob, on a green or
|
|
26
26
|
red track, "label": ON / OFF on the track, small corners.
|
|
@@ -496,6 +496,7 @@ Toggle.styles = {
|
|
|
496
496
|
offMark: "OFF", // Shows when off
|
|
497
497
|
backgroundStyle: { color: "black", selectedColor: "#2C5A38", borderColor: White(0.25) },
|
|
498
498
|
buttonStyle: { color: White(0.25), selectedColor: White(0.75) },
|
|
499
|
+
markStyle: { color: White(0.6) }, // WHY: OFF on the black track; the black of the default was not seen
|
|
499
500
|
},
|
|
500
501
|
|
|
501
502
|
// The light look of the kit (_designs/toggle.htm): a flat gray pill that turns to the accent, a white knob of the
|