@wildwinter/app-shell 0.28.0 → 0.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +24 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -1
- package/dist/index.d.ts +41 -1
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/dist/settings.css +4 -0
- package/dist/settings.css.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -339,6 +339,46 @@ declare function gameIdify(text: string): string;
|
|
|
339
339
|
* "derive one", which is a different thing from an address. */
|
|
340
340
|
declare function isValidGameId(gameId: string): boolean;
|
|
341
341
|
|
|
342
|
+
/** The five words `@wildwinter/expr` lexes as keywords, so a property may not be
|
|
343
|
+
* called any of them: the reference does not resolve, it fails to parse. Kept
|
|
344
|
+
* here as a copy for the same reason the rules are (no dependency), and each
|
|
345
|
+
* app probes the real parser to prove the list is still true. */
|
|
346
|
+
declare const RESERVED_PROPERTY_NAMES: readonly string[];
|
|
347
|
+
/** What an editor should tell an author, in one line. */
|
|
348
|
+
declare const PROPERTY_NAME_HINT = "Lower case letters, digits and underscores. Cannot start with a digit. No hyphens or spaces.";
|
|
349
|
+
/**
|
|
350
|
+
* Coerce a label into a legal property name: lower case, apostrophes dropped,
|
|
351
|
+
* runs of anything else to a single underscore, no trailing underscore, an
|
|
352
|
+
* underscore in front if it would otherwise start with a digit, and one behind
|
|
353
|
+
* if it would otherwise be a keyword.
|
|
354
|
+
*
|
|
355
|
+
* A LEADING underscore is kept where the author typed one, because `_private` is
|
|
356
|
+
* a legal name and a meaningful choice; only the ends that would be illegal are
|
|
357
|
+
* touched.
|
|
358
|
+
*
|
|
359
|
+
* May return "", when there was nothing usable in the input. Callers treat that
|
|
360
|
+
* as "no name yet" rather than as a name.
|
|
361
|
+
*/
|
|
362
|
+
declare function propertyNameify(text: string): string;
|
|
363
|
+
/**
|
|
364
|
+
* Is this a name the expression language can actually reach? Lower case letters,
|
|
365
|
+
* digits and underscores, not starting with a digit, and not a keyword.
|
|
366
|
+
*
|
|
367
|
+
* "" is NOT legal: an unnamed declaration is an unfinished row, which is a
|
|
368
|
+
* different thing from an illegal one, and callers distinguish them.
|
|
369
|
+
*/
|
|
370
|
+
declare function isValidPropertyName(name: string): boolean;
|
|
371
|
+
/**
|
|
372
|
+
* The one thing that is only a case difference, e.g. `isNight` -> `isnight`.
|
|
373
|
+
*
|
|
374
|
+
* Worth its own question because it is the only violation that can be repaired
|
|
375
|
+
* without guessing at intent: the language already folds every REFERENCE, so
|
|
376
|
+
* folding the declaration to match changes nothing observable, where inventing
|
|
377
|
+
* an underscore for a space is a decision about what the author meant. Loaders
|
|
378
|
+
* fold this class silently and report the rest.
|
|
379
|
+
*/
|
|
380
|
+
declare function isCaseOnlyPropertyName(name: string): boolean;
|
|
381
|
+
|
|
342
382
|
interface GameIdEditorOptions {
|
|
343
383
|
anchor: HTMLElement;
|
|
344
384
|
/** The pinned address, or "" when it is being derived. */
|
|
@@ -719,4 +759,4 @@ interface StepperBarOptions {
|
|
|
719
759
|
/** Draw (or hide) the bar in `host`. Idempotent: call it again with new state. */
|
|
720
760
|
declare function renderStepperBar(host: HTMLElement, opts: StepperBarOptions): void;
|
|
721
761
|
|
|
722
|
-
export { type AboutOptions, type AnchoredPanel, type AnchoredPanelOptions, type Child, type Comment, type CommentMessage, type CommentsOptions, type ConfirmOptions, type DocLine, type DupGuard, type ElProps, type GameIdEditorOptions, type IconName, type IconSvgName, type Identity, type IdentityOptions, type JobProgressOptions, type JobProgressView, type Notes, type NotesEditorOptions, PALETTE, PALETTE_SIZE, type PaneShell, type PaneShellOptions, type PaneShellState, type PaneSide, type PaneSideConfig, type PinButton, type PinButtonOptions, type SaveController, type SaveControllerOptions, type SaveIndicator, type SaveStatus, type SettingsDialog, type SettingsDialogOptions, type SettingsSection, type SettingsSectionHandle, type ShardVc, type StaleBarOptions, type StepperBarOptions, type StepperItem, type StepperTone, type TipRect, type TooltipOptions, type VcMap, askIdentity, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createSaveController, dupGuard, el, expandableRow, focusNewRow, foldVc, gameIdify, hideTip, icon, iconBtn, iconSvg, initTooltips, isValidGameId, labelled, lockControls, lockNotice, mountJobProgress, mountPaneShell, mountSettingsDialog, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, renderStepperBar, saveIndicator, showAbout, staleBar, tagChips, tipAt, tipBold, vcBadgeFor };
|
|
762
|
+
export { type AboutOptions, type AnchoredPanel, type AnchoredPanelOptions, type Child, type Comment, type CommentMessage, type CommentsOptions, type ConfirmOptions, type DocLine, type DupGuard, type ElProps, type GameIdEditorOptions, type IconName, type IconSvgName, type Identity, type IdentityOptions, type JobProgressOptions, type JobProgressView, type Notes, type NotesEditorOptions, PALETTE, PALETTE_SIZE, PROPERTY_NAME_HINT, type PaneShell, type PaneShellOptions, type PaneShellState, type PaneSide, type PaneSideConfig, type PinButton, type PinButtonOptions, RESERVED_PROPERTY_NAMES, type SaveController, type SaveControllerOptions, type SaveIndicator, type SaveStatus, type SettingsDialog, type SettingsDialogOptions, type SettingsSection, type SettingsSectionHandle, type ShardVc, type StaleBarOptions, type StepperBarOptions, type StepperItem, type StepperTone, type TipRect, type TooltipOptions, type VcMap, askIdentity, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createSaveController, dupGuard, el, expandableRow, focusNewRow, foldVc, gameIdify, hideTip, icon, iconBtn, iconSvg, initTooltips, isCaseOnlyPropertyName, isValidGameId, isValidPropertyName, labelled, lockControls, lockNotice, mountJobProgress, mountPaneShell, mountSettingsDialog, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, propertyNameify, renderStepperBar, saveIndicator, showAbout, staleBar, tagChips, tipAt, tipBold, vcBadgeFor };
|
package/dist/index.d.ts
CHANGED
|
@@ -339,6 +339,46 @@ declare function gameIdify(text: string): string;
|
|
|
339
339
|
* "derive one", which is a different thing from an address. */
|
|
340
340
|
declare function isValidGameId(gameId: string): boolean;
|
|
341
341
|
|
|
342
|
+
/** The five words `@wildwinter/expr` lexes as keywords, so a property may not be
|
|
343
|
+
* called any of them: the reference does not resolve, it fails to parse. Kept
|
|
344
|
+
* here as a copy for the same reason the rules are (no dependency), and each
|
|
345
|
+
* app probes the real parser to prove the list is still true. */
|
|
346
|
+
declare const RESERVED_PROPERTY_NAMES: readonly string[];
|
|
347
|
+
/** What an editor should tell an author, in one line. */
|
|
348
|
+
declare const PROPERTY_NAME_HINT = "Lower case letters, digits and underscores. Cannot start with a digit. No hyphens or spaces.";
|
|
349
|
+
/**
|
|
350
|
+
* Coerce a label into a legal property name: lower case, apostrophes dropped,
|
|
351
|
+
* runs of anything else to a single underscore, no trailing underscore, an
|
|
352
|
+
* underscore in front if it would otherwise start with a digit, and one behind
|
|
353
|
+
* if it would otherwise be a keyword.
|
|
354
|
+
*
|
|
355
|
+
* A LEADING underscore is kept where the author typed one, because `_private` is
|
|
356
|
+
* a legal name and a meaningful choice; only the ends that would be illegal are
|
|
357
|
+
* touched.
|
|
358
|
+
*
|
|
359
|
+
* May return "", when there was nothing usable in the input. Callers treat that
|
|
360
|
+
* as "no name yet" rather than as a name.
|
|
361
|
+
*/
|
|
362
|
+
declare function propertyNameify(text: string): string;
|
|
363
|
+
/**
|
|
364
|
+
* Is this a name the expression language can actually reach? Lower case letters,
|
|
365
|
+
* digits and underscores, not starting with a digit, and not a keyword.
|
|
366
|
+
*
|
|
367
|
+
* "" is NOT legal: an unnamed declaration is an unfinished row, which is a
|
|
368
|
+
* different thing from an illegal one, and callers distinguish them.
|
|
369
|
+
*/
|
|
370
|
+
declare function isValidPropertyName(name: string): boolean;
|
|
371
|
+
/**
|
|
372
|
+
* The one thing that is only a case difference, e.g. `isNight` -> `isnight`.
|
|
373
|
+
*
|
|
374
|
+
* Worth its own question because it is the only violation that can be repaired
|
|
375
|
+
* without guessing at intent: the language already folds every REFERENCE, so
|
|
376
|
+
* folding the declaration to match changes nothing observable, where inventing
|
|
377
|
+
* an underscore for a space is a decision about what the author meant. Loaders
|
|
378
|
+
* fold this class silently and report the rest.
|
|
379
|
+
*/
|
|
380
|
+
declare function isCaseOnlyPropertyName(name: string): boolean;
|
|
381
|
+
|
|
342
382
|
interface GameIdEditorOptions {
|
|
343
383
|
anchor: HTMLElement;
|
|
344
384
|
/** The pinned address, or "" when it is being derived. */
|
|
@@ -719,4 +759,4 @@ interface StepperBarOptions {
|
|
|
719
759
|
/** Draw (or hide) the bar in `host`. Idempotent: call it again with new state. */
|
|
720
760
|
declare function renderStepperBar(host: HTMLElement, opts: StepperBarOptions): void;
|
|
721
761
|
|
|
722
|
-
export { type AboutOptions, type AnchoredPanel, type AnchoredPanelOptions, type Child, type Comment, type CommentMessage, type CommentsOptions, type ConfirmOptions, type DocLine, type DupGuard, type ElProps, type GameIdEditorOptions, type IconName, type IconSvgName, type Identity, type IdentityOptions, type JobProgressOptions, type JobProgressView, type Notes, type NotesEditorOptions, PALETTE, PALETTE_SIZE, type PaneShell, type PaneShellOptions, type PaneShellState, type PaneSide, type PaneSideConfig, type PinButton, type PinButtonOptions, type SaveController, type SaveControllerOptions, type SaveIndicator, type SaveStatus, type SettingsDialog, type SettingsDialogOptions, type SettingsSection, type SettingsSectionHandle, type ShardVc, type StaleBarOptions, type StepperBarOptions, type StepperItem, type StepperTone, type TipRect, type TooltipOptions, type VcMap, askIdentity, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createSaveController, dupGuard, el, expandableRow, focusNewRow, foldVc, gameIdify, hideTip, icon, iconBtn, iconSvg, initTooltips, isValidGameId, labelled, lockControls, lockNotice, mountJobProgress, mountPaneShell, mountSettingsDialog, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, renderStepperBar, saveIndicator, showAbout, staleBar, tagChips, tipAt, tipBold, vcBadgeFor };
|
|
762
|
+
export { type AboutOptions, type AnchoredPanel, type AnchoredPanelOptions, type Child, type Comment, type CommentMessage, type CommentsOptions, type ConfirmOptions, type DocLine, type DupGuard, type ElProps, type GameIdEditorOptions, type IconName, type IconSvgName, type Identity, type IdentityOptions, type JobProgressOptions, type JobProgressView, type Notes, type NotesEditorOptions, PALETTE, PALETTE_SIZE, PROPERTY_NAME_HINT, type PaneShell, type PaneShellOptions, type PaneShellState, type PaneSide, type PaneSideConfig, type PinButton, type PinButtonOptions, RESERVED_PROPERTY_NAMES, type SaveController, type SaveControllerOptions, type SaveIndicator, type SaveStatus, type SettingsDialog, type SettingsDialogOptions, type SettingsSection, type SettingsSectionHandle, type ShardVc, type StaleBarOptions, type StepperBarOptions, type StepperItem, type StepperTone, type TipRect, type TooltipOptions, type VcMap, askIdentity, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createSaveController, dupGuard, el, expandableRow, focusNewRow, foldVc, gameIdify, hideTip, icon, iconBtn, iconSvg, initTooltips, isCaseOnlyPropertyName, isValidGameId, isValidPropertyName, labelled, lockControls, lockNotice, mountJobProgress, mountPaneShell, mountSettingsDialog, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, propertyNameify, renderStepperBar, saveIndicator, showAbout, staleBar, tagChips, tipAt, tipBold, vcBadgeFor };
|
package/dist/index.js
CHANGED
|
@@ -860,6 +860,25 @@ function isValidGameId(gameId) {
|
|
|
860
860
|
return /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/.test(gameId);
|
|
861
861
|
}
|
|
862
862
|
|
|
863
|
+
// src/property-names.ts
|
|
864
|
+
var RESERVED_PROPERTY_NAMES = ["true", "false", "and", "or", "not"];
|
|
865
|
+
var PROPERTY_NAME_HINT = "Lower case letters, digits and underscores. Cannot start with a digit. No hyphens or spaces.";
|
|
866
|
+
function propertyNameify(text) {
|
|
867
|
+
const trimmed = text.trim();
|
|
868
|
+
const deliberateLeading = trimmed.startsWith("_");
|
|
869
|
+
let out = trimmed.toLowerCase().replace(/['’]/g, "").replace(/[^a-z0-9_]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "");
|
|
870
|
+
if (out === "") return "";
|
|
871
|
+
if (deliberateLeading || /^[0-9]/.test(out)) out = `_${out}`;
|
|
872
|
+
if (RESERVED_PROPERTY_NAMES.includes(out)) out = `${out}_`;
|
|
873
|
+
return out;
|
|
874
|
+
}
|
|
875
|
+
function isValidPropertyName(name) {
|
|
876
|
+
return /^[a-z_][a-z0-9_]*$/.test(name) && !RESERVED_PROPERTY_NAMES.includes(name);
|
|
877
|
+
}
|
|
878
|
+
function isCaseOnlyPropertyName(name) {
|
|
879
|
+
return !isValidPropertyName(name) && isValidPropertyName(name.toLowerCase());
|
|
880
|
+
}
|
|
881
|
+
|
|
863
882
|
// src/id-editor.ts
|
|
864
883
|
function openGameIdEditor(opts) {
|
|
865
884
|
const slugify = opts.slugify ?? gameIdify;
|
|
@@ -1520,6 +1539,6 @@ function renderStepperBar(host, opts) {
|
|
|
1520
1539
|
);
|
|
1521
1540
|
}
|
|
1522
1541
|
|
|
1523
|
-
export { PALETTE, PALETTE_SIZE, askIdentity, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createSaveController, dupGuard, el, expandableRow, focusNewRow, foldVc, gameIdify, hideTip, icon, iconBtn, iconSvg, initTooltips, isValidGameId, labelled, lockControls, lockNotice, mountJobProgress, mountPaneShell, mountSettingsDialog, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, renderStepperBar, saveIndicator, showAbout, staleBar, tagChips, tipAt, tipBold, vcBadgeFor };
|
|
1542
|
+
export { PALETTE, PALETTE_SIZE, PROPERTY_NAME_HINT, RESERVED_PROPERTY_NAMES, askIdentity, closeAnchoredPanel, closeWithExit, colourFor, colourIndex, confirmDialog, createSaveController, dupGuard, el, expandableRow, focusNewRow, foldVc, gameIdify, hideTip, icon, iconBtn, iconSvg, initTooltips, isCaseOnlyPropertyName, isValidGameId, isValidPropertyName, labelled, lockControls, lockNotice, mountJobProgress, mountPaneShell, mountSettingsDialog, moveItem, openAnchoredPanel, openComments, openGameIdEditor, openNotesEditor, paintVcBadges, pinButton, placeAnchored, propertyNameify, renderStepperBar, saveIndicator, showAbout, staleBar, tagChips, tipAt, tipBold, vcBadgeFor };
|
|
1524
1543
|
//# sourceMappingURL=index.js.map
|
|
1525
1544
|
//# sourceMappingURL=index.js.map
|