Skip to content

Commit

Permalink
Adds frontend importmap and deno.json imports map, so that we are no …
Browse files Browse the repository at this point in the history
…longer dependent on serving git modules side-by-side!
  • Loading branch information
stephband committed Jul 29, 2024
1 parent a98e07f commit 2724e36
Show file tree
Hide file tree
Showing 60 changed files with 227 additions and 199 deletions.
6 changes: 6 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"dom/": "https://stephen.band/dom/modules/",
"fn/": "https://stephen.band/fn/modules/"
}
}
2 changes: 1 addition & 1 deletion deno/compile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@



import compileAsyncFn from '../../fn/modules/compile-async.js';
import compileAsyncFn from 'fn/compile-async.js';
import { dimgreendim, dim, red, yellow } from './log.js';


Expand Down
2 changes: 1 addition & 1 deletion deno/imports.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import * as Path from "https://deno.land/[email protected]/path/mod.ts";

import overload from '../../fn/modules/overload.js';
import overload from 'fn/overload.js';
import getExtension from '../modules/get-extension.js';
import getAbsolute from './get-absolute.js';
import { red, yellow } from './log.js';
Expand Down
8 changes: 4 additions & 4 deletions deno/include.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import id from '../../fn/modules/id.js';
import noop from '../../fn/modules/noop.js';
import overload from '../../fn/modules/overload.js';
import toType from '../../fn/modules/to-type.js';
import id from 'fn/id.js';
import noop from 'fn/noop.js';
import overload from 'fn/overload.js';
import toType from 'fn/to-type.js';

import getExtension from '../modules/get-extension.js';
import getAbsolute from './get-absolute.js';
Expand Down
8 changes: 4 additions & 4 deletions deno/parse-length.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import id from '../../fn/modules/id.js';
import overload from '../../fn/modules/overload.js';
import parseValue from '../../fn/modules/parse-value.js';
import toType from '../../fn/modules/to-type.js';
import id from 'fn/id.js';
import overload from 'fn/overload.js';
import parseValue from 'fn/parse-value.js';
import toType from 'fn/to-type.js';

/**
px(value)
Expand Down
2 changes: 1 addition & 1 deletion deno/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
read(pathname)
**/

import cache from '../../fn/modules/cache.js';
import cache from 'fn/cache.js';
import { dimbluedim } from './log.js';

// TextDecoder decodes the Uint8Array to unicode text
Expand Down
12 changes: 6 additions & 6 deletions deno/scope.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import * as path from "https://deno.land/[email protected]/path/mod.ts";
// Absolute path to module
const moduleAbs = path.dirname(path.fromFileUrl(import.meta.url));

import { addDate } from '../../fn/modules/date.js';
import { addTime } from '../../fn/modules/time.js';
import exec from '../../fn/modules/exec.js';
import get from '../../fn/modules/get.js';
import overload from '../../fn/modules/overload.js';
import toType from '../../fn/modules/to-type.js';
import { addDate } from 'fn/date.js';
import { addTime } from 'fn/time.js';
import exec from 'fn/exec.js';
import get from 'fn/get.js';
import overload from 'fn/overload.js';
import toType from 'fn/to-type.js';

import read from './read.js';
import { rewriteURL, rewriteURLs } from './url.js';
Expand Down
4 changes: 2 additions & 2 deletions documentation/classes/nav.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import { clamp } from '../../../fn/modules/clamp.js';
import events from '../../../dom/modules/events.js';
import { clamp } from 'fn/clamp.js';
import events from 'dom/events.js';


events({ type: 'scroll', capture: true }, window)
Expand Down
2 changes: 1 addition & 1 deletion documentation/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import '../../bolt/classes/device.js';
import DetailsToggle from '../../details-toggle/module.js';

// Events
import navigate from '../../dom/modules/navigate.js';
import navigate from 'dom/navigate.js';

// Components
import './classes/nav.js';
10 changes: 5 additions & 5 deletions element/element.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

