From 337c31ac1bee82b743d79803400002ca49e27b38 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:29:17 +0200 Subject: [PATCH 01/39] feature: smalltalk: auto-globals v3.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5501812..cb4ef8c 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "url": "https://github.com/coderaiser/smalltalk/issues" }, "devDependencies": { - "auto-globals": "^2.0.0", + "auto-globals": "^3.0.0", "autoprefixer": "^10.0.1", "c8": "^7.11.3", "clean-css-loader": "^4.1.1", From 383d1245ef124d2adfd8ee07ac1dcea344d01c19 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:29:20 +0200 Subject: [PATCH 02/39] feature: smalltalk: c8 v8.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cb4ef8c..c4e595a 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "devDependencies": { "auto-globals": "^3.0.0", "autoprefixer": "^10.0.1", - "c8": "^7.11.3", + "c8": "^8.0.1", "clean-css-loader": "^4.1.1", "coveralls": "^3.0.0", "css-loader": "^6.7.1", From f7041ab1074fdeb074f89ad3107f546079c1e7fa Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:29:28 +0200 Subject: [PATCH 03/39] feature: smalltalk: supertape v8.8.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c4e595a..0949ca9 100644 --- a/package.json +++ b/package.json @@ -63,7 +63,7 @@ "putasset": "^6.0.0", "putout": "^26.24.0", "style-loader": "^3.3.1", - "supertape": "^7.6.0", + "supertape": "^8.8.0", "terser-webpack-plugin": "^5.0.0", "try-to-tape": "^1.1.0", "url-loader": "^4.0.0", From acc397f527453027b4a2db9eaf81603702c13a8d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:29:32 +0200 Subject: [PATCH 04/39] feature: smalltalk: putout v33.13.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0949ca9..399a5e8 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "madrun": "^9.0.5", "nodemon": "^2.0.1", "putasset": "^6.0.0", - "putout": "^26.24.0", + "putout": "^33.13.3", "style-loader": "^3.3.1", "supertape": "^8.8.0", "terser-webpack-plugin": "^5.0.0", From 924db6f891bafa8347c6d2a788be3d195964ff22 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:29:38 +0200 Subject: [PATCH 05/39] feature: smalltalk: eslint-plugin-putout v21.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 399a5e8..ca303c6 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "css-modules-require-hook": "^4.2.3", "eslint": "^8.19.0", "eslint-plugin-node": "^11.0.0", - "eslint-plugin-putout": "^15.8.0", + "eslint-plugin-putout": "^21.0.2", "madrun": "^9.0.5", "nodemon": "^2.0.1", "putasset": "^6.0.0", From cb46477a4a2fdcb678083f920f8396e49aa76bb4 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:29:43 +0200 Subject: [PATCH 06/39] feature: smalltalk: webpack-cli v5.1.4 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ca303c6..04bef82 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "url-loader": "^4.0.0", "version-io": "^4.0.1", "webpack": "^5.1.3", - "webpack-cli": "^4.0.0", + "webpack-cli": "^5.1.4", "wraptile": "^3.0.0" }, "dependencies": { From 0e0345f892c9a1f29462b672cac80e8e276d55e2 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:30:22 +0200 Subject: [PATCH 07/39] feature: smalltalk: nodemon v3.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 04bef82..490a186 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "eslint-plugin-node": "^11.0.0", "eslint-plugin-putout": "^21.0.2", "madrun": "^9.0.5", - "nodemon": "^2.0.1", + "nodemon": "^3.0.2", "putasset": "^6.0.0", "putout": "^33.13.3", "style-loader": "^3.3.1", From 64f0fc89de06f1e68634e4a8240c661743c78f68 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:30:31 +0200 Subject: [PATCH 08/39] fix: export --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 490a186..a10e3db 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "main": "lib/smalltalk.js", "exports": { - ".": "./lib/smalltalk", + ".": "./lib/smalltalk.js", "./bundle": "./dist/smalltalk.min.js" }, "scripts": { From 6c4b74a2a4836ae3c50771e3d3f01fba578dd592 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:30:56 +0200 Subject: [PATCH 09/39] feature: drop coveralls --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index a10e3db..11879b4 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,6 @@ "autoprefixer": "^10.0.1", "c8": "^8.0.1", "clean-css-loader": "^4.1.1", - "coveralls": "^3.0.0", "css-loader": "^6.7.1", "css-modules-require-hook": "^4.2.3", "eslint": "^8.19.0", From d4c899432f720aa6f8605af26e4199535b4a1f55 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:31:17 +0200 Subject: [PATCH 10/39] feature: smalltalk: postcss v8.4.32 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 11879b4..012dd41 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,6 @@ "name": "smalltalk", "version": "4.1.1", "type": "commonjs", - "commitType": "colon", "description": "Promise-based Alert, Confirm and Prompt replacement", "homepage": "http://github.com/coderaiser/smalltalk", "repository": { @@ -59,6 +58,7 @@ "eslint-plugin-putout": "^21.0.2", "madrun": "^9.0.5", "nodemon": "^3.0.2", + "postcss": "^8.4.32", "putasset": "^6.0.0", "putout": "^33.13.3", "style-loader": "^3.3.1", From 576021a2c28569e112bd8f96f1cfb39c6dab729d Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:34:13 +0200 Subject: [PATCH 11/39] chore: lint --- .bowerrc | 6 +- .eslintrc.json | 4 +- .madrun.mjs | 1 - .stylelintrc.yml | 25 +++---- README.md | 4 +- css/smalltalk.css | 7 +- lib/smalltalk.js | 57 +++++++++------ lib/smalltalk.native.js | 7 +- test/smalltalk.js | 153 ++++++++++++++++++++++----------------- test/smalltalk.native.js | 88 +++++++++++++--------- webpack.config.js | 6 +- 11 files changed, 200 insertions(+), 158 deletions(-) diff --git a/.bowerrc b/.bowerrc index 0ab1766..85967b5 100644 --- a/.bowerrc +++ b/.bowerrc @@ -1,3 +1,3 @@ -{ - "directory" : "modules" -} \ No newline at end of file +{ + "directory" : "modules" +} diff --git a/.eslintrc.json b/.eslintrc.json index 972b7f2..87e11ff 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -9,11 +9,11 @@ "key-spacing": "off" }, "extends": [ - "plugin:node/recommended", + "plugin:n/recommended", "plugin:putout/recommended" ], "plugins": [ - "node", + "n", "putout" ] } diff --git a/.madrun.mjs b/.madrun.mjs index bf5b3d6..3e4e8f8 100644 --- a/.madrun.mjs +++ b/.madrun.mjs @@ -26,4 +26,3 @@ export default { function upload(name) { return 'putasset -o coderaiser -r smalltalk -t v`version`' + ` -f ${name}`; } - diff --git a/.stylelintrc.yml b/.stylelintrc.yml index c2ff2e6..6b85a36 100644 --- a/.stylelintrc.yml +++ b/.stylelintrc.yml @@ -1,15 +1,14 @@ extends: stylelint-config-standard rules: - indentation: 4 - declaration-block-trailing-semicolon: always - declaration-colon-space-before: null - selector-list-comma-newline-after: null - comment-empty-line-before: null - number-leading-zero: null - number-no-trailing-zeros: null - string-quotes: single - function-url-quotes: never - no-eol-whitespace: null - declaration-empty-line-before: null - max-empty-lines: 2 - + indentation: 4 + declaration-block-trailing-semicolon: always + declaration-colon-space-before: null + selector-list-comma-newline-after: null + comment-empty-line-before: null + number-leading-zero: null + number-no-trailing-zeros: null + string-quotes: single + function-url-quotes: never + no-eol-whitespace: null + declaration-empty-line-before: null + max-empty-lines: 2 diff --git a/README.md b/README.md index 20c2b76..a882d53 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,6 @@ const smalltalk = require('smalltalk/native'); When you need a bundled verseion use - ```js import smalltalk from 'smalltalk/bundle'; ``` @@ -102,7 +101,8 @@ smalltalk ```js const progress = smalltalk.progress('Cloud Commander', 'Copy /home/coderaiser -> /home/coderaiser/2'); -progress.setProgress(41) +progress + .setProgress(41) .catch(() => { console.log('abort'); }); diff --git a/css/smalltalk.css b/css/smalltalk.css index a88bd0f..9d7b317 100644 --- a/css/smalltalk.css +++ b/css/smalltalk.css @@ -7,13 +7,10 @@ transition: 200ms opacity; - bottom: 0; - left: 0; + inset: 0; overflow: auto; padding: 20px; position: fixed; - right: 0; - top: 0; z-index: 100; } @@ -33,7 +30,7 @@ z-index: 0; } -@media only screen and (max-width: 500px) { +@media only screen and (width <= 500px) { .smalltalk .page { min-width: 0; } diff --git a/lib/smalltalk.js b/lib/smalltalk.js index a655c5e..ee40335 100644 --- a/lib/smalltalk.js +++ b/lib/smalltalk.js @@ -21,29 +21,28 @@ const BUTTON_OK_CANCEL = { const zIndex = store(100); -exports.alert = (title, msg, options) => { +module.exports.alert = (title, msg, options) => { const buttons = getButtons(options) || BUTTON_OK; return showDialog(title, msg, '', buttons, options); }; -exports.prompt = (title, msg, value = '', options) => { +module.exports.prompt = (title, msg, value = '', options) => { const type = getType(options); - const val = String(value) - .replace(/"/g, '"'); + const val = String(value).replace(/"/g, '"'); - const valueStr = ``; + const valueStr = ``; const buttons = getButtons(options) || BUTTON_OK_CANCEL; return showDialog(title, msg, valueStr, buttons, options); }; -exports.confirm = (title, msg, options) => { +module.exports.confirm = (title, msg, options) => { const buttons = getButtons(options) || BUTTON_OK_CANCEL; return showDialog(title, msg, '', buttons, options); }; -exports.progress = (title, message, options) => { +module.exports.progress = (title, message, options) => { const valueStr = ` 0% @@ -106,8 +105,8 @@ function getTemplate(title, msg, value, buttons) { return `
-
${ title }
-
${ encodedMsg }${ value }
+
${title}
+
${encodedMsg}${value}
${parseButtons(buttons)} @@ -170,6 +169,7 @@ function showDialog(title, msg, value, buttons, options) { for (const event of ['click', 'contextmenu']) dialog.addEventListener(event, (e) => { e.stopPropagation(); + for (const el of find(dialog, ['ok', 'input'])) el.focus(); }); @@ -184,21 +184,24 @@ function showDialog(title, msg, value, buttons, options) { function keyDown_(dialog, ok, cancel, event) { const KEY = { - ENTER : 13, - ESC : 27, - TAB : 9, - LEFT : 37, - UP : 38, - RIGHT : 39, - DOWN : 40, + ENTER: 13, + ESC: 27, + TAB: 9, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, }; const {keyCode} = event; const el = event.target; - const namesAll = ['ok', 'cancel', 'input']; - const names = find(dialog, namesAll) - .map(getDataName); + const namesAll = [ + 'ok', + 'cancel', + 'input', + ]; + const names = find(dialog, namesAll).map(getDataName); switch(keyCode) { case KEY.ENTER: @@ -220,9 +223,16 @@ function keyDown_(dialog, ok, cancel, event) { break; default: - ['left', 'right', 'up', 'down'].filter((name) => keyCode === KEY[name.toUpperCase()]).forEach(() => { - changeButtonFocus(dialog, names); - }); + [ + 'left', + 'right', + 'up', + 'down', + ] + .filter((name) => keyCode === KEY[name.toUpperCase()]) + .forEach(() => { + changeButtonFocus(dialog, names); + }); break; } @@ -302,7 +312,7 @@ function closeDialog(el, dialog, ok, cancel) { remove(dialog); } -const query = currify((element, name) => element.querySelector(`[data-name="js-${ name }"]`)); +const query = currify((element, name) => element.querySelector(`[data-name="js-${name}"]`)); function find(element, names) { const elements = names @@ -324,4 +334,3 @@ function remove(dialog) { if (parentElement) parentElement.removeChild(dialog); } - diff --git a/lib/smalltalk.native.js b/lib/smalltalk.native.js index a5bbeb9..3e94461 100644 --- a/lib/smalltalk.native.js +++ b/lib/smalltalk.native.js @@ -2,7 +2,7 @@ require('../css/smalltalk.css'); -exports.alert = (title, message) => { +module.exports.alert = (title, message) => { const promise = new Promise((resolve) => { alert(message); resolve(); @@ -11,7 +11,7 @@ exports.alert = (title, message) => { return promise; }; -exports.prompt = (title, message, value, options) => { +module.exports.prompt = (title, message, value, options) => { const o = options; const promise = new Promise((resolve, reject) => { const noCancel = o && !o.cancel; @@ -29,7 +29,7 @@ exports.prompt = (title, message, value, options) => { return promise; }; -exports.confirm = (title, message, options) => { +module.exports.confirm = (title, message, options) => { const o = options; const noCancel = o && !o.cancel; const promise = new Promise((resolve, reject) => { @@ -46,4 +46,3 @@ exports.confirm = (title, message, options) => { return promise; }; - diff --git a/test/smalltalk.js b/test/smalltalk.js index c5b64a2..6fcfb15 100644 --- a/test/smalltalk.js +++ b/test/smalltalk.js @@ -1,26 +1,26 @@ 'use strict'; -const path = require('path'); +const {join} = require('node:path'); +const process = require('node:process'); const fs = require('fs'); require('css-modules-require-hook/preset'); const autoGlobals = require('auto-globals'); const tape = require('supertape'); -const stub = require('@cloudcmd/stub'); const currify = require('currify'); const wraptile = require('wraptile'); global.window = {}; -const {UPDATE_FIXTURE} = process.env; - const smalltalk = require('../lib/smalltalk'); +const {UPDATE_FIXTURE} = process.env; const noop = () => {}; const isUpdateFixtures = UPDATE_FIXTURE === 'true' || UPDATE_FIXTURE === '1'; const {create} = autoGlobals; const test = autoGlobals(tape); -const fixtureDir = path.join(__dirname, 'fixture'); +const fixtureDir = join(__dirname, 'fixture'); +const {stub} = tape; const writeFixture = (name, data) => { return fs.writeFileSync(`${fixtureDir}/${name}.html`, data); @@ -28,6 +28,7 @@ const writeFixture = (name, data) => { const readFixture = (name) => { const fn = () => fs.readFileSync(`${fixtureDir}/${name}.html`, 'utf8'); + fn.update = !isUpdateFixtures ? noop : currify(writeFixture, name); return fn; @@ -88,16 +89,18 @@ test('smalltalk: alert: click', (t, {document}) => { createElement.returns(el); smalltalk.alert('title', 'message'); - t.equal(ok.addEventListener.args.pop()[0], 'click', 'should set click listener'); + const result = ok + .addEventListener + .args + .pop()[0]; + + t.equal(result, 'click', 'should set click listener'); t.end(); }); test('smalltalk: alert: close: remove', (t, {document}) => { const parentElement = create(); - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const el = { ...create(), @@ -125,15 +128,16 @@ test('smalltalk: alert: close: remove', (t, {document}) => { target: ok, }); - t.equal(parentElement.removeChild.args.pop().pop(), el, 'should find smalltalk'); + t.equal(parentElement + .removeChild + .args + .pop() + .pop(), el, 'should find smalltalk'); t.end(); }); test('smalltalk: alert: keydown: stopPropagation', (t, {document}) => { - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const parentElement = create(); @@ -157,7 +161,11 @@ test('smalltalk: alert: keydown: stopPropagation', (t, {document}) => { smalltalk.alert('title', 'message'); - const [, keydown] = el.addEventListener.args.filter(([event]) => event === 'keydown').pop(); + const [, keydown] = el + .addEventListener + .args + .filter(([event]) => event === 'keydown') + .pop(); const event = { stopPropagation: stub(), @@ -170,10 +178,7 @@ test('smalltalk: alert: keydown: stopPropagation', (t, {document}) => { }); test('smalltalk: alert: click: stopPropagation: called', (t, {document}) => { - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const parentElement = create(); const el = { @@ -196,10 +201,14 @@ test('smalltalk: alert: click: stopPropagation: called', (t, {document}) => { smalltalk.alert('title', 'message'); - const [, click] = el.addEventListener.args.filter((a) => { - const [event] = a; - return event === 'click'; - }).pop(); + const [, click] = el + .addEventListener + .args + .filter((a) => { + const [event] = a; + return event === 'click'; + }) + .pop(); const event = { stopPropagation: stub(), @@ -243,7 +252,9 @@ test('smalltalk: alert: keydown: tab: preventDefault', (t, {document}) => { smalltalk.alert('title', 'message'); - const [, keydown] = el.addEventListener.args + const [, keydown] = el + .addEventListener + .args .filter(([event]) => event === 'keydown') .pop(); @@ -286,7 +297,9 @@ test('smalltalk: alert: keydown: tab: active name', (t, {document}) => { smalltalk.alert('title', 'message'); - const [, keydown] = el.addEventListener.args + const [, keydown] = el + .addEventListener + .args .filter(([event]) => event === 'keydown') .pop(); @@ -335,7 +348,9 @@ test('smalltalk: alert: keydown: left: focus', (t) => { smalltalk.alert('title', 'message'); - const [, keydown] = el.addEventListener.args + const [, keydown] = el + .addEventListener + .args .filter(([event]) => event === 'keydown') .pop(); @@ -355,10 +370,7 @@ test('smalltalk: alert: keydown: left: focus', (t) => { }); test('smalltalk: alert: click: focus', (t, {document}) => { - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const parentElement = create(); const el = { @@ -381,7 +393,9 @@ test('smalltalk: alert: click: focus', (t, {document}) => { smalltalk.alert('title', 'message'); - const [, keydown] = el.addEventListener.args + const [, keydown] = el + .addEventListener + .args .filter(([event]) => event === 'click') .pop(); @@ -454,7 +468,8 @@ test('smalltalk: confirm: click on close', (t) => { document.createElement.returns(el); document.querySelector.returns(el); - smalltalk.confirm('title', 'message') + smalltalk + .confirm('title', 'message') .catch((e) => { t.ok(e, 'should reject'); t.end(); @@ -500,7 +515,9 @@ test('smalltalk: confirm: keydown: left: active name', (t, {document}) => { smalltalk.confirm('title', 'message'); - const [, keydown] = el.addEventListener.args + const [, keydown] = el + .addEventListener + .args .filter(([event]) => event === 'keydown') .pop(); @@ -559,7 +576,9 @@ test('smalltalk: confirm: keydown: left: active name: cancel', (t, {document}) = smalltalk.confirm('title', 'message'); - const [, keydown] = el.addEventListener.args + const [, keydown] = el + .addEventListener + .args .filter(([event]) => event === 'keydown') .pop(); @@ -580,10 +599,7 @@ test('smalltalk: confirm: keydown: left: active name: cancel', (t, {document}) = test('smalltalk: confirm: keydown: esc: reject', (t, {document}) => { const parentElement = create(); - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const el = { ...create(), @@ -603,13 +619,16 @@ test('smalltalk: confirm: keydown: esc: reject', (t, {document}) => { createElement.returns(el); querySelector.returns(el); - smalltalk.confirm('title', 'message') + smalltalk + .confirm('title', 'message') .catch((e) => { t.ok(e, 'should reject'); t.end(); }); - const [, keydown] = el.addEventListener.args + const [, keydown] = el + .addEventListener + .args .filter(([event]) => event === 'keydown') .pop(); @@ -627,10 +646,7 @@ test('smalltalk: confirm: keydown: esc: reject', (t, {document}) => { test('smalltalk: confirm: keydown: enter', (t, {document}) => { const parentElement = create(); - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const el = { ...create(), @@ -650,13 +666,16 @@ test('smalltalk: confirm: keydown: enter', (t, {document}) => { createElement.returns(el); querySelector.returns(el); - smalltalk.confirm('title', 'message') + smalltalk + .confirm('title', 'message') .then(() => { t.pass('should resolve'); t.end(); }); - const [, keydown] = el.addEventListener.args + const [, keydown] = el + .addEventListener + .args .filter(([event]) => event === 'keydown') .pop(); @@ -736,10 +755,7 @@ test('smalltalk: prompt: no value', (t, {document}) => { }); test('smalltalk: prompt: click on ok', (t, {document}) => { - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const dataName = (a) => `[data-name="js-${a}"]`; @@ -769,7 +785,8 @@ test('smalltalk: prompt: click on ok', (t, {document}) => { createElement.returns(el); querySelector.returns(el); - smalltalk.prompt('title', 'message', value) + smalltalk + .prompt('title', 'message', value) .then((result) => { t.equal(result, value, 'should return value'); t.end(); @@ -784,12 +801,10 @@ test('smalltalk: prompt: click on ok', (t, {document}) => { test('smalltalk: prompt: click on cancel', (t, {document}) => { const dataName = (a) => `[data-name="js-${a}"]`; - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const value = 'hello'; + const input = { ...create(), value, @@ -815,7 +830,8 @@ test('smalltalk: prompt: click on cancel', (t, {document}) => { createElement.returns(el); querySelector.returns(el); - smalltalk.prompt('title', 'message', value) + smalltalk + .prompt('title', 'message', value) .catch((e) => { t.ok(e, 'should reject'); t.end(); @@ -830,12 +846,10 @@ test('smalltalk: prompt: click on cancel', (t, {document}) => { test('smalltalk: prompt: click on cancel: cancel false', (t, {document}) => { const dataName = (a) => `[data-name="js-${a}"]`; - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const value = 'hello'; + const input = { ...create(), value, @@ -864,7 +878,10 @@ test('smalltalk: prompt: click on cancel: cancel false', (t, {document}) => { const fail = t.fail.bind(t); const end = t.end.bind(t); - smalltalk.prompt('title', 'message', value, {cancel: false}) + smalltalk + .prompt('title', 'message', value, { + cancel: false, + }) .then(wraptile(fail, 'should not pass')) .catch(wraptile(fail, 'should not reject')) .then(end); @@ -881,12 +898,10 @@ test('smalltalk: prompt: click on cancel: cancel false', (t, {document}) => { test('smalltalk: prompt: click on cancel: options: no cancel', (t, {document}) => { const dataName = (a) => `[data-name="js-${a}"]`; - const { - createElement, - querySelector, - } = document; + const {createElement, querySelector} = document; const value = 'hello'; + const input = { ...create(), value, @@ -912,7 +927,8 @@ test('smalltalk: prompt: click on cancel: options: no cancel', (t, {document}) = createElement.returns(el); querySelector.returns(el); - smalltalk.prompt('title', 'message', value, {}) + smalltalk + .prompt('title', 'message', value, {}) .catch((e) => { t.ok(e, 'should reject'); t.end(); @@ -976,6 +992,7 @@ test('smalltalk: progress: setProgress', (t, {document}) => { test('smalltalk: progress: setProgress: 100', (t, {document}) => { const valueEl = create(); + valueEl.parentElement = create(); document.querySelector.returns(valueEl); @@ -996,6 +1013,7 @@ test('smalltalk: progress: setProgress: 100', (t, {document}) => { test('smalltalk: progress: remove', (t, {document}) => { const valueEl = create(); + valueEl.parentElement = create(); document.querySelector.returns(valueEl); @@ -1016,4 +1034,3 @@ test('smalltalk: progress: remove', (t, {document}) => { t.calledWith(removeChild, [el], 'should call removeChild'); t.end(); }); - diff --git a/test/smalltalk.native.js b/test/smalltalk.native.js index 8acaba3..934f8b3 100644 --- a/test/smalltalk.native.js +++ b/test/smalltalk.native.js @@ -1,10 +1,8 @@ 'use strict'; -const { - test, - stub, -} = require('supertape'); +require('css-modules-require-hook/preset'); +const {test, stub} = require('supertape'); const smalltalk = require('../lib/smalltalk.native'); global.window = {}; @@ -19,6 +17,7 @@ test('smalltalk.native: Promise', (t) => { test('smalltalk.native: alert', (t) => { const alert = stub(); + global.alert = alert; smalltalk.alert('title', 'message'); @@ -30,10 +29,12 @@ test('smalltalk.native: alert', (t) => { test('smalltalk.native: alert: result', (t) => { global.alert = stub(); - smalltalk.alert('title', 'message').then(() => { - t.pass('promise should have been resolved'); - t.end(); - }) + smalltalk + .alert('title', 'message') + .then(() => { + t.pass('promise should have been resolved'); + t.end(); + }) .catch((e) => { t.fail(`should not reject ${e.message}`); }); @@ -41,9 +42,11 @@ test('smalltalk.native: alert: result', (t) => { test('smalltalk.native: confirm', (t) => { const confirm = stub().returns(false); + global.confirm = confirm; - smalltalk.confirm('title', 'message') + smalltalk + .confirm('title', 'message') .catch(() => { t.calledWith(confirm, ['message'], 'confirm should have been called with message'); t.end(); @@ -53,10 +56,12 @@ test('smalltalk.native: confirm', (t) => { test('smalltalk.native: confirm: result: ok', (t) => { global.confirm = stub().returns(true); - smalltalk.confirm('title', 'message').then(() => { - t.pass('should resolve'); - t.end(); - }) + smalltalk + .confirm('title', 'message') + .then(() => { + t.pass('should resolve'); + t.end(); + }) .catch((e) => { t.notOk(e, 'should not reject'); }); @@ -65,10 +70,12 @@ test('smalltalk.native: confirm: result: ok', (t) => { test('smalltalk.native: confirm: result: cancel', (t) => { global.confirm = stub().returns(false); - smalltalk.confirm('title', 'message').then(() => { - t.fail('should not resolve'); - t.end(); - }) + smalltalk + .confirm('title', 'message') + .then(() => { + t.fail('should not resolve'); + t.end(); + }) .catch((e) => { t.ok(e, 'should reject'); }); @@ -79,10 +86,14 @@ test('smalltalk.native: confirm: options: cancel', (t) => { const cancel = false; - smalltalk.confirm('title', 'message', {cancel}).then(() => { - t.fail('should not resolve'); - t.end(); - }) + smalltalk + .confirm('title', 'message', { + cancel, + }) + .then(() => { + t.fail('should not resolve'); + t.end(); + }) .catch(() => { t.fail('should not reject'); }); @@ -92,6 +103,7 @@ test('smalltalk.native: confirm: options: cancel', (t) => { test('smalltalk.native: prompt', (t) => { const prompt = stub(); + global.prompt = prompt; smalltalk.prompt('title', 'message', 'value'); @@ -103,10 +115,12 @@ test('smalltalk.native: prompt', (t) => { test('smalltalk.native: prompt: result: ok', (t) => { global.prompt = stub().returns('hello'); - smalltalk.prompt('title', 'message', 'value').then((value) => { - t.equal(value, 'hello', 'should resolve value'); - t.end(); - }) + smalltalk + .prompt('title', 'message', 'value') + .then((value) => { + t.equal(value, 'hello', 'should resolve value'); + t.end(); + }) .catch((e) => { t.fail(`should not reject ${e.message}`); }); @@ -115,10 +129,12 @@ test('smalltalk.native: prompt: result: ok', (t) => { test('smalltalk.native: prompt: result: cancel', (t) => { global.prompt = stub().returns(null); - smalltalk.prompt('title', 'message', 'value').then(() => { - t.fail('should not resolve'); - t.end(); - }) + smalltalk + .prompt('title', 'message', 'value') + .then(() => { + t.fail('should not resolve'); + t.end(); + }) .catch((e) => { t.ok(e, 'should reject'); }); @@ -127,12 +143,14 @@ test('smalltalk.native: prompt: result: cancel', (t) => { test('smalltalk.native: prompt: options: cancel', (t) => { global.prompt = stub().returns(null); - smalltalk.prompt('title', 'message', 'value', { - cancel: false, - }).then(() => { - t.fail('should not resolve'); - t.end(); - }) + smalltalk + .prompt('title', 'message', 'value', { + cancel: false, + }) + .then(() => { + t.fail('should not resolve'); + t.end(); + }) .catch((e) => { t.fail(`should not reject ${e.message}`); }); diff --git a/webpack.config.js b/webpack.config.js index ebf11a7..be24642 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,7 +10,11 @@ const devtool = 'source-map'; const rules = [{ test: /\.css$/, - use: ['style-loader', 'css-loader', 'clean-css-loader'], + use: [ + 'style-loader', + 'css-loader', + 'clean-css-loader', + ], }, { test: /\.(png|gif|svg|woff|woff2|eot|ttf)$/, use: [{ From 13ca47e8a2a3ba46ec0f30f2cc7db33c0699147c Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:34:31 +0200 Subject: [PATCH 12/39] feature: smalltalk: eslint-plugin-n v16.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 012dd41..6c8e732 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "css-loader": "^6.7.1", "css-modules-require-hook": "^4.2.3", "eslint": "^8.19.0", - "eslint-plugin-node": "^11.0.0", + "eslint-plugin-n": "^16.3.1", "eslint-plugin-putout": "^21.0.2", "madrun": "^9.0.5", "nodemon": "^3.0.2", From 4ec182ac0d4b80474892e780c9af11bc3242e70b Mon Sep 17 00:00:00 2001 From: coderaiser Date: Sun, 3 Dec 2023 23:37:22 +0200 Subject: [PATCH 13/39] chore: smalltalk: v4.1.2 --- ChangeLog | 17 +++++++++++++++++ package.json | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 5456ffd..63de8e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2023.12.03, v4.1.2 + +fix: +- 64f0fc8 export + +feature: +- 13ca47e smalltalk: eslint-plugin-n v16.3.1 +- d4c8994 smalltalk: postcss v8.4.32 +- 6c4b74a drop coveralls +- 0e0345f smalltalk: nodemon v3.0.2 +- cb46477 smalltalk: webpack-cli v5.1.4 +- 924db6f smalltalk: eslint-plugin-putout v21.0.2 +- acc397f smalltalk: putout v33.13.3 +- f7041ab smalltalk: supertape v8.8.0 +- 383d124 smalltalk: c8 v8.0.1 +- 337c31a smalltalk: auto-globals v3.0.0 + 2022.07.13, v4.1.1 fix: diff --git a/package.json b/package.json index 6c8e732..442f21c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smalltalk", - "version": "4.1.1", + "version": "4.1.2", "type": "commonjs", "description": "Promise-based Alert, Confirm and Prompt replacement", "homepage": "http://github.com/coderaiser/smalltalk", From c53349a8ecff43bc917008cb209753e83101702a Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:21 +0200 Subject: [PATCH 14/39] feature: smalltalk: auto-globals v4.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 442f21c..348b534 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,7 @@ "url": "https://github.com/coderaiser/smalltalk/issues" }, "devDependencies": { - "auto-globals": "^3.0.0", + "auto-globals": "^4.0.1", "autoprefixer": "^10.0.1", "c8": "^8.0.1", "clean-css-loader": "^4.1.1", From 78b993bf6a8945ace82bbbe0a2f3f180fbc42808 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:22 +0200 Subject: [PATCH 15/39] feature: smalltalk: c8 v10.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 348b534..c0bafbf 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "devDependencies": { "auto-globals": "^4.0.1", "autoprefixer": "^10.0.1", - "c8": "^8.0.1", + "c8": "^10.1.3", "clean-css-loader": "^4.1.1", "css-loader": "^6.7.1", "css-modules-require-hook": "^4.2.3", From 0424c0d136d1ed4b855e7fd30388611c1f57eb5c Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:22 +0200 Subject: [PATCH 16/39] feature: smalltalk: css-loader v7.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c0bafbf..130f8dc 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "autoprefixer": "^10.0.1", "c8": "^10.1.3", "clean-css-loader": "^4.1.1", - "css-loader": "^6.7.1", + "css-loader": "^7.1.3", "css-modules-require-hook": "^4.2.3", "eslint": "^8.19.0", "eslint-plugin-n": "^16.3.1", From effc8c17fdda2f5edf60b6ee545ff4830d986e01 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:22 +0200 Subject: [PATCH 17/39] feature: smalltalk: eslint v9.39.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 130f8dc..07f4704 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "clean-css-loader": "^4.1.1", "css-loader": "^7.1.3", "css-modules-require-hook": "^4.2.3", - "eslint": "^8.19.0", + "eslint": "^9.39.2", "eslint-plugin-n": "^16.3.1", "eslint-plugin-putout": "^21.0.2", "madrun": "^9.0.5", From 4db84bc38134154aa254bb96d499477e6014791d Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:23 +0200 Subject: [PATCH 18/39] feature: smalltalk: eslint-plugin-n v17.23.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 07f4704..dde51f8 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "css-loader": "^7.1.3", "css-modules-require-hook": "^4.2.3", "eslint": "^9.39.2", - "eslint-plugin-n": "^16.3.1", + "eslint-plugin-n": "^17.23.2", "eslint-plugin-putout": "^21.0.2", "madrun": "^9.0.5", "nodemon": "^3.0.2", From fb1249759a99b6e269e86fe5011c9d86165bc8c2 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:24 +0200 Subject: [PATCH 19/39] feature: smalltalk: eslint-plugin-putout v30.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dde51f8..b670f6c 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "css-modules-require-hook": "^4.2.3", "eslint": "^9.39.2", "eslint-plugin-n": "^17.23.2", - "eslint-plugin-putout": "^21.0.2", + "eslint-plugin-putout": "^30.0.2", "madrun": "^9.0.5", "nodemon": "^3.0.2", "postcss": "^8.4.32", From 3eefd4cc5333158dc8c972d6eb28dd3dfb6605e0 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:25 +0200 Subject: [PATCH 20/39] feature: smalltalk: fullstore v4.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b670f6c..36d0e9f 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "dependencies": { "@cloudcmd/create-element": "^2.0.0", "currify": "^4.0.0", - "fullstore": "^3.0.0" + "fullstore": "^4.0.0" }, "publishConfig": { "access": "public" From 7f3e9d17033c2988435c700dffed75d258610e2c Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:25 +0200 Subject: [PATCH 21/39] feature: smalltalk: madrun v12.1.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 36d0e9f..aa059a3 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "eslint": "^9.39.2", "eslint-plugin-n": "^17.23.2", "eslint-plugin-putout": "^30.0.2", - "madrun": "^9.0.5", + "madrun": "^12.1.3", "nodemon": "^3.0.2", "postcss": "^8.4.32", "putasset": "^6.0.0", From a74682d3c98236e425d3ecd47505103d0912895c Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:26 +0200 Subject: [PATCH 22/39] feature: smalltalk: putasset v7.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index aa059a3..a0a4468 100644 --- a/package.json +++ b/package.json @@ -59,7 +59,7 @@ "madrun": "^12.1.3", "nodemon": "^3.0.2", "postcss": "^8.4.32", - "putasset": "^6.0.0", + "putasset": "^7.0.0", "putout": "^33.13.3", "style-loader": "^3.3.1", "supertape": "^8.8.0", From ccbd0ede622f6bd3efdc20bff6eb6dd742a74a3c Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:26 +0200 Subject: [PATCH 23/39] feature: smalltalk: putout v41.16.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a0a4468..862dbbd 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "nodemon": "^3.0.2", "postcss": "^8.4.32", "putasset": "^7.0.0", - "putout": "^33.13.3", + "putout": "^41.16.0", "style-loader": "^3.3.1", "supertape": "^8.8.0", "terser-webpack-plugin": "^5.0.0", From 3e11e6119da36bca8a4d1eaaef75ff462fc442e1 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:27 +0200 Subject: [PATCH 24/39] feature: smalltalk: style-loader v4.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 862dbbd..d813bb0 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "postcss": "^8.4.32", "putasset": "^7.0.0", "putout": "^41.16.0", - "style-loader": "^3.3.1", + "style-loader": "^4.0.0", "supertape": "^8.8.0", "terser-webpack-plugin": "^5.0.0", "try-to-tape": "^1.1.0", From 59102e9a52987fb46786c6fddcaa91ace31489a7 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:27 +0200 Subject: [PATCH 25/39] feature: smalltalk: supertape v12.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d813bb0..8ffc18a 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "putasset": "^7.0.0", "putout": "^41.16.0", "style-loader": "^4.0.0", - "supertape": "^8.8.0", + "supertape": "^12.2.0", "terser-webpack-plugin": "^5.0.0", "try-to-tape": "^1.1.0", "url-loader": "^4.0.0", From 003ca389c6b6a99a989ac0f93b68a4f3c9592602 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:29 +0200 Subject: [PATCH 26/39] feature: smalltalk: version-io v5.0.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8ffc18a..bf3bd15 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "terser-webpack-plugin": "^5.0.0", "try-to-tape": "^1.1.0", "url-loader": "^4.0.0", - "version-io": "^4.0.1", + "version-io": "^5.0.0", "webpack": "^5.1.3", "webpack-cli": "^5.1.4", "wraptile": "^3.0.0" From b34064299cea78df14e2a8512a1f099ec27d8eee Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 17:05:29 +0200 Subject: [PATCH 27/39] feature: smalltalk: webpack-cli v6.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf3bd15..421f994 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "url-loader": "^4.0.0", "version-io": "^5.0.0", "webpack": "^5.1.3", - "webpack-cli": "^5.1.4", + "webpack-cli": "^6.0.1", "wraptile": "^3.0.0" }, "dependencies": { From 622fb1ccc8d5ccfe98a9999e924f06e28e4cdc9b Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 18:25:37 +0200 Subject: [PATCH 28/39] chore: lint --- .eslintrc.json | 5 +---- .npmignore | 1 + .putout.json | 5 +++++ .stylelintrc.yml | 14 -------------- README.md | 2 +- css/smalltalk.css | 8 -------- lib/smalltalk.js | 3 ++- package.json | 2 +- test/smalltalk.js | 17 +++++++---------- test/smalltalk.native.js | 24 ++++++++++++------------ webpack.config.js | 2 +- 11 files changed, 31 insertions(+), 52 deletions(-) create mode 100644 .putout.json delete mode 100644 .stylelintrc.yml diff --git a/.eslintrc.json b/.eslintrc.json index 87e11ff..cf9e113 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,8 +12,5 @@ "plugin:n/recommended", "plugin:putout/recommended" ], - "plugins": [ - "n", - "putout" - ] + "plugins": ["n", "putout"] } diff --git a/.npmignore b/.npmignore index 29c2db6..6038010 100644 --- a/.npmignore +++ b/.npmignore @@ -5,3 +5,4 @@ yarn-error.log webpack.config.js coverage +*.config.* diff --git a/.putout.json b/.putout.json new file mode 100644 index 0000000..cbc1a70 --- /dev/null +++ b/.putout.json @@ -0,0 +1,5 @@ +{ + "rules": { + "tape/add-t-end": "off" + } +} diff --git a/.stylelintrc.yml b/.stylelintrc.yml deleted file mode 100644 index 6b85a36..0000000 --- a/.stylelintrc.yml +++ /dev/null @@ -1,14 +0,0 @@ -extends: stylelint-config-standard -rules: - indentation: 4 - declaration-block-trailing-semicolon: always - declaration-colon-space-before: null - selector-list-comma-newline-after: null - comment-empty-line-before: null - number-leading-zero: null - number-no-trailing-zeros: null - string-quotes: single - function-url-quotes: never - no-eol-whitespace: null - declaration-empty-line-before: null - max-empty-lines: 2 diff --git a/README.md b/README.md index a882d53..a63dc8b 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,7 @@ progress You can use custom label passing into options param the buttons specification. For example : ```js -const tryToCatch = require('try-to-catch'); +const {tryToCatch} = require('try-to-catch'); const OK = 2; const result = await tryToCatch(smalltalk.confirm, 'Question', 'Are you sure?', { buttons: { diff --git a/css/smalltalk.css b/css/smalltalk.css index 9d7b317..6ec1b14 100644 --- a/css/smalltalk.css +++ b/css/smalltalk.css @@ -1,17 +1,13 @@ .smalltalk { display: flex; - align-items: center; flex-direction: column; justify-content: center; - transition: 200ms opacity; - inset: 0; overflow: auto; padding: 20px; position: fixed; - z-index: 100; } @@ -62,7 +58,6 @@ text-overflow: ellipsis; white-space: nowrap; max-width: 500px; - user-select: none; color: #333; font-size: 120%; @@ -75,7 +70,6 @@ .smalltalk .page .content-area { overflow: hidden; text-overflow: ellipsis; - padding: 6px 17px; position: relative; } @@ -97,7 +91,6 @@ button { appearance: none; user-select: none; background-image: linear-gradient(#ededed, #ededed 38%, #dedede); - border: 1px solid rgb(0 0 0 / 25%); border-radius: 2px; box-shadow: 0 1px 0 rgb(0 0 0 / 8%), inset 0 1px 2px rgb(255 255 255 / 75%); @@ -119,7 +112,6 @@ button { .smalltalk .page .button-strip { display: flex; - flex-direction: row; justify-content: flex-end; } diff --git a/lib/smalltalk.js b/lib/smalltalk.js index ee40335..b2390b7 100644 --- a/lib/smalltalk.js +++ b/lib/smalltalk.js @@ -201,6 +201,7 @@ function keyDown_(dialog, ok, cancel, event) { 'cancel', 'input', ]; + const names = find(dialog, namesAll).map(getDataName); switch(keyCode) { @@ -305,7 +306,7 @@ function closeDialog(el, dialog, ok, cancel) { let value = null; for (const el of find(dialog, ['input'])) { - value = el.value; + ({value} = el); } ok(value); diff --git a/package.json b/package.json index 421f994..c4f8cf8 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "homepage": "http://github.com/coderaiser/smalltalk", "repository": { "type": "git", - "url": "git://github.com/coderaiser/smalltalk.git" + "url": "git+https://github.com/coderaiser/smalltalk.git" }, "main": "lib/smalltalk.js", "exports": { diff --git a/test/smalltalk.js b/test/smalltalk.js index 6fcfb15..6057c0e 100644 --- a/test/smalltalk.js +++ b/test/smalltalk.js @@ -2,16 +2,16 @@ const {join} = require('node:path'); const process = require('node:process'); -const fs = require('fs'); +const fs = require('node:fs'); require('css-modules-require-hook/preset'); const autoGlobals = require('auto-globals'); -const tape = require('supertape'); +const {test: tape} = require('supertape'); const currify = require('currify'); const wraptile = require('wraptile'); -global.window = {}; +globalThis.window = {}; const smalltalk = require('../lib/smalltalk'); const {UPDATE_FIXTURE} = process.env; @@ -89,10 +89,7 @@ test('smalltalk: alert: click', (t, {document}) => { createElement.returns(el); smalltalk.alert('title', 'message'); - const result = ok - .addEventListener - .args - .pop()[0]; + const [result] = ok.addEventListener.args.pop(); t.equal(result, 'click', 'should set click listener'); t.end(); @@ -205,9 +202,9 @@ test('smalltalk: alert: click: stopPropagation: called', (t, {document}) => { .addEventListener .args .filter((a) => { - const [event] = a; - return event === 'click'; - }) + const [event] = a; + return event === 'click'; + }) .pop(); const event = { diff --git a/test/smalltalk.native.js b/test/smalltalk.native.js index 934f8b3..2dcd02f 100644 --- a/test/smalltalk.native.js +++ b/test/smalltalk.native.js @@ -5,10 +5,10 @@ require('css-modules-require-hook/preset'); const {test, stub} = require('supertape'); const smalltalk = require('../lib/smalltalk.native'); -global.window = {}; +globalThis.window = {}; test('smalltalk.native: Promise', (t) => { - global.window.Promise = null; + globalThis.window.Promise = null; reload(); t.pass('load with no Promise support'); @@ -18,7 +18,7 @@ test('smalltalk.native: Promise', (t) => { test('smalltalk.native: alert', (t) => { const alert = stub(); - global.alert = alert; + globalThis.alert = alert; smalltalk.alert('title', 'message'); @@ -27,7 +27,7 @@ test('smalltalk.native: alert', (t) => { }); test('smalltalk.native: alert: result', (t) => { - global.alert = stub(); + globalThis.alert = stub(); smalltalk .alert('title', 'message') @@ -43,7 +43,7 @@ test('smalltalk.native: alert: result', (t) => { test('smalltalk.native: confirm', (t) => { const confirm = stub().returns(false); - global.confirm = confirm; + globalThis.confirm = confirm; smalltalk .confirm('title', 'message') @@ -54,7 +54,7 @@ test('smalltalk.native: confirm', (t) => { }); test('smalltalk.native: confirm: result: ok', (t) => { - global.confirm = stub().returns(true); + globalThis.confirm = stub().returns(true); smalltalk .confirm('title', 'message') @@ -68,7 +68,7 @@ test('smalltalk.native: confirm: result: ok', (t) => { }); test('smalltalk.native: confirm: result: cancel', (t) => { - global.confirm = stub().returns(false); + globalThis.confirm = stub().returns(false); smalltalk .confirm('title', 'message') @@ -82,7 +82,7 @@ test('smalltalk.native: confirm: result: cancel', (t) => { }); test('smalltalk.native: confirm: options: cancel', (t) => { - global.confirm = stub().returns(false); + globalThis.confirm = stub().returns(false); const cancel = false; @@ -104,7 +104,7 @@ test('smalltalk.native: confirm: options: cancel', (t) => { test('smalltalk.native: prompt', (t) => { const prompt = stub(); - global.prompt = prompt; + globalThis.prompt = prompt; smalltalk.prompt('title', 'message', 'value'); @@ -113,7 +113,7 @@ test('smalltalk.native: prompt', (t) => { }); test('smalltalk.native: prompt: result: ok', (t) => { - global.prompt = stub().returns('hello'); + globalThis.prompt = stub().returns('hello'); smalltalk .prompt('title', 'message', 'value') @@ -127,7 +127,7 @@ test('smalltalk.native: prompt: result: ok', (t) => { }); test('smalltalk.native: prompt: result: cancel', (t) => { - global.prompt = stub().returns(null); + globalThis.prompt = stub().returns(null); smalltalk .prompt('title', 'message', 'value') @@ -141,7 +141,7 @@ test('smalltalk.native: prompt: result: cancel', (t) => { }); test('smalltalk.native: prompt: options: cancel', (t) => { - global.prompt = stub().returns(null); + globalThis.prompt = stub().returns(null); smalltalk .prompt('title', 'message', 'value', { diff --git a/webpack.config.js b/webpack.config.js index be24642..2e35d14 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,6 @@ 'use strict'; -const path = require('path'); +const path = require('node:path'); const TerserPlugin = require('terser-webpack-plugin'); const dir = './lib'; From db1594d2aec4aa0a06a25c15f27fb2e62d55f02e Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 19:02:54 +0200 Subject: [PATCH 29/39] feature: smalltalk: migrate to ESM --- .madrun.mjs => .madrun.js | 16 +++-- .putout.json | 5 ++ .travis.yml | 11 --- README.md | 4 +- lib/smalltalk.js | 19 +++--- lib/smalltalk.native.js | 16 +++-- package.json | 5 +- test/smalltalk.js | 23 +++---- test/smalltalk.native.js | 137 +++++++++++++------------------------- webpack.config.js | 11 +-- 10 files changed, 99 insertions(+), 148 deletions(-) rename .madrun.mjs => .madrun.js (73%) delete mode 100644 .travis.yml diff --git a/.madrun.mjs b/.madrun.js similarity index 73% rename from .madrun.mjs rename to .madrun.js index 3e4e8f8..ad9d81d 100644 --- a/.madrun.mjs +++ b/.madrun.js @@ -1,4 +1,9 @@ -import {run} from 'madrun'; +import {run, cutEnv} from 'madrun'; +import {defineEnv} from 'supertape/env'; + +const env = defineEnv({ + css: true, +}); export default { 'watch': () => 'nodemon --watch lib --watch test --exec', @@ -6,14 +11,17 @@ export default { 'watch:lint': async () => await run('watch', `'npm run lint'`), 'watch:lint:js': () => run('watch', '"run lint:js"'), 'watch:coverage': () => run('watch', 'redrun coverage'), - 'coverage': () => 'c8 npm test', + 'coverage': async () => [env, `c8 ${await cutEnv('test')}`], 'report': () => 'c8 report --reporter=lcov', 'lint': () => 'putout .', 'fresh:lint': () => run('lint', '--fresh'), 'lint:fresh': () => run('lint', '--fresh'), 'fix:lint': () => run('lint', '--fix'), - 'test': () => `tape --no-check-scopes 'test/**/*.js'`, - 'test:update': () => 'UPDATE_FIXTURE=1 npm test', + 'test': () => [env, `tape --no-check-scopes 'test/**/*.js'`], + 'test:update': async () => [`await cutEnv('test')`, { + UPDATE_FIXTURE: 1, + ...env, + }], 'build': () => 'webpack --progress --mode production', 'wisdom': () => run('build'), 'wisdom:done': () => run('upload:*'), diff --git a/.putout.json b/.putout.json index cbc1a70..90d6ac7 100644 --- a/.putout.json +++ b/.putout.json @@ -1,5 +1,10 @@ { "rules": { "tape/add-t-end": "off" + }, + "match": { + "smalltalk.native.js": { + "arguments/remove-unused": "off" + } } } diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6b0e076..0000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 15 - - 14 -script: - - npm run lint - - npm run coverage && npm run report -notifications: - email: true -sudo: false -cache: false diff --git a/README.md b/README.md index a63dc8b..15a14cd 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ npm i smalltalk First things first, require `smalltalk` with: ```js -const smalltalk = require('smalltalk'); +import * as smalltalk from 'smalltalk'; ``` You can also use native version with: ```js -const smalltalk = require('smalltalk/native'); +import * as smalltalk from 'smalltalk/native'; ``` When you need a bundled verseion use diff --git a/lib/smalltalk.js b/lib/smalltalk.js index b2390b7..57957e2 100644 --- a/lib/smalltalk.js +++ b/lib/smalltalk.js @@ -1,10 +1,7 @@ -'use strict'; - -require('../css/smalltalk.css'); - -const currify = require('currify'); -const store = require('fullstore'); -const createElement = require('@cloudcmd/create-element'); +import currify from 'currify'; +import store from 'fullstore'; +import createElement from '@cloudcmd/create-element'; +import '../css/smalltalk.css'; const isBool = (a) => typeof a === 'boolean'; @@ -21,12 +18,12 @@ const BUTTON_OK_CANCEL = { const zIndex = store(100); -module.exports.alert = (title, msg, options) => { +export const alert = (title, msg, options) => { const buttons = getButtons(options) || BUTTON_OK; return showDialog(title, msg, '', buttons, options); }; -module.exports.prompt = (title, msg, value = '', options) => { +export const prompt = (title, msg, value = '', options) => { const type = getType(options); const val = String(value).replace(/"/g, '"'); @@ -36,13 +33,13 @@ module.exports.prompt = (title, msg, value = '', options) => { return showDialog(title, msg, valueStr, buttons, options); }; -module.exports.confirm = (title, msg, options) => { +export const confirm = (title, msg, options) => { const buttons = getButtons(options) || BUTTON_OK_CANCEL; return showDialog(title, msg, '', buttons, options); }; -module.exports.progress = (title, message, options) => { +export const progress = (title, message, options) => { const valueStr = ` 0% diff --git a/lib/smalltalk.native.js b/lib/smalltalk.native.js index 3e94461..7248c29 100644 --- a/lib/smalltalk.native.js +++ b/lib/smalltalk.native.js @@ -1,8 +1,8 @@ -'use strict'; +import '../css/smalltalk.css'; -require('../css/smalltalk.css'); - -module.exports.alert = (title, message) => { +export const alert = (title, message, overrides = {}) => { + const {alert = globalThis.alert} = overrides; + const promise = new Promise((resolve) => { alert(message); resolve(); @@ -11,7 +11,8 @@ module.exports.alert = (title, message) => { return promise; }; -module.exports.prompt = (title, message, value, options) => { +export const prompt = (title, message, value, options, overrides = {}) => { + const {prompt = globalThis.prompt} = overrides; const o = options; const promise = new Promise((resolve, reject) => { const noCancel = o && !o.cancel; @@ -29,9 +30,12 @@ module.exports.prompt = (title, message, value, options) => { return promise; }; -module.exports.confirm = (title, message, options) => { +export const confirm = (title, message, options, overrides = {}) => { + const {confirm = globalThis.confirm} = overrides; + const o = options; const noCancel = o && !o.cancel; + const promise = new Promise((resolve, reject) => { const is = confirm(message); diff --git a/package.json b/package.json index c4f8cf8..58370af 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "smalltalk", "version": "4.1.2", - "type": "commonjs", + "type": "module", "description": "Promise-based Alert, Confirm and Prompt replacement", "homepage": "http://github.com/coderaiser/smalltalk", "repository": { @@ -10,8 +10,7 @@ }, "main": "lib/smalltalk.js", "exports": { - ".": "./lib/smalltalk.js", - "./bundle": "./dist/smalltalk.min.js" + ".": "./lib/smalltalk.js" }, "scripts": { "watch": "madrun watch", diff --git a/test/smalltalk.js b/test/smalltalk.js index 6057c0e..e153b80 100644 --- a/test/smalltalk.js +++ b/test/smalltalk.js @@ -1,25 +1,18 @@ -'use strict'; - -const {join} = require('node:path'); -const process = require('node:process'); -const fs = require('node:fs'); - -require('css-modules-require-hook/preset'); - -const autoGlobals = require('auto-globals'); -const {test: tape} = require('supertape'); -const currify = require('currify'); -const wraptile = require('wraptile'); +import process from 'node:process'; +import fs from 'node:fs'; +import autoGlobals from 'auto-globals'; +import {test as tape} from 'supertape'; +import currify from 'currify'; +import wraptile from 'wraptile'; +import * as smalltalk from '../lib/smalltalk.js'; globalThis.window = {}; - -const smalltalk = require('../lib/smalltalk'); const {UPDATE_FIXTURE} = process.env; const noop = () => {}; const isUpdateFixtures = UPDATE_FIXTURE === 'true' || UPDATE_FIXTURE === '1'; const {create} = autoGlobals; const test = autoGlobals(tape); -const fixtureDir = join(__dirname, 'fixture'); +const fixtureDir = new URL('fixture', import.meta.url).pathname; const {stub} = tape; const writeFixture = (name, data) => { diff --git a/test/smalltalk.native.js b/test/smalltalk.native.js index 2dcd02f..4e104c0 100644 --- a/test/smalltalk.native.js +++ b/test/smalltalk.native.js @@ -1,84 +1,58 @@ -'use strict'; - -require('css-modules-require-hook/preset'); - -const {test, stub} = require('supertape'); -const smalltalk = require('../lib/smalltalk.native'); +import {test, stub} from 'supertape'; +import {tryToCatch} from 'try-to-catch'; +import * as smalltalk from '../lib/smalltalk.native.js'; globalThis.window = {}; -test('smalltalk.native: Promise', (t) => { - globalThis.window.Promise = null; - reload(); - - t.pass('load with no Promise support'); - t.end(); -}); - -test('smalltalk.native: alert', (t) => { +test('smalltalk.native: alert', async (t) => { const alert = stub(); - globalThis.alert = alert; - - smalltalk.alert('title', 'message'); + await smalltalk.alert('title', 'message', { + alert, + }); t.calledWith(alert, ['message'], 'alert should have been called with message'); t.end(); }); -test('smalltalk.native: alert: result', (t) => { - globalThis.alert = stub(); +test('smalltalk.native: alert: result', async (t) => { + const alert = stub(); - smalltalk - .alert('title', 'message') - .then(() => { - t.pass('promise should have been resolved'); - t.end(); - }) - .catch((e) => { - t.fail(`should not reject ${e.message}`); - }); + await smalltalk.alert('title', 'message', { + alert, + }); + + t.pass('promise should have been resolved'); + t.end(); }); -test('smalltalk.native: confirm', (t) => { +test('smalltalk.native: confirm', async (t) => { const confirm = stub().returns(false); - globalThis.confirm = confirm; + await tryToCatch(smalltalk.confirm, 'title', 'message', null, { + confirm, + }); - smalltalk - .confirm('title', 'message') - .catch(() => { - t.calledWith(confirm, ['message'], 'confirm should have been called with message'); - t.end(); - }); + t.calledWith(confirm, ['message'], 'confirm should have been called with message'); + t.end(); }); test('smalltalk.native: confirm: result: ok', (t) => { globalThis.confirm = stub().returns(true); - smalltalk - .confirm('title', 'message') - .then(() => { - t.pass('should resolve'); - t.end(); - }) - .catch((e) => { - t.notOk(e, 'should not reject'); - }); + smalltalk.confirm('title', 'message'); + + t.pass('should resolve'); + t.end(); }); -test('smalltalk.native: confirm: result: cancel', (t) => { +test('smalltalk.native: confirm: result: cancel', async (t) => { globalThis.confirm = stub().returns(false); - smalltalk - .confirm('title', 'message') - .then(() => { - t.fail('should not resolve'); - t.end(); - }) - .catch((e) => { - t.ok(e, 'should reject'); - }); + const [e] = await tryToCatch(smalltalk.confirm, 'title', 'message'); + + t.ok(e, 'should reject'); + t.end(); }); test('smalltalk.native: confirm: options: cancel', (t) => { @@ -104,9 +78,9 @@ test('smalltalk.native: confirm: options: cancel', (t) => { test('smalltalk.native: prompt', (t) => { const prompt = stub(); - globalThis.prompt = prompt; - - smalltalk.prompt('title', 'message', 'value'); + smalltalk.prompt('title', 'message', 'value', null, { + prompt, + }); t.calledWith(prompt, ['message', 'value'], 'prompt should have been called with message'); t.end(); @@ -126,43 +100,24 @@ test('smalltalk.native: prompt: result: ok', (t) => { }); }); -test('smalltalk.native: prompt: result: cancel', (t) => { - globalThis.prompt = stub().returns(null); +test('smalltalk.native: prompt: result: cancel', async (t) => { + const prompt = stub().returns(null); - smalltalk - .prompt('title', 'message', 'value') - .then(() => { - t.fail('should not resolve'); - t.end(); - }) - .catch((e) => { - t.ok(e, 'should reject'); - }); + await tryToCatch(smalltalk.prompt, 'title', 'message', 'value', null, { + prompt, + }); + + t.pass('should reject'); + t.end(); }); test('smalltalk.native: prompt: options: cancel', (t) => { - globalThis.prompt = stub().returns(null); + const prompt = stub().returns(null); - smalltalk - .prompt('title', 'message', 'value', { - cancel: false, - }) - .then(() => { - t.fail('should not resolve'); - t.end(); - }) - .catch((e) => { - t.fail(`should not reject ${e.message}`); - }); + smalltalk.prompt('title', 'message', 'value', {cancel: false}, { + prompt, + }); t.pass('should do nothing'); + t.end(); }); - -function reload() { - clean(); - return require('../lib/smalltalk.native'); -} - -function clean() { - delete require.cache[require.resolve('../lib/smalltalk.native')]; -} diff --git a/webpack.config.js b/webpack.config.js index 2e35d14..f12ab59 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,8 +1,9 @@ -'use strict'; - -const path = require('node:path'); -const TerserPlugin = require('terser-webpack-plugin'); +import path, {dirname} from 'node:path'; +import {fileURLToPath} from 'node:url'; +import TerserPlugin from 'terser-webpack-plugin'; +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); const dir = './lib'; const dist = path.resolve(__dirname, 'dist'); @@ -36,7 +37,7 @@ const optimization = { const filename = `[name].min.js`; -module.exports = { +export default { devtool, entry: { 'smalltalk': `${dir}/smalltalk.js`, From 4d2c14669c942aaa62b134ae530a1fb756356a7e Mon Sep 17 00:00:00 2001 From: coderiaser Date: Mon, 2 Feb 2026 19:03:43 +0200 Subject: [PATCH 30/39] chore: smalltalk: v5.0.0 --- ChangeLog | 19 +++++++++++++++++++ package.json | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 63de8e3..e0b1300 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2026.02.02, v5.0.0 + +feature: +- db1594d smalltalk: migrate to ESM +- b340642 smalltalk: webpack-cli v6.0.1 +- 003ca38 smalltalk: version-io v5.0.0 +- 59102e9 smalltalk: supertape v12.2.0 +- 3e11e61 smalltalk: style-loader v4.0.0 +- ccbd0ed smalltalk: putout v41.16.0 +- a74682d smalltalk: putasset v7.0.0 +- 7f3e9d1 smalltalk: madrun v12.1.3 +- 3eefd4c smalltalk: fullstore v4.0.0 +- fb12497 smalltalk: eslint-plugin-putout v30.0.2 +- 4db84bc smalltalk: eslint-plugin-n v17.23.2 +- effc8c1 smalltalk: eslint v9.39.2 +- 0424c0d smalltalk: css-loader v7.1.3 +- 78b993b smalltalk: c8 v10.1.3 +- c53349a smalltalk: auto-globals v4.0.1 + 2023.12.03, v4.1.2 fix: diff --git a/package.json b/package.json index 58370af..827ee4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smalltalk", - "version": "4.1.2", + "version": "5.0.0", "type": "module", "description": "Promise-based Alert, Confirm and Prompt replacement", "homepage": "http://github.com/coderaiser/smalltalk", From a28f0fa064bb52fb1ee2fb36384f715d5fb28a9e Mon Sep 17 00:00:00 2001 From: coderiaser Date: Thu, 19 Mar 2026 14:08:44 +0200 Subject: [PATCH 31/39] feature: smalltalk: superc8 v12.3.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 827ee4b..70f92bf 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,6 @@ "devDependencies": { "auto-globals": "^4.0.1", "autoprefixer": "^10.0.1", - "c8": "^10.1.3", "clean-css-loader": "^4.1.1", "css-loader": "^7.1.3", "css-modules-require-hook": "^4.2.3", @@ -61,6 +60,7 @@ "putasset": "^7.0.0", "putout": "^41.16.0", "style-loader": "^4.0.0", + "superc8": "^12.3.1", "supertape": "^12.2.0", "terser-webpack-plugin": "^5.0.0", "try-to-tape": "^1.1.0", From 954f062fa8f230dae1350d2aa70a192d934981f3 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Thu, 19 Mar 2026 14:08:48 +0200 Subject: [PATCH 32/39] feature: smalltalk: eslint v10.0.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 70f92bf..e976360 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "clean-css-loader": "^4.1.1", "css-loader": "^7.1.3", "css-modules-require-hook": "^4.2.3", - "eslint": "^9.39.2", + "eslint": "^10.0.3", "eslint-plugin-n": "^17.23.2", "eslint-plugin-putout": "^30.0.2", "madrun": "^12.1.3", From 0439d8f7174e90c0af0a99ee6fd6d3e1b123d18c Mon Sep 17 00:00:00 2001 From: coderiaser Date: Thu, 19 Mar 2026 14:08:49 +0200 Subject: [PATCH 33/39] feature: smalltalk: eslint-plugin-putout v31.1.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e976360..f005ea6 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "css-modules-require-hook": "^4.2.3", "eslint": "^10.0.3", "eslint-plugin-n": "^17.23.2", - "eslint-plugin-putout": "^30.0.2", + "eslint-plugin-putout": "^31.1.1", "madrun": "^12.1.3", "nodemon": "^3.0.2", "postcss": "^8.4.32", From fefed49541dac29ecfd8edcac9abc97f4696722f Mon Sep 17 00:00:00 2001 From: coderiaser Date: Thu, 19 Mar 2026 14:08:49 +0200 Subject: [PATCH 34/39] feature: smalltalk: madrun v13.0.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f005ea6..f4f0a0f 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "eslint": "^10.0.3", "eslint-plugin-n": "^17.23.2", "eslint-plugin-putout": "^31.1.1", - "madrun": "^12.1.3", + "madrun": "^13.0.1", "nodemon": "^3.0.2", "postcss": "^8.4.32", "putasset": "^7.0.0", From e41b6da744085c51d03aa7756eac4c7023dea333 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Thu, 19 Mar 2026 14:08:50 +0200 Subject: [PATCH 35/39] feature: smalltalk: putout v42.2.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f4f0a0f..9a04a24 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "nodemon": "^3.0.2", "postcss": "^8.4.32", "putasset": "^7.0.0", - "putout": "^41.16.0", + "putout": "^42.2.3", "style-loader": "^4.0.0", "superc8": "^12.3.1", "supertape": "^12.2.0", From 2e80306b799fbf3803aa7d7a0a7e9217c5f00887 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Thu, 19 Mar 2026 14:08:51 +0200 Subject: [PATCH 36/39] feature: smalltalk: version-io v6.1.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9a04a24..7c15b89 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "terser-webpack-plugin": "^5.0.0", "try-to-tape": "^1.1.0", "url-loader": "^4.0.0", - "version-io": "^5.0.0", + "version-io": "^6.1.2", "webpack": "^5.1.3", "webpack-cli": "^6.0.1", "wraptile": "^3.0.0" From 492c63097ddc1261b9f4f215b27903ade7636d06 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Thu, 19 Mar 2026 14:08:51 +0200 Subject: [PATCH 37/39] feature: smalltalk: webpack-cli v7.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7c15b89..595df0e 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "url-loader": "^4.0.0", "version-io": "^6.1.2", "webpack": "^5.1.3", - "webpack-cli": "^6.0.1", + "webpack-cli": "^7.0.2", "wraptile": "^3.0.0" }, "dependencies": { From 703a7f0507e77b952ac021d93b817994066f20fb Mon Sep 17 00:00:00 2001 From: coderiaser Date: Thu, 19 Mar 2026 14:10:39 +0200 Subject: [PATCH 38/39] chore: lint --- .gitignore | 15 +++++++++------ .madrun.js | 6 +++--- .npmignore | 11 +++++++---- README.md | 1 + lib/smalltalk.js | 10 +++++----- lib/smalltalk.native.js | 1 + test/smalltalk.js | 2 ++ 7 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index b9a4e3b..c2a8356 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,13 @@ -package-lock.json -node_modules -npm-debug.log* -.nyc_output *.swp -yarn-error.log -dist +*.log +*.lock +.nyc_output .idea + +package-lock.json +npm-debug.log* + +node_modules +dist coverage diff --git a/.madrun.js b/.madrun.js index ad9d81d..5aae21c 100644 --- a/.madrun.js +++ b/.madrun.js @@ -19,9 +19,9 @@ export default { 'fix:lint': () => run('lint', '--fix'), 'test': () => [env, `tape --no-check-scopes 'test/**/*.js'`], 'test:update': async () => [`await cutEnv('test')`, { - UPDATE_FIXTURE: 1, - ...env, - }], + UPDATE_FIXTURE: 1, + ...env, + }], 'build': () => 'webpack --progress --mode production', 'wisdom': () => run('build'), 'wisdom:done': () => run('upload:*'), diff --git a/.npmignore b/.npmignore index 6038010..909d8f1 100644 --- a/.npmignore +++ b/.npmignore @@ -1,8 +1,11 @@ -screen +*.config.* +*.log +*.loc + .* -test -yarn-error.log + webpack.config.js +screen +test coverage -*.config.* diff --git a/README.md b/README.md index 15a14cd..1c1880f 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,7 @@ You can use custom label passing into options param the buttons specification. F ```js const {tryToCatch} = require('try-to-catch'); const OK = 2; + const result = await tryToCatch(smalltalk.confirm, 'Question', 'Are you sure?', { buttons: { ok: 'Ok Label', diff --git a/lib/smalltalk.js b/lib/smalltalk.js index 57957e2..a45b2cb 100644 --- a/lib/smalltalk.js +++ b/lib/smalltalk.js @@ -1,7 +1,7 @@ +import '../css/smalltalk.css'; import currify from 'currify'; -import store from 'fullstore'; import createElement from '@cloudcmd/create-element'; -import '../css/smalltalk.css'; +import {fullstore} from 'fullstore'; const isBool = (a) => typeof a === 'boolean'; @@ -16,7 +16,7 @@ const BUTTON_OK_CANCEL = { cancel: 'Cancel', }; -const zIndex = store(100); +const zIndex = fullstore(100); export const alert = (title, msg, options) => { const buttons = getButtons(options) || BUTTON_OK; @@ -126,8 +126,8 @@ function parseButtons(buttons) { } function showDialog(title, msg, value, buttons, options) { - const ok = store(); - const cancel = store(); + const ok = fullstore(); + const cancel = fullstore(); const closeButtons = [ 'cancel', diff --git a/lib/smalltalk.native.js b/lib/smalltalk.native.js index 7248c29..d6acf8a 100644 --- a/lib/smalltalk.native.js +++ b/lib/smalltalk.native.js @@ -14,6 +14,7 @@ export const alert = (title, message, overrides = {}) => { export const prompt = (title, message, value, options, overrides = {}) => { const {prompt = globalThis.prompt} = overrides; const o = options; + const promise = new Promise((resolve, reject) => { const noCancel = o && !o.cancel; const result = prompt(message, value); diff --git a/test/smalltalk.js b/test/smalltalk.js index e153b80..5daa769 100644 --- a/test/smalltalk.js +++ b/test/smalltalk.js @@ -271,6 +271,7 @@ test('smalltalk: alert: keydown: tab: active name', (t, {document}) => { } = document; const parentElement = create(); + const el = { ...create(), parentElement, @@ -317,6 +318,7 @@ test('smalltalk: alert: keydown: left: focus', (t) => { } = document; const parentElement = create(); + const el = { ...create(), parentElement, From c7b5e6ecd60ac561e6faa7c66ffce87c0cf70fcf Mon Sep 17 00:00:00 2001 From: coderiaser Date: Thu, 19 Mar 2026 14:10:43 +0200 Subject: [PATCH 39/39] chore: smalltalk: v5.0.1 --- ChangeLog | 11 +++++++++++ package.json | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e0b1300..dfa9b8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2026.03.19, v5.0.1 + +feature: +- 492c630 smalltalk: webpack-cli v7.0.2 +- 2e80306 smalltalk: version-io v6.1.2 +- e41b6da smalltalk: putout v42.2.3 +- fefed49 smalltalk: madrun v13.0.1 +- 0439d8f smalltalk: eslint-plugin-putout v31.1.1 +- 954f062 smalltalk: eslint v10.0.3 +- a28f0fa smalltalk: superc8 v12.3.1 + 2026.02.02, v5.0.0 feature: diff --git a/package.json b/package.json index 595df0e..4e51e4d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "smalltalk", - "version": "5.0.0", + "version": "5.0.1", "type": "module", "description": "Promise-based Alert, Confirm and Prompt replacement", "homepage": "http://github.com/coderaiser/smalltalk",