Changelog
[0.7.3] - 2024-06-15
Changelog
[0.7.2] - 2024-05-29
options.element
and options
as optional in applyCSSProperties
type declarations.force
parameter to $Window
's close
method in type declarations and documentation.getIconAtSize
return type to Node | null
(from HTMLElement
) in type declarations, and mentioned that it can return null
in the documentation.private $icon
to JQuery<Node>
)dock
method requirement to deprecated $component
option of $Window
constructor, in type declarations.)$G.off("scroll", onscroll);
for non-existent onscroll
in $Window.js
. This didn't cause an error, since onscroll
is a global event, but it shouldn't have been there.)Changelog
[0.7.1] - 2024-05-24
Changelog
[0.7.0] - 2024-05-23
item
in favor of label
for menu item labels
shortcut
in favor of shortcutLabel
and ariaKeyShortcuts
aria-keyshortcuts
needs "Control" spelled out, and for macOS "Meta" for the command key, unlike the traditional visual representations. Hence the separation of concerns.AccessKeys
API for parsing and rendering labels with access keys (syntax: &
defines the following character as the access key, &&
inserts one literal ampersand)
AccessKeys.escape(label)
escapes ampersands by doubling themAccessKeys.unescape(label)
unescapes ampersands by removing one of each pairAccessKeys.has(label)
returns whether the label has an access keyAccessKeys.get(label)
returns the access key character, or null
if there isn't oneAccessKeys.remove(label)
returns plain text without access key indicator, like AccessKeys.toText()
but with a special case to remove parentheticals such as " (&N)" rather than just the ampersandAccessKeys.toText(label)
returns plain text without access key syntaxAccessKeys.toHTML(label)
returns HTML with <span class="menu-hotkey">
around the access key (uses AccessKeys.toFragment
for security)AccessKeys.toFragment(label)
returns a DocumentFragment
with <span class="menu-hotkey">
wrapping the access key characterAccessKeys.indexOf(label)
(don't use this)os-gui
package, in os-gui.d.ts
tsconfig.json
's include
or files
array, or use a /// <reference path="node_modules/os-gui/os-gui.d.ts" />
directive. I'm not sure how exactly this is supposed to work.$Window
methods:
onFocus
, onBlur
, and onClosed
API for events (looking to remove dependency on jQuery)addChildWindow($window)
(don't use this)unminimize()
(don't use this)$Window
properties:
closed
: Whether the window has been closed.icons
: The icons of the window at different sizes, as set by options.icons
or setIcons()
.$minimize
: the minimize button$maximize
: the maximize button$title_area
(don't use this)$icon
(don't use this)$Window
property element
(already mentioned but now has a section like other properties)shortcutLabel
for defining the label of the shortcut key combination separately from the ariaKeyShortcuts
property; this replaces the old shortcut
propertyariaKeyShortcuts
for defining the access key combination for the menu item. Must follow aria-keyshortcuts syntax.label
for defining the label of the menu item; this replaces the old item
propertyvalue
(only for radio items) for defining a radio option valuemask-image
MenuBar
menu item property description
is now optional.see Changed
Changelog
[0.6.0] - 2021-11-01
$window.task
way of interfacing with a taskbar. Use $window.setMinimizeTarget(taskbarButtonElement)
instead, and events icon-change
and title-change
to update the button.MenuBar
method closeMenus()
to close any open menus.MenuBar
method setKeyboardScope(...elements)
to control hotkey handling$Window
method setMenuBar(menuBar)
to set the menu bar, and set up the keyboard scope.$Window
method setMinimizeTarget(taskbarButtonElement)
to set the element representing the window when minimized, which will be used when animating.$Window
property element
to get the DOM element.element.$window
to get the $Window
instance from the DOM element.$Window
events icon-change
and title-change
makeBlackToInsetFilter()
in parse-theme.js
to initialize an SVG filter for disabled button iconsblur
event, to facilitate a hack in Pinball, where a blur
is triggered to trick the game into pausing.resizable
can no longer be maximized. The maximize button will be grayed out.ButtonText
theme color instead of always black.Changelog
[0.5.0] - 2021-10-29
$Window
's terrible options.icon
API. Use the new, versatile options.icons
instead. No more ugly globals you have to define! Example: new $Window({icons: {16: 'app-16x16.png', any: 'app-icon.svg'}})
setIconByID()
, use setIcons(icons)
instead (with same format as options.icons
)getIconName()
, use $window.icons
instead perhaps, or avoid it entirelyapplyCSSProperties
now takes an options object instead of an element as the second argument. Use options.element
to specify the root element. Default is document.documentElement
(i.e. <html>
, :root
).applyCSSProperties
now accepts a CSSStyleDeclaration
interchangeably with a plain object of CSS properties, same as renderThemeGraphics
does. I don't know if this is useful, but it's good to be consistent, and this doesn't cost much.touch-action: none
is now applied to the menu bar, so the page doesn't scroll if you're trying to access the menus..taskbar
element)$Window
's closed
event wasn't fired because the element was removed from the DOM.toolWindow
window with parentWindow
defined now shows as focused.aria-owns
attribute now correctly uses element IDs (not stringified elements like [object HTMLDivElement]
)pointerId
((e.pointerId ?? e.originalEvent.pointerId)
); affects the cursor during window resizing (which uses setPointerCapture
to keep a consistent cursor).options.iframes.ignoreCrossOrigin
to silence warnings about cross-origin iframes (which can't be seamlessly integrated).applyCSSProperties
now supports options.recurseIntoIframes
(defaults to false
).$Window
methods maximize()
, minimize()
, and restore()
$Window
option icons
which can specify icons of different sizes. Pass an object with keys that are sizes in pixels (or "any"), and values that are the URL of an image, or an object with srcset
if you want support different pixel densities, or a DOM node if you want full control (e.g. to use an <svg>
or a font icon or an emoji text node).$Window
method setTitlebarIconSize
to set the icon size, picking the nearest size from icons
.$Window
method getTitlebarIconSize
to get the current icon size.$Window
method getIconAtSize
to pick an icon for the given size, for use in a taskbar. Returns an element or null
.$Window
now exposes icons
property based on the options.icons
option..pressing
class to show buttons as pressed (when triggering via the keyboard for example).Changelog
[0.4.1] - 2021-10-20
MenuBar
without $Window.js
(TypeError: Assignment to constant variable.
)document.body
not existing if you create a MenuBar
before DOMContentLoaded
object
, embed
, video
, audio
, iframe
, [contenteditable]
)info
events (for status bar updates) are now sent when using the arrow keys to navigate.Changelog
[0.4.0] - 2021-10-15
minWidth
option; use minOuterWidth
instead.minHeight
option; use minOuterHeight
instead.window.focusedWindow
(not part of API)$MenuBar.js
; use MenuBar.js
instead. jQuery is no longer used by the menu bar module.$MenuBar(menus)
; use new MenuBar(menus).element
instead.info
event; use event.detail?.description
instead.parseThemeFileString
can now return undefined
if the theme file is not valid.dir
attribute / CSS direction
property is now respected at the level of the window/menu bar, rather than just the document body, so you can have individual windows with different directions.<div class="menu-container">
element. Top level menus are now children of <body>
, as submenus already were.class="default"
, and if that doesn't exist, the first control, and if there's no controls, the window itself (specifically $window.$content
) or a tool window's parent window.$window.focus()
now actually focuses something, rather than just bringing the window to the top and making it appear active. It will focus the last focused control within the window, or else a control with class="default"
, or else, if it's a tool window, the parent window, and otherwise the window itself (specifically $window.$content
).$window.blur()
now removes focus from any focused control within the window. If focus is outside the window, it's not changed.<body>
element is smaller than the viewport. The boundary is considered to be the maximum of the document's scrollable area and the viewport.mousedown
or pointerdown
on your element and call event.preventDefault()
, the standard way to prevent blur.setDimensions({ innerWidth, innerHeight, outerWidth, outerHeight })
to set the size of the window.innerWidth
, innerHeight
, outerWidth
, outerHeight
to set the initial size of the window.minInnerWidth
, minInnerHeight
, minOuterWidth
, minOuterHeight
to set the minimum size of the window.info
event now works with submenus as well. (Previously items that contain submenus were assumed to not have descriptions, simply because Paint's one submenu does not a have a description. But for instance Explorer has descriptions for all of its menus (except Favorites, which is a bit special, what with drag and drop and context menus and all.))dir
attribute is propagated from the menu bar element's direction
CSS property to the floating menus.)Changelog
[0.3.0] - 2021-09-04
toolWindow
, parentWindow
, maximizeButton
, minimizeButton
, closeButton
, resizable
, minWidth
, minHeight
, and constrainRect(rect, x_axis, y_axis)
.bringTitleBarInBounds()
.closed
, which should be used instead of close
for detecting when the window is closed. Use close
only for preventing the window from closing.window-drag-start
.contain: layout paint;
on .window-content
in the layout CSS.flex: 1;
in the layout CSS. The $content
element still uses the default box model (i.e. display: block
), but is stretched within its parent which uses display: flex;
.touch-action
CSS property instead of obsolete PEP polyfill's attribute. The PEP library was never included or documented as a dependency.Changelog
[0.2.2] - 2020-04-30