import cache from '../../fn/modules/cache.js';
import Data from '../../fn/modules/data.js';
import create from '../../dom/modules/create.js';
import element, { getInternals } from '../../dom/modules/element.js';
import toPrefetchPromise from '../../dom/modules/element/to-prefetch-promise.js';
import cache from 'fn/cache.js';
import Data from 'fn/data.js';
import create from 'dom/create.js';
import element, { getInternals } from 'dom/element.js';
import toPrefetchPromise from 'dom/element/to-prefetch-promise.js';
import getById from '../modules/dom/get-by-id.js';
import assignDataset from '../modules/dom/assign-dataset.js';
import Literal from '../modules/template.js';
Expand Down
16 changes: 8 additions & 8 deletions element/property.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

import Signal from '../../fn/modules/signal.js';
import arg from '../../fn/modules/arg.js';
import nothing from '../../fn/modules/nothing.js';
import overload from '../../fn/modules/overload.js';
import toCamelCase from '../../fn/modules/to-camel-case.js';
import TokenList from '../../dom/modules/element/token-list.js';
import updateTokenList from '../../dom/modules/element/update-token-list.js';
import { getInternals } from '../../dom/modules/element.js';
import Signal from 'fn/signal.js';
import arg from 'fn/arg.js';
import nothing from 'fn/nothing.js';
import overload from 'fn/overload.js';
import toCamelCase from 'fn/to-camel-case.js';
import TokenList from 'dom/element/token-list.js';
import updateTokenList from 'dom/element/update-token-list.js';
import { getInternals } from 'dom/element.js';
import requestData from '../modules/request-data.js';

const define = Object.defineProperty;
Expand Down
13 changes: 13 additions & 0 deletions element/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
window.DEBUG = true;
</script>

<!--script type="importmap">{
"imports": {
"dom/": "https://stephen.band/dom/modules/",
"fn/": "https://stephen.band/fn/modules/"
}
}</script-->

<script type="importmap">{
"imports": {
"dom/": "http://localhost/dom/modules/",
"fn/": "http://localhost/fn/modules/"
}
}</script>

<link rel="stylesheet" href="../../bolt/elements/table.css" />
<link rel="stylesheet" href="../../bolt/classes/striped-table.css" />
Expand Down
2 changes: 1 addition & 1 deletion literal-element/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ That may now be authored:
<p>Current time: <dom-clock interval="3"></dom-clock></p>
**/

import element from '../../dom/modules/element.js';
import element from 'dom/element.js';
import lifecycle from './modules/lifecycle.js';
import properties from './modules/properties.js';

Expand Down
4 changes: 2 additions & 2 deletions literal-element/modules/lifecycle.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

// Lifecycle for <template is="literal-element">

import nothing from '../../../fn/modules/nothing.js';
import { getInternals } from '../../../dom/modules/element.js';
import nothing from 'fn/nothing.js';
import { getInternals } from 'dom/element.js';
import defineElement from '../../modules/define-element.js';

const assign = Object.assign;
Expand Down
2 changes: 1 addition & 1 deletion literal-element/modules/properties.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import { getInternals } from '../../../dom/modules/element.js';
import { getInternals } from 'dom/element.js';
import { rewriteURL } from '../../modules/urls.js';
import parseNameValues from '../../modules/parse/parse-name-values.js';

Expand Down
4 changes: 0 additions & 4 deletions literal-html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
<meta name="description" content="localhost" />
<meta name="viewport" content="width=device-width" />





<script title="load">
document.documentElement.className += ' js loading';
// window.addEventListener('DOMContentLoaded', () => document.documentElement.classList.remove('content-loading'));
Expand Down
6 changes: 3 additions & 3 deletions literal-html/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ make it easy to mix islands of dynamically rendered content into static content.
**/


import noop from '../../fn/modules/noop.js';
import Signal from '../../fn/modules/signal.js';
import element, { getInternals as Internals } from '../../dom/modules/element.js';
import noop from 'fn/noop.js';
import Signal from 'fn/signal.js';
import element, { getInternals as Internals } from 'dom/element.js';
import assignDataset from '../modules/dom/assign-dataset.js';
import requestData from '../modules/request-data.js';
import DOMRenderer from '../modules/template.js';
Expand Down
13 changes: 13 additions & 0 deletions literal-html/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,19 @@
window.DEBUG = true;
</script>

<!--script type="importmap">{
"imports": {
"dom/": "https://stephen.band/dom/modules/",
"fn/": "https://stephen.band/fn/modules/"
}
}</script-->

<script type="importmap">{
"imports": {
"dom/": "http://localhost/dom/modules/",
"fn/": "http://localhost/fn/modules/"
}
}</script>

<link rel="stylesheet" href="../../bolt/elements/table.css" />
<link rel="stylesheet" href="../../bolt/classes/striped-table.css" />
Expand Down
4 changes: 2 additions & 2 deletions module.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Template.compiled = compiled;
export default Template;

export { default as config } from './modules/config.js';
export { default as Data } from '../fn/modules/data.js';
export { default as Signal } from '../fn/modules/signal.js';
export { default as Data } from 'fn/data.js';
export { default as Signal } from 'fn/signal.js';
export { urls } from './modules/urls.js';
8 changes: 4 additions & 4 deletions modules/compile/compile-node.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import id from '../../../fn/modules/id.js';
import overload from '../../../fn/modules/overload.js';
import toType from '../../../dom/modules/to-type.js';
import decode from '../../../dom/modules/decode.js';
import id from 'fn/id.js';
import overload from 'fn/overload.js';
import toType from 'dom/to-type.js';
import decode from 'dom/decode.js';
import indexOf from '../dom/index-of.js';
import TextRenderer from '../renderer/renderer-text.js';
import { printError } from '../print.js';
Expand Down
2 changes: 1 addition & 1 deletion modules/compile/compile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import compileFn from '../../../fn/modules/compile.js';
import compileFn from 'fn/compile.js';
import { log } from '../log.js';

const indent = window.DEBUG ? '\n ' : '' ;
Expand Down
4 changes: 2 additions & 2 deletions modules/get-extension.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import exec from '../../fn/modules/exec.js';
import get from '../../fn/modules/get.js';
import exec from 'fn/exec.js';
import get from 'fn/get.js';

export default exec(/\.[\w\d.]+$/, get(0));
2 changes: 1 addition & 1 deletion modules/include.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ${ data.array.map(include('#list-item')) }
```
**/

import Data from '../../fn/modules/data.js';
import Data from 'fn/data.js';
import getById from './dom/get-by-id.js';
import Literal from './template.js';
import requestTemplate from './request-template.js';
Expand Down
2 changes: 1 addition & 1 deletion modules/log.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import noop from '../../fn/modules/noop.js';
import noop from 'fn/noop.js';

const colors = {
'aqua': '#00a8a9',
Expand Down
6 changes: 3 additions & 3 deletions modules/parse/parse-comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
Parse files for documentation comments
*/

import capture from '../../../fn/modules/capture.js';
import noop from '../../../fn/modules/noop.js';
import slugify from '../../../fn/modules/slugify.js';
import capture from 'fn/capture.js';
import noop from 'fn/noop.js';
import slugify from 'fn/slugify.js';

import { parseString } from './parse-string.js';
import { parseParams } from './parse-params.js';
Expand Down
4 changes: 2 additions & 2 deletions modules/parse/parse-name-values.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import capture from '../../../fn/modules/capture.js';
import last from '../../../fn/modules/last.js';
import capture from 'fn/capture.js';
import last from 'fn/last.js';

/**
parseNameValues(array, string)
Expand Down
2 changes: 1 addition & 1 deletion modules/parse/parse-params.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import capture from '../../../fn/modules/capture.js';
import capture from 'fn/capture.js';


/**
Expand Down
4 changes: 2 additions & 2 deletions modules/parse/parse-string.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import capture from '../../../fn/modules/capture.js';
import noop from '../../../fn/modules/noop.js';
import capture from 'fn/capture.js';
import noop from 'fn/noop.js';


/**
Expand Down
6 changes: 3 additions & 3 deletions modules/print.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Messages should be styled with the print stylesheet:
**/

import noop from '../../fn/modules/noop.js';
import Data from '../../fn/modules/data.js';
import create from '../../dom/modules/create.js';
import noop from 'fn/noop.js';
import Data from 'fn/data.js';
import create from 'dom/create.js';
import { log } from './log.js';

const linkHTML = '<a class="literal-link" href="https://stephen.band/literal/literal-html/">literal</literal>';
Expand Down
2 changes: 1 addition & 1 deletion modules/renderer/renderer-attribute.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

//import composeString from './compose-string.js';
import Signal from '../../../fn/modules/signal.js';
import Signal from 'fn/signal.js';
import names from './property-names.js';
import Renderer, { stats } from './renderer.js';
import { printError } from '../print.js';
Expand Down
4 changes: 2 additions & 2 deletions modules/renderer/renderer-boolean.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import Signal from '../../../fn/modules/signal.js';
import sum from '../../../fn/modules/sum.js';
import Signal from 'fn/signal.js';
import sum from 'fn/sum.js';
import AttributeRenderer from './renderer-attribute.js';
import { stats } from './renderer.js';

Expand Down
8 changes: 4 additions & 4 deletions modules/renderer/renderer-checked.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import id from '../../../fn/modules/id.js';
import isDefined from '../../../fn/modules/is-defined.js';
import Signal from '../../../fn/modules/signal.js';
import trigger from '../../../dom/modules/trigger.js';
import id from 'fn/id.js';
import isDefined from 'fn/is-defined.js';
import Signal from 'fn/signal.js';
import trigger from 'dom/trigger.js';
import config from '../config.js';
import bindChecked from '../../scope/bind-checked.js';
import AttributeRenderer from './renderer-attribute.js';
Expand Down
4 changes: 2 additions & 2 deletions modules/renderer/renderer-dataset.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import Signal from '../../../fn/modules/signal.js';
import toCamelCase from '../../../fn/modules/to-camel-case.js';
import Signal from 'fn/signal.js';
import toCamelCase from 'fn/to-camel-case.js';
import AttributeRenderer, { toAttributeString } from './renderer-attribute.js';
import { stats } from './renderer.js';

Expand Down
6 changes: 3 additions & 3 deletions modules/renderer/renderer-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ processing the literal content is more DOM content this renderer will insert
that DOM after the text node.
**/

import Signal from '../../../fn/modules/signal.js';
import Data from '../../../fn/modules/data.js';
import { isCommentNode, isElementNode, isFragmentNode, isTextNode } from '../../../dom/modules/node.js';
import Signal from 'fn/signal.js';
import Data from 'fn/data.js';
import { isCommentNode, isElementNode, isFragmentNode, isTextNode } from 'dom/node.js';
import include from '../include.js';
import deleteRange from '../dom/delete-range.js';
import Literal from '../template.js';
Expand Down
8 changes: 4 additions & 4 deletions modules/renderer/renderer-tokens.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import id from '../../../fn/modules/id.js';
import nothing from '../../../fn/modules/nothing.js';
import overload from '../../../fn/modules/overload.js';
import Signal from '../../../fn/modules/signal.js';
import id from 'fn/id.js';
import nothing from 'fn/nothing.js';
import overload from 'fn/overload.js';
import Signal from 'fn/signal.js';
import toText from './to-text.js';
import AttributeRenderer from './renderer-attribute.js';
import { stats } from './renderer.js';
Expand Down
Loading

0 comments on commit 2724e36

Please sign in to comment.